v4.2.3 — keep conversation on cancel (interrupt no longer drops context) + strip delegation tools from PTC#84
Merged
Conversation
added 2 commits
June 26, 2026 09:31
Interrupting a turn (cancel) dropped it entirely: the internal history only updates on a COMPLETED stream, so the next turn forgot what was just asked. Now a cancelled llm-turn returns Ok(state.finish_interrupted()) — the accumulated conversation (the user's message above all) is committed, ending on an assistant marker so the next user turn still alternates. Also strip task/parallel_task from the PTC script_allowed_tools: child agents can't fan out on the program tool's single-thread runtime, so force direct calls. Bumps to 4.2.3.
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.
Why
Interrupting a turn dropped it entirely. The session's internal history only updates after a completed
stream()(agent_api.rs), so on cancel the user's message + partial response were never committed — the next turn forgot what was just asked.Fix
loop_runtime.rs: whenexecute_llm_turnis cancelled, returnOk(state.finish_interrupted())instead of?-propagatingErr. The accumulated conversation (the user's message above all) is committed via the normalrecord_resultpath.execution_state.rs:finish_interrupted()keepsstate.messages, appending a short assistant marker when the log would end on a user message (so the next user turn still alternates — Anthropic requires it).program_tool.rs: striptask/parallel_taskfromscript_allowed_tools(defense-in-depth, the deferred PTC hardening) — child agents can't fan out on the program tool's single-thread runtime, so force direct calls.Test
finish_interrupted_keeps_user_message_and_alternates(passes). Builds clean against the monorepo siblings.Bumps core to 4.2.3. (SDK version bumps may be needed for the full release — flag if CI requires.)
Fixes the a3s CLI symptom: 'after interrupting and continuing, a3s-code forgets the context just discussed.'