feat: add allowIterResume flag to chain sessions across iterations#633
Open
jomonkj wants to merge 1 commit into
Open
feat: add allowIterResume flag to chain sessions across iterations#633jomonkj wants to merge 1 commit into
jomonkj wants to merge 1 commit into
Conversation
When allowIterResume is true, each iteration's sessionId is forwarded as the resumeSession for the next iteration. This lets iter 2..N resume from the prior iter's warm prompt-cache instead of starting cold, reducing token cost for multi-iteration runs. Opt-in via `allowIterResume: boolean` on RunOptions and OrchestrateOptions. When false (default), behaviour is unchanged: resumeSession applies to iteration 1 only.
|
@jomonkj is attempting to deploy a commit to the Matt Pocock's projects Team on Vercel. A member of the Team first needs to authorize it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Currently
resumeSessionis applied to iteration 1 only:For multi-iteration runs (maxIterations > 1), iter 2..N start cold — discarding the warm prompt-cache from the prior iteration. This increases token cost on every iteration beyond the first.
Solution
Add an opt-in
allowIterResume?: booleanflag toRunOptionsandOrchestrateOptions. When true, each iteration'ssessionIdis chained forward as the next iteration'sresumeSession:run()also relaxes its existingresumeSession + maxIterations > 1guard whenallowIterResume: trueis set.Behaviour
sessionIdasresumeSession. RequiresmaxIterations > 1to have any effect.Motivation
Filed on behalf of lbrmi/yard — a fleet orchestrator that runs Claude Code agents with multi-iteration implementer passes. We currently vendor a patched copy of
Orchestrator.js; if this lands upstream the vendor can be removed.