Skip to content

v4.2.3 — keep conversation on cancel (interrupt no longer drops context) + strip delegation tools from PTC#84

Merged
ZhiXiao-Lin merged 2 commits into
mainfrom
fix/interrupt-keep-history
Jun 26, 2026
Merged

v4.2.3 — keep conversation on cancel (interrupt no longer drops context) + strip delegation tools from PTC#84
ZhiXiao-Lin merged 2 commits into
mainfrom
fix/interrupt-keep-history

Conversation

@ZhiXiao-Lin

Copy link
Copy Markdown
Contributor

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: when execute_llm_turn is cancelled, return Ok(state.finish_interrupted()) instead of ?-propagating Err. The accumulated conversation (the user's message above all) is committed via the normal record_result path.
  • execution_state.rs: finish_interrupted() keeps state.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: strip task/parallel_task from script_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.'

RoyLin 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.
@ZhiXiao-Lin ZhiXiao-Lin merged commit 3b83815 into main Jun 26, 2026
3 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant