Skip to content

feat: toggle to keep model/agent when switching sessions#24508

Open
alfredocristofano wants to merge 2 commits intoanomalyco:devfrom
alfredocristofano:contrib/cristofano-session-sticky
Open

feat: toggle to keep model/agent when switching sessions#24508
alfredocristofano wants to merge 2 commits intoanomalyco:devfrom
alfredocristofano:contrib/cristofano-session-sticky

Conversation

@alfredocristofano
Copy link
Copy Markdown

Issue for this PR

Closes #4930

Type of change

  • New feature

What does this PR do?

Right now, every time you switch sessions with Ctrl+X l, the TUI yanks your model and agent back to whatever the last message in that session used. If you were deliberately using a different setup, tough luck — you have to reconfigure it manually.

This PR adds a sync_prompt_context_on_session_switch KV preference (default true for backwards compatibility) that controls this behavior. When toggled off via the command palette, your current model and agent selection sticks with you across session switches instead of being overwritten.

How did you verify your code works?

  • Typecheck passes cleanly across all packages
  • The toggle shows up in the Session command palette as "Keep model/agent when switching sessions" / "Restore model/agent per session"
  • When disabled, switching sessions no longer resets local.agent and local.model from lastUserMessage()

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR
  • I have read the CONTRIBUTING.md guidelines

@github-actions
Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

Based on the search results, I found several related PRs that address similar functionality around model/agent persistence across session switches:

Potentially Related PRs:

  1. fix(app): keep selected model across new sessions #17190 - fix(app): keep selected model across new sessions

    • This is closely related as it also addresses keeping the model selection across session changes, though it may have been implemented differently or addressed a specific issue.
  2. fix(tui): prevent model picker reset after first message in new session #23681 - fix(tui): prevent model picker reset after first message in new session

    • Related to preventing unwanted resets of model selection during session operations.
  3. fix(app): persist per-agent model selections across agent switches #23420 - fix(app): persist per-agent model selections across agent switches

    • Addresses persistence of model selections, though specifically for agent switches rather than session switches.
  4. fix(acp): sync model and variant when activating session modes #18663 - fix(acp): sync model and variant when activating session modes

    • Related to syncing model state during session mode changes.
  5. fix(acp): session/set_mode now activates agent's configured model #18621 - fix(acp): session/set_mode now activates agent's configured model

    • Touches on model activation during session operations.

These PRs suggest there have been multiple efforts to handle model/agent state management during session switches. You may want to review #17190 and #23681 in particular to ensure there's no overlapping implementation or to understand how the previous attempts addressed this issue.

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.

Feature Request: Retain current model and agent selection when switching sessions

1 participant