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
Now let me add the predicate to
session-patterns.ts: - Assistant
Now wire the call sites. Bootstrap first:
- Assistant
Now the afterTurn reconcile guard:
- Assistant
Now add unit tests for the new predicate:
- Assistant
All 4 new engine tests pass. Now run the full suite:
- Assistant
The fix is complete and verified. Summary of what was done:
Problem
Isolated cron runs start a fresh runtime session (
sessionId) per run, but the host can hand every run the same stable session key. LCM keys conversations by session key, so reattached each new run to the previous run's conversation (), and // resolved the old conversation by key — leaking the prior run's context into the new run. The existing guards didn't cover this: only rotates when the old transcript file was deleted, and the ambiguous-rollover guard merely fails closed without archiving, leaving the stale conversation active.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.