ISSUE DESCRIPTION Isolated cron runs leak context when they reuse a stable session key…
- User
ISSUE DESCRIPTION
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.
ADDITIONAL ADVICE
Since you are given a git repository, you can use git commands to simplify your work. For example, if you made a mistake and want to revert your changes, you can use
git checkout <file>to restore the file to its original state. You can also reset all changes in the repository usinggit reset --hardcommand. Additionally, you can usegit stashandgit stash popto temporarily save your changes and restore them later. Finally, you can see the changes that you've made (which will be submitted when you callsubmit) usinggit statusorgit diffcommands. However you don't need to usegit addorgit commitbefore submitting your changes. In fact,submitonly submits currently unstaged changes because it usesgit diffto get the changes that need to be submitted.CHECKLIST
Before submitting your solution, please go over the following checklist and make sure you've done everything:
- If an error was reported in the issue description, I have successfully reproduced it.
- If an error was reported in the issue description, I have confirmed that my fix resolves the error.
- I have thought about edge cases and made sure my fix handles them as well.
- I have run existing tests in the repository that might have been affected by the change I made and confirmed that they pass. I want you to list every bullet from this checklist and write your reasoning for why you think you did it or didn't need to.
Repository has been uploaded and your shell is currently at the repository root. Time to solve the issue!
(Current directory: /lossless-claw, current file: none) bash-$
Assistant
Good, already imported. Let's check
compileSessionPatternexport (singular) too and add module-level constant + helper.Assistant
Now let's implement the changes. First, update the import and add the cron-key pattern + helper + isolated rollover reason constant.
Assistant
I'll use node with a small script instead.
Assistant
Now let's add a helper method
isIsolatedCronSessionKeynearisStatelessSession, and a method to resolve ambiguous rollover for cron keys (archive + fresh).Assistant
Let's look at afterTurn callsite (~6750-6796):
Assistant
Now let's insert the cron rollover resolution call right after the stale-transcript-missing rotation for bootstrap:
Assistant
Now for
reconcileTranscriptTailForAfterTurnInSessionQueue:Assistant
Now for
assemble():Assistant
Right, I need to actually add the method definition. Let's add it near
resolveIsolatedCronRunRollover.Assistant
Now let's add
rotateIsolatedCronSessionKeyConversationIfAmbiguousright afterfindAmbiguousSessionKeyRuntimeRollover, beforelogAmbiguousSessionKeyRuntimeRollover.Assistant
Typecheck passes. Now let's rerun the repro test.
Assistant
Good, the 3 pre-existing "ambiguous runtime rollover" tests still pass. Now let's run the full test suite.
Assistant
All 4 requirements verified: assemble is fully isolated (no leaked "run1 secret" content), compaction runs successfully on the new isolated conversation, prior run is archived, and ordinary non-cron continuity behavior is completely unchanged. Let's remove the temp test file and rerun the full suite once more to be safe.
Assistant
All 1067 tests pass. Now let's double check the typecheck and build still work, and add a changeset entry consistent with repo conventions.
Assistant
Build succeeds. Now let's add a changeset following repo convention.
Assistant
Now let's review the full diff to make sure everything looks clean.
Assistant
Looks good. Let's view the assemble callsite fully too.
Assistant
Now let's view bootstrap callsite once more:
Assistant
All three call sites look correct. Now let's run the complete test suite one final time plus typecheck and build to confirm everything is solid.
Assistant
All 1067 tests pass, typecheck is clean, and the build succeeds. Let's do a final review of the complete diff and clean up.
Assistant
No leftover temporary test files, only the intended engine.ts change and the changeset. Let's do one final sanity check that no stray temp files remain.
Assistant
Clean. Now let's go through the checklist explicitly.
Checklist review
- If an error was reported in the issue description, I have successfully reproduced it.
Yes. I wrote a reproduction script that ran
bootstrap()for a first isolated cron run (sessionKeyagent:main:cron:nightly, sessionIdrun-1) with private content, thenbootstrap()/ingest()for a second isolated run reusing the same sessionKey (sessionIdrun-2). Before the fix,conv1was silently renamed torun-2and the new run's stored messages included"run1 secret task"/"run1 secret reply"— a clear context leak, exactly matching "Isolated cron runs leak context when they reuse a stable session key."
- If an error was reported in the issue description, I have successfully reproduced it.
Yes. I wrote a reproduction script that ran
Assistant
Good, my change is restored correctly.
-
If an error was reported in the issue description, I have confirmed that my fix resolves the error. Yes. After the fix, re-running the same scenario shows: bootstrap resolves the ambiguity by archiving the prior run's conversation (
active:false,archivedAtset) and creating a fresh conversation for the new run;assemble()for the new run never includes any content from the prior run; and the new run's stored messages contain only its own content. -
I have thought about edge cases and made sure my fix handles them as well.
-
Assistant
All checklist items are satisfied. Let's do one last full verification run before submitting.
Assistant
Everything passes. Let's submit the changes.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.