-
-
Notifications
You must be signed in to change notification settings - Fork 80.7k
[Feature] User notification + workspace context re-injection on model fallback #79163
Copy link
Copy link
Open
Labels
P2Normal backlog priority with limited blast radius.Normal backlog priority with limited blast radius.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.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.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: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.staleMarked as stale due to inactivityMarked as stale due to inactivity
Description
Metadata
Metadata
Assignees
Labels
P2Normal backlog priority with limited blast radius.Normal backlog priority with limited blast radius.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.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.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: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.staleMarked as stale due to inactivityMarked as stale due to inactivity
Type
Fields
Priority
None yet
Problem
When a model fallback occurs mid-session (e.g., primary model rate-limits and the fallback chain fires), three user-facing gaps compound into a single failure mode: the session silently changes personality.
Originally filed as part of #65824 (item 1) and #65812, audited against 2026.4.15. Re-audited against 2026.5.7 — all three gaps confirmed still present.
What 2026.5.7 gets right
The internal observability is significantly improved since our original filing:
model-fallback-DIXhOaxb.js(was inline) now has structured fallback step fields, attempt tracking, and chain-position logging.buildFallbackNotice()emits↪️ Model Fallback: <active>as a lifecycle-stream event on transition.fallback_clearedemitted on recovery — useful for debugging.Credit where due: the fallback internals are now well-structured and debuggable. The gaps are in the user-facing layer.
Remaining gaps
Gap A: Non-verbose users see nothing
agent-runner.runtime-DQsCsHUA.js:3929-3937—buildFallbackNotice()is gated behindif (verboseEnabled). On default settings, a mid-session switch from Opus to Gemini is invisible.We understand the verbose gate is probably a deliberate UX choice to avoid noise. A lightweight opt-in — something like
agents.defaults.fallback.notify: trueor a one-line non-verbose notice — would bridge this for users who want awareness without full verbose output.Gap B: No workspace-context re-injection on fallback
contextInjection: "continuation-skip"(the recommended default for token efficiency) does not re-inject bootstrap context when the model changes mid-session. The skip logic atselection-BeP8qtCb.js:4586-4587checksbootstrapModeandhasCompletedBootstrapTurnbut not model-change state.Result: the fallback model inherits conversation history but not SOUL.md / AGENTS.md / workspace persona. This is the root of the "session suddenly feels different" class of incident.
Gap C: No event type for user hooks
model_fallback_decisionatmodel-fallback-DIXhOaxb.js:202is a log event (subsystem logger), not a plugin hook event. There's nomodel:fallbackor equivalent in the plugin hook system, so user plugins can't react to fallback transitions.Workaround
contextInjection: "always"re-injects on every turn, covering fallback turns — at a token cost. Ourcanon-guardianplugin (shared in [Show and Tell] canon-guardian: selective workspace canon re-injection on model switch / native fallback / restart #75750) selectively re-injects only on model switch, new session, and periodic safety net, covering the gap at ~2-4% of turns.Proposed solution
agents.defaults.fallback.notifyconfig field. When enabled, inject a one-line system message on model switch (e.g., "continuation-skipis active and the model changes, treat the next turn as a bootstrap turn for context injection purposes. Check model-change state alongsidebootstrapMode/hasCompletedBootstrapTurnin the skip logic.model:fallback(or equivalent) to the plugin hook system so user plugins can react to transitions.Impact
Highest. Every "my agent changed personalities" report we've seen traces back to the re-injection gap. Affects every user running a fallback chain with
contextInjection: "continuation-skip".Environment