← Back to PRs

#17109: fix: preserve responseUsage across session resets

by Limitless2023 open 2026-02-15 12:19 View on GitHub →
scripts commands stale size: XS
Fixes #17102 ## Problem The `/usage` command setting (`responseUsage`) was lost on session resets (daily/idle), while other preferences (`thinkingLevel`, `verboseLevel`, `reasoningLevel`, `ttsAuto`) were preserved. Users had to re-type `/usage full` after each reset. ## Root Cause In `src/auto-reply/reply/session.ts`, `responseUsage` was only set from `baseEntry` (which is undefined on reset), while other settings used persisted fallbacks: ```ts responseUsage: baseEntry?.responseUsage, // ❌ Lost on reset ``` ## Solution Added `persistedResponseUsage` handling to match other preferences: 1. Added `persistedResponseUsage` to `SessionResolution` type 2. Persist value when session is fresh or reset triggered 3. Use persisted value as fallback in session entry initialization ```ts responseUsage: persistedResponseUsage ?? baseEntry?.responseUsage, // ✅ Preserved ``` ## Impact - `/usage` setting now persists across session resets - Consistent behavior with other per-session preferences - Users don't need to re-enable `/usage` after `/new`, `/reset`, or daily resets <!-- greptile_comment --> <h3>Greptile Summary</h3> This PR fixes a bug where the `/usage` command setting (`responseUsage`) was lost during session resets (triggered by `/new`, `/reset`, or idle/daily timeouts), requiring users to re-enable it after each reset. The fix adds `persistedResponseUsage` handling to match the existing pattern used for other per-session preferences like `thinkingLevel`, `verboseLevel`, `reasoningLevel`, and `ttsAuto`. The implementation correctly persists the value when a session is fresh or when a reset is triggered, and uses the persisted value as a fallback during session initialization. <h3>Confidence Score: 5/5</h3> - This PR is safe to merge with no identified risks - The fix follows the exact same pattern already established for other session preferences (`ttsAuto`, `thinkingLevel`, `verboseLevel`, `reasoningLevel`). The implementation is minimal, focused, and consistent across both files. Type definitions are correct, and the changes align with the existing codebase architecture. No logical errors, security issues, or unintended side effects detected. - No files require special attention <sub>Last reviewed commit: f7a45f0</sub> <!-- greptile_other_comments_section --> <!-- /greptile_comment -->

Most Similar PRs