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 the engine. First the import:
- Assistant
Now wire the call sites. Bootstrap first:
- Assistant
Now the afterTurn reconcile guard:
- Assistant
Now the assemble lifecycle guard:
- Assistant
Now the tests. Let me look at the test helpers first:
- Assistant
Now append the tests at the end of
test/engine.test.ts: - Assistant
Now the session-patterns unit tests:
- Assistant
All 6 new tests pass. Now run the full engine suite to check for regressions:
- Assistant
Full suite passes: 1075/1075. Let me check for a lint gate and the repo's changeset convention:
- Assistant
All gates pass. Let me review the final diff:
- Assistant
The implementation is complete and verified. Summary of the fix:
Problem
Isolated cron runs get a fresh runtime
sessionIdand transcript file each run but reuse a stable session key (agent:<id>:cron:<job>). LCM resolves conversations by session key first, so run N+1 reattached to run N's still-active conversation:
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.