← Back to PRs

#12996: feat(infra): Add session persistence with atomic writes and recovery

by trevorgordon981 open 2026-02-10 01:24 View on GitHub →
channel: slack app: web-ui gateway agents stale
## Summary Adds session checkpoint/recovery system for handling interrupted sessions. ## Features - Atomic JSON writes every N messages (default 10) - findInterruptedSessions() on startup - formatResumePrompt() for user notification - Auto-cleanup of stale sessions >24h ## Files - src/infra/session-persistence.ts - src/infra/session-persistence.test.ts (10 tests) <!-- greptile_comment --> <h2>Greptile Overview</h2> <h3>Greptile Summary</h3> This PR introduces an infra-level session persistence/recovery capability (periodic checkpoints with atomic JSON writes, interrupted-session discovery, and stale cleanup) alongside a broad set of agent/gateway/infra additions (model routing + approval workflow plumbing, cron/metrics/cache utilities, and new trading skills). The main merge blocker is that multiple newly-added `skills/trading/*.mjs` scripts embed a hardcoded Finnhub API token as a runtime fallback when `FINNHUB_KEY` is not set. This is a committed secret and will be used by default in some environments, which is unsafe and should be removed before merging. Beyond that, the session persistence module is self-contained and currently only referenced by its tests in this changeset; if it’s intended to be active in production, it still needs wiring into the gateway startup/shutdown and message-processing flow. <h3>Confidence Score: 2/5</h3> - Not safe to merge until committed secret(s) are removed. - Multiple new trading skill scripts include a hardcoded Finnhub API token fallback, which is a clear security issue. Other changes look structurally reasonable, but the presence of committed secrets is a hard blocker for merge. - skills/trading/news-sentiment.mjs, skills/trading/options-flow.mjs, skills/trading/portfolio-risk.mjs <!-- greptile_other_comments_section --> <!-- /greptile_comment -->

Most Similar PRs