← Back to PRs

#21849: fix(session): clear model/provider overrides on /new and /reset

by widingmarcus-cyber open 2026-02-20 13:07 View on GitHub →
size: XS trusted-contributor
## Summary Fixes #21725 `/new` and `/reset` now start the session on the configured default model instead of carrying over the previous per-session model override. ## Problem When a user sets a per-session model override via `/model opus`, then later runs `/new`, the model override persists in the session state. The new session starts on the overridden model instead of the configured default, and the runtime metadata in the system prompt reflects the stale override. ## Root Cause In `session.ts`, the reset handler carried over `modelOverride` and `providerOverride` alongside behavioral overrides (verbose, thinking, reasoning, ttsAuto). The behavioral carry-over is intentional — users don't want to re-enable thinking/verbose every time they start a new session. But model selection is a heavier, more intentional choice that should reset to the configured default. ## Fix Remove `modelOverride` and `providerOverride` from the carry-over block in the reset path. The `/new <model>` syntax still works (handled by `applyResetModelOverride` downstream). ### What changes: - `/new` → starts on default model ✅ - `/new opus` → starts on opus ✅ (unchanged) - `/model opus` then `/new` → resets to default ✅ (was broken, now fixed) - `/new` → preserves verbose/thinking/reasoning/ttsAuto ✅ (unchanged) ## Test Added regression test verifying model overrides are cleared while behavioral overrides are preserved across `/new`. All 39 tests pass. <!-- greptile_comment --> <h3>Greptile Summary</h3> Removed `modelOverride` and `providerOverride` from the reset carry-over block in `session.ts:257-261`, ensuring `/new` and `/reset` start fresh on the configured default model instead of persisting the previous session's model selection. Behavioral overrides (verbose, thinking, reasoning, ttsAuto) still carry over as intended. The PR also includes a cache-skipping fix for session store loading and a threadId inheritance fix for non-thread sessions. <h3>Confidence Score: 5/5</h3> - This PR is safe to merge with minimal risk - The fix is surgical and well-tested. The two-line change removes model/provider override persistence during reset, with comprehensive test coverage verifying the fix works as intended. The PR also includes two related improvements (cache bypass and threadId handling) that strengthen session management. All tests pass. - No files require special attention <sub>Last reviewed commit: 9307767</sub> <!-- greptile_other_comments_section --> <!-- /greptile_comment -->

Most Similar PRs