← Back to PRs

#8134: feat(session): add per-group session reset configuration

by tylerliu612 open 2026-02-03 16:36 View on GitHub →
stale
## Summary Add support for configuring session reset settings at the per-group level, not just globally or by type/channel. ## Motivation Closes #8122 Some use cases require different session reset behaviors for different groups: - **TTS groups**: Each message is an independent translation task, so sessions should auto-reset after 1 minute idle - **Family/chat groups**: Should maintain normal session continuity ## Changes - Add `TelegramGroupSessionConfig` type with reset config options (`mode`, `atHour`, `idleMinutes`) - Add `session` field to `TelegramGroupConfig` - Add Zod schema validation for group session config - Add `resolveGroupResetConfig` helper to extract group-level reset config - Modify reset policy resolution to prioritize group config over channel/type defaults ## Example Configuration ```json { "channels": { "telegram": { "groups": { "-5117810383": { "requireMention": false, "session": { "reset": { "mode": "idle", "idleMinutes": 1 } } } } } } } ``` ## Testing - [ ] Build passes ✅ - [ ] Unit tests (pending CI) - [ ] Manual testing with TTS groups <!-- greptile_comment --> <h2>Greptile Overview</h2> <h3>Greptile Summary</h3> Adds per-Telegram-group session reset configuration (`channels.telegram.groups.*.session.reset`) and updates session initialization to prefer group-level reset overrides over channel/type defaults. Also extends the Telegram config types and Zod validation schema to accept the new `session` block under group configs. <h3>Confidence Score: 4/5</h3> - This PR is generally safe to merge, but multi-account Telegram setups may apply the wrong per-group reset policy in some configurations. - Changes are localized and schema-backed, but the new lookup for per-group reset config does not tie multi-account group selection to the inbound account context, which can lead to incorrect behavior depending on config ordering. - src/auto-reply/reply/session.ts <!-- greptile_other_comments_section --> <sub>(2/5) Greptile learns from your feedback when you react with thumbs up/down!</sub> <!-- /greptile_comment -->

Most Similar PRs