← Back to PRs

#19087: fix(sessions): sync display fields on model switch

by Suksham-sharma open 2026-02-17 10:44 View on GitHub →
gateway size: M
## Summary Fixes #18603 `applyModelOverrideToSessionEntry()` updated `providerOverride`/`modelOverride` but left the display fields (`model`/`modelProvider`) stale. Every UI surface — session list, CLI status, TUI — reads the display fields, so a switched model appeared unchanged until the next message was actually sent. - On model switch: write display fields alongside override fields - On revert-to-default: clear display fields so consumers fall back to configured defaults - Added `model-overrides.test.ts` (12 tests) covering set, clear, idempotency, stale display sync, auth profile handling, and timestamp behavior - Extended `sessions-patch.test.ts` with display field assertions and two new test cases <!-- greptile_comment --> <h3>Greptile Summary</h3> Fixed model switch display bug where UI surfaces showed stale model info. The function `applyModelOverrideToSessionEntry()` now syncs display fields (`model`/`modelProvider`) alongside override fields (`modelOverride`/`providerOverride`), ensuring session lists, CLI status, and TUI reflect changes immediately. <h3>Confidence Score: 5/5</h3> - This PR is safe to merge with minimal risk - Clean bug fix with comprehensive test coverage (12 new unit tests in model-overrides.test.ts plus 2 integration tests in sessions-patch.test.ts). The fix is straightforward: syncing display fields alongside override fields. All edge cases are tested including idempotency, stale display sync, clearing on default, and the exact regression scenario from issue #18603. No breaking changes or risky refactoring. - No files require special attention <sub>Last reviewed commit: 653c915</sub> <!-- greptile_other_comments_section --> <!-- /greptile_comment -->

Most Similar PRs