Skip to content

fix(opencode): keep the results of parallel calls written one per message - #99

Merged
NishantJoshi00 merged 3 commits into
skillsynchq:mainfrom
acaprino:fix/opencode-split-tool-results
Nov 17, 2026
Merged

NishantJoshi00 merged 3 commits into
skillsynchq:mainfrom
acaprino:fix/opencode-split-tool-results

Conversation

@acaprino

Copy link
Copy Markdown
Contributor

Issue: #98

What changed and why?

Converting to opencode lost the results of parallel tool calls when the source records each call in its own assistant message and each result in its own later user message: call A, call B, result A, result B. The writer only looked at the message right after a call, so call A found call B and call B found only result A, and both were written with "output": "".

Before (the regression test, on main):

left: [("call_a", ""), ("call_b", "")]
right: [("call_a", "content a"), ("call_b", "content b")]

After: each call keeps its result, and reading the export back pairs each call with its result again.

following_result in src/harness/opencode.rs looks through the user messages after the call and stops at the next user message that holds more than tool results, which is the next prompt. Results inside the same turn are found wherever they sit; a result from a later turn is never borrowed.

Test: opencode_keeps_the_results_of_parallel_calls_written_one_per_message in tests/regression/main.rs, red on main and green with the fix. cargo fmt --check, cargo clippy --all-targets with -D warnings (library features opencode,hermes,search,codex_zstd, and --no-default-features), the wasm32 check and cargo test -p txcript pass. The CLI crate was not built here (its default features need BoringSSL); the change is library-only.

This is independent of #97 and applies to both the 2.0 export and the 2.1 document, since the 2.1 projection reads the same parts.

acaprino and others added 3 commits October 27, 2026 12:59
…sage

A source can record parallel tool calls one call per assistant message, each
result in its own later user message (call A, call B, result A, result B).
The writer looked for a result only in the message right after its call, so
both calls were written with an empty output. It now looks through the
following user messages, up to the next prompt.

Fixes skillsynchq#98
@NishantJoshi00

Copy link
Copy Markdown
Collaborator

Hey @acaprino, thanks for another one! Parallel tool calls are becoming a trend, and this will definitely help out.

@NishantJoshi00
NishantJoshi00 merged commit 6e2f1a7 into skillsynchq:main Nov 17, 2026
8 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.

2 participants