A Chat or Anthropic client whose turn was cut off (Esc, a dropped
connection, a crash) sends its history with a tool call no result
answers. buildChat and buildAnthropic each give such a call a
synthetic result (pairToolMessages, pairToolBlocks), but buildResponses
didn't, so a Responses upstream answered 400 "No tool output found for
function call <id>" on that turn and every turn after it.
ggbdpq's patch called pairToolItems on the body in forwardTranslated.
It is called at the end of buildResponses instead: that is where every
Responses body is built from a client's request, including Zed's
(zed.go builds through it and doesn't pass forwardTranslated). The
patch's tests are kept as written.
Run, on origin/main 2a99e7a42, and
again on 91b9065a5 for vet, gui, provider, tui, gateway, agent and
the tests named here:
- TestTranslatedToResponsesAnswersALoneCall is red without the
responses.go change (the lone call_a goes into input unanswered) and
green with it; TestPairToolItems*, TestResponsesRelay* and the Zed
tests pass.
- gofmt -l; go vet darwin, GOOS=linux -tags nogui, GOOS=windows ./...;
go build for the three; go test -tags nogui -count=1 -p 4 ./... at a machine load of 100-150:
50 packages ok; internal/agent and internal/gateway ran past the 10m
default under that load and pass with -timeout 40m (674s, 798s);
internal/gui's TestSetAnswersWhileDevinAndProvidersHang failed once
(a state took 10.4s; open as #1375) and the package passes rerun.
- The shape against ChatGPT's real Codex backend (gpt-5.6-luna, the
owner's account, store false): a lone call is answered "No tool output
found for function call call_a." and the same history with the call
paired completes.
Not tried: a real interrupted Chat client end to end through magpie.
Co-authored-by: ggbdpq <ggbdpq@gmail.com>
The reporter's own experiment through magpie to the same upstream: a
function_call with no function_call_output was turned away with exactly
the reported 400, and the same request with the output went through.
Volcengine checks the exchange on the chat form it turns /responses into.
The Chat path has mended this shape since #1275 (pairToolMessages); the
Responses relay had only orphanedToolOutputs, which handles the opposite
case (a result with no call).
pairToolItems runs beside orphanedToolOutputs for every Responses request
not going to a ChatGPT account. A function_call or custom_tool_call that
no result in the input answers gets "[The result of this tool call is
unavailable: the turn was interrupted.]". As in the Chat path, that result
goes at the end of the run of calls and results the call is in, so no
result lands between two parallel calls. A result with no call is still
left to orphanedToolOutputs. A result naming a call from an earlier request
(previous_response_id) stays as it is. Based on ggbdpq's patch on the
issue, which put the result right after the call.
TestResponsesRelayAnswersALoneCall (through the whole gateway) fails
without the change ("the lone call went unanswered") and passes with it.
TestPairToolItemsAnswersALoneCall covers parallel calls, custom calls,
byte-for-byte pass-through of paired, out-of-order and
previous_response_id requests, and that the caller's buffer is left
alone. go test -tags nogui ./internal/gateway under a temp HOME passes, as
do go vet (darwin, linux, windows) and gofmt. Not tried against the real
Volcengine coding plan: the only Volcengine key here is a pay-as-you-go
Ark key with no DeepSeek model enabled. The reporter's Codex rollout shows
every call paired, so which call went unanswered in their request is not
known. They are asked whether it still happens.