← Back to PRs

#17011: fix(/new /reset): clear model override for reset turn

by Limitless2023 open 2026-02-15 09:47 View on GitHub →
stale size: XS
Fixes #17003 ## Problem When using /new or /reset, the welcome message shows the previous session's model instead of the default model. ## Root Cause Model override was NOT being explicitly cleared when resetTriggered=true, causing the reset turn to inherit the old model for selection. ## Solution Explicitly set persistedModelOverride and persistedProviderOverride to undefined when reset is triggered, ensuring the turn uses default model selection. ## Result Welcome message now correctly shows the default model after /new or /reset. <!-- greptile_comment --> <h3>Greptile Summary</h3> Adds explicit `undefined` assignments for `persistedModelOverride` and `persistedProviderOverride` inside the `resetTriggered` branch of `initSessionState`, with the intent of ensuring model/provider overrides are not carried over on `/new` or `/reset`. - The change is a **defensive clarification** — analysis of the control flow confirms that these variables are already `undefined` at this point (initialized as `undefined` on lines 141-142, and the only branch that assigns them non-`undefined` values at lines 238-239 is guarded by `!isNewSession`, which is `false` when `resetTriggered` is `true`). Additionally, `baseEntry` is `undefined` when `isNewSession=true`, so the `??` fallback on lines 290-291 also stays `undefined`. - The comment update on line 248 accurately documents the intent: behavior overrides (verbose, thinking, reasoning, ttsAuto) are preserved across resets, but model/provider overrides are not. - No functional bugs or regressions introduced. <h3>Confidence Score: 5/5</h3> - This PR is safe to merge — the assignments are functionally redundant and introduce no behavioral change or risk. - The change adds two explicit `undefined` assignments that are already no-ops given the existing control flow. No new logic, no changed behavior, no risk of regression. The only file touched is `session.ts` with a minimal, well-scoped diff. - No files require special attention. <sub>Last reviewed commit: 280675f</sub> <!-- greptile_other_comments_section --> <!-- /greptile_comment -->

Most Similar PRs