fix(tui): explain pending agent switch in /model picker#513
Merged
theahura merged 2 commits intoJun 11, 2026
Merged
Conversation
When a user switches agents via /agent but has not yet started a new session (no prompt submitted), the live acp_handle still belongs to the OLD agent. ACP models are session-scoped, so /model previously queried that stale handle and showed the previous agent's models. open_model_popup now short-circuits when pending_agent is set, rendering an explanatory message naming the pending agent and telling the user to send a message to start a session before its models appear.
…ws-stale-agent-models-20260611-015434
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
🤖 Generated with Nori
/modelpicker showing the previous agent's models when a user switches agents via/agentbut hasn't started a new session yet (no prompt submitted)./agentonly records a pending switch onChatWidget.pending_agent; the live ACP connection (acp_handle) isn't swapped until the next prompt. ACP models are session-scoped, soopen_model_popup()was querying the stale OLD-agent handle. Confirmed against the ACP spec: models only arrive in thesession/newresponse.open_model_popup()now short-circuits when a switch is pending and synchronously renders an explanatory picker (acp_model_picker_pending_agent_params) naming the pending agent and telling the user to send a message to start a session before its models appear — it no longer touches the stale handle.Test Plan
cargo test -p nori-tui(1335 passed) — added behavior testmodel_popup_shows_pending_message_instead_of_stale_models(asserts the OLD agent's picker is never routed while a switch is pending) and snapshot testmodel_popup_pending_agent_snapshot.cargo build --bin nori && cargo test -p tui-pty-e2e(12 passed).just fmt+just fix -p nori-tuiclean.nori --agent elizacp, switched to Gemini via/agent(no prompt submitted), opened/model→ showed "Gemini's models load once you start a session" / "Switching to Gemini — Send a message to start a session, then /model will show its models." instead of elizacp's models.Share Nori with your team: https://www.npmjs.com/package/nori-skillsets