Repository navigation
Conversation
Resumed sessions started on the configured default, so a client restoring its own model tripped the context guard and could not reopen the thread. Record the model in transcript schema 7, restore it on load and resume, and fall back to the default only when it is provably unusable. An explicit --model or --provider overrides and replaces it. Exempt switches to a window at least as large as the recorded one, return a distinct confirmation error with its explanation, and report recorded context usage after restoring.
Contributor
There was a problem hiding this comment.
Model restoration can reject valid Anthropic aliases and hidden subscription models, while headless prompt resumes bypass restoration entirely. Explicit ACP overrides can also publish a previous model's context capacity. The new confirmation code uses an ACP-reserved range, and OpenRouter/Speakeasy restoration adds a duplicate serialized catalog request.
Took 20 min
Apply restoration and explicit overrides to persistent prompts, confirm Anthropic aliases through the retrieve endpoint, keep hidden subscription models in catalog membership, ignore a recorded window that belongs to another model, and move the confirmation code out of the ranges ACP reserves.
A model change without a new response left the previous model's window on the latest usage, so a later attachment could report it as the selected model's capacity. Derive attribution from record order and stop trusting the recorded window for forks.
Inferring a recorded window's model from transcript record order could not see responses produced during a temporary fallback. Stamp each usage with its producing model and trust the recorded window only when it matches the selection, which also covers overrides, switches, and forks.
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
Durable sessions now remember their model and restore it on
session/loadandsession/resume, falling back to the configured default when the model is provably unusable. An explicit--modelor--provideroverrides and replaces the remembered model. Kit also reports recorded context usage after restoring a session.Motivation
A resumed session started on the configured default, so an ACP client that restored its own saved model looked like it was switching models. Above 80% occupancy the context guard rejected that switch with a bare
Internal error, and Paseo treats that as fatal, which made the thread impossible to reopen. Clients also showed no context data after a resume until the next model response.Impact
-32603to-31050and now carries its explanation inmessage. Thekit.model_switchdata is unchanged.Technical details
Evidence required for fallback
Only missing provider credentials, an unparseable id, a successful listing that omits the model, or a 404 for an Anthropic id missing from the listing count as unusable; aliases resolve through the retrieve endpoint. A failed listing keeps the remembered model. The check reads the raw listing because the advertised catalog always adds the current model. A fallback lasts for that attachment only: the record is kept, so the model returns once it is available again.
Telling explicit flags from defaults
The TUI always forwards its resolved model to
kit serve, so--modelalone cannot signal intent. It now passes the hidden--prefer-session-modelflag when the user did not choose a model on the command line. Subagent harness launches keep their explicit model.Existing transcripts
These have no model record and items do not record their model, so there is nothing to restore. The guard exemption compares the target window with the window recorded on the latest usage, which frees these threads without knowing the previous model. The client's first successful selection then writes the record.
Usage update timing
The usage update is sent after activation instead of during replay, because Paseo discards non-transcript updates while replaying. A model change also refreshes the update using the new model's advertised window, and the recorded window is used only when it belongs to the selected model. Each usage now records its producing model as
kit.modelmetadata for that check.Child sessions
Inherited child transcripts deliberately do not copy the parent's model, since a child's model is chosen when it is spawned.