Skip to content

fix(tui): explain pending agent switch in /model picker#513

Merged
theahura merged 2 commits into
mainfrom
auto/model-picker-shows-stale-agent-models-20260611-015434
Jun 11, 2026
Merged

fix(tui): explain pending agent switch in /model picker#513
theahura merged 2 commits into
mainfrom
auto/model-picker-shows-stale-agent-models-20260611-015434

Conversation

@theahura

Copy link
Copy Markdown
Contributor

Summary

🤖 Generated with Nori

  • Fixes the /model picker showing the previous agent's models when a user switches agents via /agent but hasn't started a new session yet (no prompt submitted).
  • Root cause: /agent only records a pending switch on ChatWidget.pending_agent; the live ACP connection (acp_handle) isn't swapped until the next prompt. ACP models are session-scoped, so open_model_popup() was querying the stale OLD-agent handle. Confirmed against the ACP spec: models only arrive in the session/new response.
  • Fix: 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 test model_popup_shows_pending_message_instead_of_stale_models (asserts the OLD agent's picker is never routed while a switch is pending) and snapshot test model_popup_pending_agent_snapshot.
  • cargo build --bin nori && cargo test -p tui-pty-e2e (12 passed).
  • just fmt + just fix -p nori-tui clean.
  • End-to-end manual drive (tmux): launched 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

theahura added 2 commits June 10, 2026 22:25
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.
@theahura theahura merged commit 877d1f1 into main Jun 11, 2026
2 checks passed
@theahura theahura deleted the auto/model-picker-shows-stale-agent-models-20260611-015434 branch June 11, 2026 02:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant