Isolated cron runs leak context when they reuse a stable session key Different isolated…
- User
Isolated cron runs leak context when they reuse a stable session key
Different isolated cron runtime sessions that reuse a stable session key must not share active LCM context. Prior runs remain archived, compaction within the current run still works, and ordinary non-cron session continuity is unchanged.
Interface
No new public interfaces are introduced.
- Assistant
Investigating how isolated cron sessions and stable session keys interact with LCM context.
- Assistant
Implementing rotation for stable isolated cron session keys when a new runtime session starts, so prior LCM context isn't reused across runs.
- Assistant
Fixed isolated cron runs leaking LCM context when they reused a stable session key across new runtime sessions.
Problem
Cron jobs like
agent:main:cron:nightlykeep the samesessionKeyacross runs but get a newsessionIdeach time. LCM was reattaching the new runtime to the existing active conversation (viagetOrCreateConversation), so prior-run messages and summaries appeared in the next run.Fix
Added
rotateIsolatedCronSessionKeyOnRuntimeChangeinengine.tsthat detects stable cron keys (matchingcron:*but not:run:-scoped keys) and archives the prior active conversation before the new runtime attaches. It runs at the same lifecycle guard points as stale session-key rollover:bootstrapassembleafterTurn
Prior conversations are archived (not deleted), compaction within the same run is unchanged (same
sessionId→ no rotation), and ordinary non-cron session continuity is untouched.Tests
- Rotates to a fresh conversation when an isolated cron run reuses a stable session key (even when the old transcript file still exists)
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.