Skip to content

Model switch: optional context carryover into the new session #20

Closed

Description

@JAORMX

Context

The /models picker restart-now flow (shipped in 08597a7) starts a new session on the picked model — a session's provider/model is fixed, so switching is a new CreateSession, not a hot-swap. The confirm overlay deliberately ships without a context-carryover option: [enter] starts fresh, [s] switches next time, [esc] undoes. The transcript is reset on restart.

This issue tracks the deferred follow-up: optionally seed the new session with the prior conversation so a model switch can feel like a continuation rather than a cold start.

Why it was deferred (not a small UI addition)

Carryover collides with three load-bearing invariants and needs a real design, not a picker checkbox:

  1. No history-seed surface. CreateSession takes workspace/mode/limits/selector — no history. Prompt carries one user turn. Seeding history is a new wire contract and a new domain entry path that must satisfy "reopen-if-completed OR interrupt-if-cancelled" and Session.ReplaceHistory's tool-pairing validation.
  2. Stateless replay + opaque reasoning blob. Adapters replay full history each turn; Message.Reasoning carries one opaque, provider-private blob per message. Carrying an OpenAI transcript into an Anthropic session (the exact cross-provider switch a picker invites) means replaying provider-private encrypted reasoning to a provider that can't decode it — ignored at best, HTTP 400 at worst. Cross-provider carryover needs a translate-or-strip anti-corruption layer the codebase intentionally avoids.
  3. Turn-zero compaction. A carried-over history may exceed the new model's (possibly smaller) context window, forcing a compaction on turn zero against a model that never produced the transcript.

Scope when picked up

  • A design doc covering: the history-seed wire surface, the cross-provider Message.Reasoning handling (strip vs translate vs same-provider-only), and turn-zero compaction.
  • Likely a same-provider-only first cut (no reasoning-blob ACL needed), with cross-provider as a later step.
  • The picker confirm overlay then gains a [c] carry-over option (currently absent by design).

References

  • Shipped without carryover: 08597a7 (picker UX), 9ca24ae (effective-model echo)
  • Architecture rationale: docs/design/MULTI-PROVIDER.md (mid-session restart), CLAUDE.md (stateless adapters, Message.Reasoning neutrality, compaction tool-pairing)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions