#8134: feat(session): add per-group session reset configuration
stale
Cluster:
Session Management and Fixes
## 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
#20078: feat(session): Add channelGroups config(optional config) for shared...
by demarlik01 · 2026-02-18
79.2%
#14243: fix: fire session-memory hook on auto-resets + topic-aware memory p...
by TheDude135 · 2026-02-11
75.6%
#7537: fix(sessions): reset token counts on /new for channel sessions
by SoniAssist · 2026-02-02
75.5%
#13882: feat: Enhance session checkpoint system with better types and valid...
by trevorgordon981 · 2026-02-11
74.4%
#14358: fix: preserve session overrides (verbose, model) across /new or /rese…
by WyattSanders · 2026-02-12
74.4%
#16798: feat(session): add configurable greetingPrompt for /new and /reset
by rustyorb · 2026-02-15
74.2%
#23505: feat(session): add mode: "off" to disable automatic session reset
by KillianGDK-FDTI · 2026-02-22
73.7%
#15493: feat(telegram): session state memory for diagnostic continuity
by tangcruz · 2026-02-13
73.6%
#15684: fix(telegram): persist relative session transcript paths
by Jdo300 · 2026-02-13
73.6%
#16061: fix(sessions): tolerate invalid sessionFile metadata
by haoyifan · 2026-02-14
73.1%