Repository navigation
spare live runs the interrupted-call repair and render memory linearly - #455
Merged
Merged
Conversation
A concurrent run of an open turn was told that another run's call was interrupted while that call was still running, because the assistant request is now durable before its handlers. A build leaves such an exchange out until every call has a result; the run that made the call and any request after the turn ended still answer a missing result with ToolInterrupted. A request's results now render in the order of its calls, whatever order they returned in, so a request no longer depends on tool timing. Rendering memory copied an accumulated list or map per entry in several passes (request pairing, presentations, compactions, the repair, tool-message merging, replies), which made every build of a long session quadratic: about ten seconds for 25,600 entries. Each pass is now linear, with byte-identical output, and takes about a tenth of a second there. The loop records a reply cut short together with its calls' ReplyCut answers, so a stop between two records no longer leaves cut calls rendered as possibly run, and its tool_start and tool_end events carry the call's own id. The chat completions SSE client finishes a body that ended with neither a finish reason nor [DONE] as unknown, so the loop runs none of a dropped stream's calls. Minted tool-call ids are now call_<turn>_<ordinal>_<step>_<n>: letters, digits and underscores only, short enough for every provider's pairing key, and an id-less provider result pairs with the id-less call of its own tool. The memory and step-loop kits gain in-flight-exchange, call-order and cut-record checks with careless self-tests.
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.
What
ToolInterrupted.@xandreed/plugin-agent-loop: a reply cut short is recorded with its calls'ReplyCutanswers in the same batch, andrunLoop'stool_start/tool_endcarry the call's own id instead of an execution id.@xandreed/plugin-models: a streamed chat completion whose body ended with neither a finish reason nor[DONE]finishesunknown, so the loop runs none of a dropped stream's calls;[DONE]or a whole completion without a reason still settles.call_<turn>_<ordinal>_<step>_<n>(call_<turn>_<ordinal>_p<n>for a planned batch): letters, digits and_only, short enough for Anthropic's^[a-zA-Z0-9_-]+$pairing keys after a provider switch. An id-less provider result pairs with the id-less call of its own tool. Stored ids replay as stored.toolCallIdOf(run, step, n)drops the tool argument; customStepLoops and memory strategies rerun their kits (newcut-record,in-flight-exchange,call-orderchecks, each with a careless self-test). No stored-shape change:STORED_FORMATis unchanged. The sdk golden changes only in the minted planned id and the fingerprints that follow from it.Checks
bun run typecheck, foundry check: passbun test: 3675 pass, 4 skip, 2 fail under full-suite load (the byte-store edge accepts its maximum…, theawaitingcheck of a careless kit loop); both files pass when rerun alonebun run foundry demo,build:packages,verify:packages,docs:generate(no diff),bun run --cwd packages/website check: pass