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
I'll trace how isolated cron sessions bind to stable session keys and where LCM context is loaded or reused across runs.
- Assistant
Implementing isolated-cron detection and rotation when a stable session key is reused with a new runtime session ID.
- Assistant
Fixed isolated cron context leaking across runs that reuse a stable session key.
Problem
Stable cron keys like
agent:main:cron:nightlyare reused across independent runtime sessions. LCM resolved conversations bysessionKeyfirst, so a new cron run with a differentsessionIdwould attach to the prior run’s active conversation and leak its context.Fix
-
isStableIsolatedCronSessionKey()insession-patterns.ts— detects stable cron keys (cron:<job>) and excludes per-run keys that already include:run:. -
rotateIsolatedCronSessionIfRuntimeChanged()inengine.ts— when a stable cron key is seen with a newsessionId, archives the prior conversation and creates a fresh active row (same pattern as other lifecycle rollovers). -
Guards at bootstrap, assemble, and afterTurn — rotation runs before conversation lookup/creation, so prior cron context never enters assembly or persistence for the new run.
-
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.