Description
TUI model selection is not persisted while session status is retry
Mechanism
At dev-vibecoded c54ff0e:
packages/tui/src/context/local.tsx:439-456updates the TUI's local model selection. The displayed choice can therefore change before the session row is updated.- The effect at
local.tsx:899-942reads the session status but callsselectionUpdatewithbusy: state.status === "busy"at line 920. A session inretryis excluded. selectionUpdateatlocal.tsx:64returns undefined when busy is false, so the effect does not callsdk.client.session.update. Model/provider switching during backoff can remain local-only.- Backend retry invalidation already exists:
processor.ts:873-885compares the persisted session model with the original request's provider/model.retry.ts:278-298checks invalidation after each 200 ms chunk, including the last chunk. When invalidated, the processor returns continue and the outer loop reads the latest persisted selection. - Therefore, suppressing the TUI update in retry status prevents the backend from seeing the change it is designed to act on. This is distinct from an inability to interrupt an already persisted switch.
Existing issue and test coverage
Closed issue #66 describes backend stale-retry invalidation and its intended behavior. This follow-up covers the TUI propagation path rather than the backend invalidation already covered by #66.
packages/tui/test/context/local.test.ts covers busy=true updates, busy=false suppression, same-model idempotence and agent isolation. It does not exercise actual TUI status=retry selection propagation. Backend test/session/retry.test.ts covers invalidation before/during/after the delay, but those tests provide the invalidation signal directly and do not prove the TUI writes it.
Expected behavior and acceptance
- Through the real TUI selection path, change provider/model while a session is in retry status and a long Retry-After wait is active.
- Verify that the valid new selection is persisted for the correct session and agent, the old-provider pending backoff is invalidated, and the next turn uses the new provider/model. The old provider must receive no further retry after invalidation.
- Do not merely clear the countdown text or cancel a valid in-flight request. Preserve turn-boundary semantics.
- Preserve same-selection idempotence, idle-session behavior, agent/session isolation, rejected-write reporting and normal backoff when no selection changes.
- Separately assert that status leaves the old retry state when the new request begins. If the new provider also rate-limits, show the new provider's actual error rather than treating every visible retry as stale.
- Use a local fake-provider boundary and a bounded test, not a multi-hour wait, a paid model call, a timeout increase or relaxed assertions.
Limits of attribution
Source establishes the missing retry-status propagation path. A rendered choice plus countdown alone cannot establish whether an individual running process retained the old provider wait, displayed stale status after a successful invalidation, or received another rate limit from the new provider. Distinguish with persisted selection, retry invalidation/new-request events and status provenance.
Sources
#66
https://github.com/mdev34-lab/silvercode/blob/c54ff0ef5a1ba02f84bd96cd1e7c5454f4ef18ba/packages/tui/src/context/local.tsx
https://github.com/mdev34-lab/silvercode/blob/c54ff0ef5a1ba02f84bd96cd1e7c5454f4ef18ba/packages/opencode/src/session/retry.ts
https://github.com/mdev34-lab/silvercode/blob/c54ff0ef5a1ba02f84bd96cd1e7c5454f4ef18ba/packages/opencode/src/session/processor.ts
Activity