[Feature]: Make provider context continuity and compaction provenance explicit #6957
Replies: 1 comment
|
I think another useful use case for this feature would be handling provider/model usage limits. For example:
I think "fork" would be preferable to simply replacing the provider in the existing thread, because it would preserve the original conversation and provider session while creating a clear branch point. Something like: Fork conversation → Select provider → Select model The original thread would remain untouched, while the new thread would start with the previous conversation/context available to the new provider. My main use case is hitting subscription/provider limits during a long coding session. I often have another provider available, but currently changing provider means losing the convenient continuity of the existing thread. This could also be useful even without hitting a limit — for example, using Claude for planning and then forking the conversation to Codex for implementation. I created a draft PR with this, here: #11096 I will test it for a bit. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Area
apps/server(related areas:packages/contracts,apps/web)Problem or use case
After a provider-process restart, idle-session cleanup, resume failure, or provider-instance change, a T3 thread can still contain its projected messages and activities while the provider session is resumed, recreated, started fresh, or unavailable.
T3 stores the projected thread history and provider session bindings separately. Provider bindings contain provider-specific resume cursors and runtime metadata.
ProviderSendTurnInputcontains the next input, attachments, model selection, and interaction mode; it does not contain a transcript or transcript-handoff field.The current provider paths include:
thread/resumetothread/startfor selected recoverable errors and treating malformed cursor data as no resume.session/loadwhen a resume ID exists and propagating session-load failures.The current web UI displays context usage, automatic compaction, and a generic
Context compactedactivity. It does not display a persisted outcome distinguishing native resume, native session creation, fresh fallback, transcript handoff, or unknown continuity.apps/web/src/historyBootstrap.tscontains a transcript-formatting helper, but it has no production call site in the current checkout. Fresh-session paths do not use it to send the projected transcript to a provider.Proposed solution
Add an explicit provider-continuity outcome at the server and contract boundary. The outcome should distinguish:
Persist and project the outcome so it is visible in the thread timeline. Include the provider and available pre/post token values for compaction events.
When a requested native resume is missing, invalid, rejected, or falls back to a fresh session, stop before the next user turn or tool execution and expose recovery actions for retrying native resume, starting a fresh provider session with an explicitly labeled transcript handoff, or opening a new thread.
Carry provider-native turn, item, request, and message identifiers into durable orchestration metadata where available. Use those identifiers when reconciling replayed provider events.
Keep provider-instance switching rejected when driver or continuation identities are incompatible. Require an explicit handoff for switches that cannot reuse native continuation.
Why this matters
The projected T3 transcript and the provider-native session are separate state sources. A user needs to know which provider-native state the next turn will use before sending it.
Smallest useful scope
A first implementation can:
Cross-provider transcript generation and provider-specific handoff formatting can be implemented as a separate follow-up once the continuity outcome is available.
Alternatives considered
historyBootstrapoutput into a fresh provider session. That helper is not currently wired into production and does not contain native tool state, hidden context, skills, MCP state, or provider memory.Risks or tradeoffs
Examples or references
All reactions