#23505: feat(session): add mode: "off" to disable automatic session reset
docs
gateway
size: XS
Cluster:
Session Management Improvements
## 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
#11613: fix: clear stale model metadata on /new and /reset
by mcaxtr · 2026-02-08
74.6%
#8134: feat(session): add per-group session reset configuration
by tylerliu612 · 2026-02-03
73.7%
#21731: Fix: clear stale session runtime model on /new, /reset, and session...
by AIflow-Labs · 2026-02-20
73.6%
#14358: fix: preserve session overrides (verbose, model) across /new or /rese…
by WyattSanders · 2026-02-12
73.2%
#21847: fix(session): /new and /reset no longer carry over model overrides
by hydro13 · 2026-02-20
72.9%
#17375: fix(session): don't carry stale model info into reset welcome message
by BinHPdev · 2026-02-15
72.1%
#21876: fix(session): clear model override on /new and /reset
by sauerdaniel · 2026-02-20
72.1%
#14018: fix: auto-remind AI to check workspace context files on session reset
by WalterSumbon · 2026-02-11
71.5%
#21849: fix(session): clear model/provider overrides on /new and /reset
by widingmarcus-cyber · 2026-02-20
71.1%
#6653: fix: persist archived session entry on /new or /reset
by leicao-me · 2026-02-01
70.7%