-
-
Notifications
You must be signed in to change notification settings - Fork 80.7k
Refactor session model/auth state resolution #87957
Copy link
Copy link
Open
Labels
P2Normal backlog priority with limited blast radius.Normal backlog priority with limited blast radius.clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.ClawSweeper found a clear likely implementation shape for this issue.clawsweeper:needs-live-reproClawSweeper needs live local, crabbox, or manual validation to confirm this issue.ClawSweeper needs live local, crabbox, or manual validation to confirm this issue.clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.ClawSweeper marked this issue as needing maintainer review before automation.clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.ClawSweeper marked this issue as needing a product or behavior decision.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.impact:auth-providerAuth, provider routing, model choice, or SecretRef resolution may break.Auth, provider routing, model choice, or SecretRef resolution may break.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.Session, memory, transcript, context, or agent state can drift or corrupt.issue-rating: 🐚 platinum hermitGood issue quality with a plausible reproduction path needing some confirmation.Good issue quality with a plausible reproduction path needing some confirmation.maintainerMaintainer-authored PRMaintainer-authored PR
Description
Metadata
Metadata
Assignees
Labels
P2Normal backlog priority with limited blast radius.Normal backlog priority with limited blast radius.clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.ClawSweeper found a clear likely implementation shape for this issue.clawsweeper:needs-live-reproClawSweeper needs live local, crabbox, or manual validation to confirm this issue.ClawSweeper needs live local, crabbox, or manual validation to confirm this issue.clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.ClawSweeper marked this issue as needing maintainer review before automation.clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.ClawSweeper marked this issue as needing a product or behavior decision.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.impact:auth-providerAuth, provider routing, model choice, or SecretRef resolution may break.Auth, provider routing, model choice, or SecretRef resolution may break.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.Session, memory, transcript, context, or agent state can drift or corrupt.issue-rating: 🐚 platinum hermitGood issue quality with a plausible reproduction path needing some confirmation.Good issue quality with a plausible reproduction path needing some confirmation.maintainerMaintainer-authored PRMaintainer-authored PR
Type
Fields
Priority
None yet
Opened on behalf of Onur Solmaz (
osolmaz). Follow-up refactor issue; not a blocker request for the narrow fix in #87893 unless maintainers decide otherwise.Problem
Session model/auth state is currently interpreted in several places. That makes it easy for one path to treat "what ran last time" as "what should run next time".
This showed up in #85126: a stale auto fallback runtime/auth selection could make Control UI/WebChat sessions appear or start on the fallback provider instead of the configured primary provider.
Related work:
Current split
The important decision points are currently separate:
src/auto-reply/reply/model-selection.tsdecides what model a run should use.src/gateway/server-methods/sessions.tsdecides what model/auth state a new child session inherits.src/gateway/session-utils.tsdecides what model UI/status/list/describe surfaces display.These paths should share one interpretation of persisted session state instead of each reading raw fields independently.
Refactor plan
Create an internal resolver for session model/auth state. It should return separate, explicit meanings for:
Then migrate callers so raw fields like
modelProvider,model,providerOverride,modelOverride, andauthProfileOverrideare treated as storage details, not local decision logic.Acceptance criteria
Non-goals
Suggested proof
Start with focused unit tests around the resolver, then cover the three call sites:
sessions.createinheritancesessions.list/sessions.describedisplayLive MiniMax/DeepSeek provider proof would be useful if credentials are available, but the refactor should be provable with synthetic session-store fixtures first.