Conversation
Collaborator
|
If an interrupted tool call is followed by more conversation, its synthetic result lands at the end. Claude requires the result immediately after the call. Can we insert it there and test an interruption followed by another user turn? |
Contributor
Author
|
Done. The result now goes right after the turn that opened the call instead of at the end, so mid-transcript interruptions pair up too. Matching is per-occurrence. Also sorted the inserts since map order isn't stable across runs. |
This branch has not been deployed
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.
Issue: #68
What changed and why?
messages_to_records(shared by Claude Code and Cowork) exported unansweredtool_useblocks verbatim. One Ctrl+C mid-tool therefore poisoned the wholeresumed session: the Anthropic API 400s on the first
tool_usewithout atool_resultimmediately after it.A new
close_dangling_callspass, next tolower_artifact_messages, andafter it so artifact pairs aren't doubled — appends one aborted error result
(
"Tool execution was interrupted or cancelled.",is_error) per danglingcall as a final user turn. Slash-command calls are excluded: their output
rides
local_commandlines, where a synthesizedtool_resultwould itselfbe rejected. Reused ids close only the occurrences left open, and a result
recorded before its call (Codex web-search order) already answers it, so it
holds as credit instead of drawing a duplicate.
Tests: five in
tests/integration/claude_code.rs, the dangling call closesas an error with paired calls untouched (failed on
mainbefore the fix),id-reuse scoping, every open call in one turn closing together, no duplicate
for results recorded before their call (Codex web-search order), and
command-call exclusion. Docs: one caveat bullet in
docs/formats/claude-code.md, matching the existing list style.Checks:
cargo test -p txcript --test integration(212 passed, defaultfeatures),
cargo fmt --checkandcargo clippy -p txcript --all-targets(zero warnings) — run under the GNU toolchain, CI's MSVC run will confirm.