← Back to PRs

#23505: feat(session): add mode: "off" to disable automatic session reset

by KillianGDK-FDTI open 2026-02-22 11:05 View on GitHub →
docs gateway size: XS
## Summary - Add `"off"` as a valid `session.reset.mode` value in session reset types and schema validation. - Ensure `resolveSessionResetPolicy()` disables automatic idle rotation when mode is `"off"` (even if `idleMinutes` is present). - Document `mode: "off"` behavior in gateway configuration reference and session management compaction docs. - Add regression tests for config validation and reset policy behavior. ## Testing - `pnpm build` ✅ - `pnpm check` ❌ (fails on existing unrelated TypeScript error in `src/gateway/server-methods/chat.directive-tags.test.ts`) - `pnpm test` (targeted) ✅ - `pnpm test src/config/sessions/sessions.test.ts src/config/config.schema-regressions.test.ts` ## Notes - AI-assisted PR. <!-- greptile_comment --> <h3>Greptile Summary</h3> This PR adds `mode: "off"` to session reset configuration, allowing users to disable automatic session resets while keeping manual `/new` and `/reset` commands functional. **Key changes:** - Added `"off"` as a valid `SessionResetMode` in type definitions and Zod schema validation - Modified `resolveSessionResetPolicy()` to explicitly set `idleMinutes: undefined` when mode is `"off"`, ensuring idle rotation is disabled even if `idleMinutes` is configured - Updated documentation in both configuration reference and session management docs to explain the `"off"` mode behavior - Added regression tests to verify config validation and policy resolution **Implementation correctness:** The implementation correctly handles the `"off"` mode. When mode is set to `"off"`, `evaluateSessionFreshness()` will always return `fresh: true` because both `dailyResetAt` and `idleExpiresAt` will be undefined, making sessions never automatically expire. Manual reset commands (`/new`, `/reset`) will continue to work as they bypass the freshness check. <h3>Confidence Score: 5/5</h3> - This PR is safe to merge with no identified risks - The implementation is straightforward, well-tested, and follows established patterns. The changes are limited in scope (adding a new enum value), properly validated through schema and tests, and the logic correctly handles the new mode by explicitly disabling automatic resets while preserving manual reset functionality. Documentation is thorough and accurate. - No files require special attention <sub>Last reviewed commit: 2edec03</sub> <!-- greptile_other_comments_section --> <sub>(2/5) Greptile learns from your feedback when you react with thumbs up/down!</sub> <!-- /greptile_comment --> Related to #20633

Most Similar PRs