Skip to content

thinkingLevel: model switch silently downgrades and persists an inherited explicit override #87925

@hoobnn

Description

@hoobnn

Summary

Two paths persist a support-driven thinkingLevel downgrade onto the stored session override when the active model changes and the inherited level is unsupported. Unlike #87740 (per-turn reset, fixed in #87923), these fire only on a user-initiated model switch — but they still overwrite the user's stored preference, which does not come back if a supporting model is selected again.

Sites

  • src/gateway/sessions-patch.ts:604 — a PATCH changing model/provider without an explicit thinkingLevel: an inherited level unsupported by the new model is downgraded via resolveSupportedThinkingLevel and persisted (store[storeKey] = next). No client notification.
  • src/auto-reply/reply/directive-handling.persist.ts:319-326 — a /model switch with no /think directive remaps the stored level and persists it; returns a thinkingRemap notice.

Question for maintainers

Is downgrade-on-model-switch meant to permanently rewrite the stored preference (keep config valid for the new model), or should the explicit preference be preserved and only downgraded per-turn (as #87740 now does for the per-turn path)? The explicit-vs-inherited branching suggests it's deliberate, but it loses user intent across switches and the sessions-patch path is silent.

Repro (sessions-patch)

  1. Session stored with thinkingLevel: "high", model A (supports high).
  2. sessions.patch sets model to B (no high support), without thinkingLevel in the patch.
  3. Stored thinkingLevel becomes the downgraded level and persists.
  4. Patch model back to A → preference is not restored.

Notes

Surfaced during review of #87923 (fix for #87740). Not bundled there: different trigger (user model switch vs per-turn) and a product/compat decision about persisted config behavior.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Normal backlog priority with limited blast radius.clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.clawsweeper:needs-product-decisionClawSweeper 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:source-reproClawSweeper found a high-confidence source-level issue reproduction.impact:auth-providerAuth, provider routing, model choice, or SecretRef resolution may break.impact:session-stateSession, 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.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions