feat(gateway): SessionGCService three-tier GC + /gc command + cron (P8-014) #179

Merged
jason.woltje merged 1 commits from feat/p8-014-session-gc into main 2026-03-16 02:42:35 +00:00
Owner

Summary

  • Implements SessionGCService with three GC tiers: collect() (per-session immediate), sweepOrphans() (daily cron sweep), and fullCollect() (cold-start via OnModuleInit)
  • Wires GC into AgentService.destroySession() (fire-and-forget collect), CronService (daily 4am sweep via SESSION_GC_CRON env), and CommandExecutorService (/gc slash command)
  • Adds /gc to CommandRegistryService manifest and GCModule to AppModule, AgentModule, LogModule, CommandsModule
  • 8 Vitest unit tests covering all three tiers; all 49 gateway tests pass

Test plan

  • pnpm typecheck passes
  • pnpm lint passes
  • pnpm format:check passes
  • pnpm test — 49 tests (8 new GC tests) all pass

Closes #167

🤖 Generated with Claude Code

## Summary - Implements `SessionGCService` with three GC tiers: `collect()` (per-session immediate), `sweepOrphans()` (daily cron sweep), and `fullCollect()` (cold-start via `OnModuleInit`) - Wires GC into `AgentService.destroySession()` (fire-and-forget collect), `CronService` (daily 4am sweep via `SESSION_GC_CRON` env), and `CommandExecutorService` (`/gc` slash command) - Adds `/gc` to `CommandRegistryService` manifest and `GCModule` to `AppModule`, `AgentModule`, `LogModule`, `CommandsModule` - 8 Vitest unit tests covering all three tiers; all 49 gateway tests pass ## Test plan - [x] `pnpm typecheck` passes - [x] `pnpm lint` passes - [x] `pnpm format:check` passes - [x] `pnpm test` — 49 tests (8 new GC tests) all pass Closes #167 🤖 Generated with [Claude Code](https://claude.com/claude-code)
jason.woltje added 1 commit 2026-03-16 02:31:12 +00:00
feat(gateway): SessionGCService three-tier GC + /gc command + cron (P8-014)
All checks were successful
ci/woodpecker/push/ci Pipeline was successful
ci/woodpecker/pr/ci Pipeline was successful
bffd5883f3
Implements three-tier garbage collection for agent sessions:
- SessionGCService.collect() for immediate per-session cleanup on destroySession()
- SessionGCService.sweepOrphans() for daily cron sweep of orphaned Valkey keys
- SessionGCService.fullCollect() for cold-start aggressive cleanup via OnModuleInit
- /gc slash command wired into CommandExecutorService + registered in CommandRegistryService
- SESSION_GC_CRON (daily 4am) added to CronService
- GCModule provides Valkey (ioredis via @mosaic/queue) and is imported by AgentModule, LogModule, CommandsModule, AppModule
- 8 Vitest unit tests covering all three GC tiers

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
jason.woltje force-pushed feat/p8-014-session-gc from bffd5883f3 to b649b5c987 2026-03-16 02:39:08 +00:00 Compare
jason.woltje merged commit 8628f4f93a into main 2026-03-16 02:42:35 +00:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: mosaicstack/stack#179