Skip to content

fix(provider): take Responses tool arguments from the done events (T16) - #273

Merged
lg2m merged 7 commits into
feat/eng-1012-t17-tool-error-kindfrom
fix/eng-1012-t16-responses-done-arguments
Oct 8, 2026
Merged

lg2m merged 7 commits into
feat/eng-1012-t17-tool-error-kindfrom
fix/eng-1012-t16-responses-done-arguments

Conversation

@lg2m

@lg2m lg2m commented Oct 7, 2026 •

Copy link
Copy Markdown
Collaborator

Stacked on #272 (base feat/eng-1012-t17-tool-error-kind). Implements T16 from docs/plans/tool-layer.md § D9.

Closes ENG-1015 · part of ENG-1012

What was wrong (confirmed by capture)

The D9 audit found 234 Codex tool calls that ran with {} arguments, in whole parallel batches. To check the hypothesis, I captured raw Responses SSE from a throwaway build that appended each data: line to a file (never committed). The session DB went to a temp path; the runs were qq run --approval read-only in a scratch dir, asking for a 12+ call parallel batch:

Route Calls With argument deltas
openai-codex/gpt-5.5 13 13
openai-codex/gpt-6.1-sol 5 5
openai-codex/gpt-6-astra 16 1
openai-codex/gpt-6-sol 16 1

The 15 calls without deltas sent output_item.added with empty arguments, then function_call_arguments.done and output_item.done, each carrying the identical complete arguments. The decoder read only deltas, so those calls completed empty, and the run loop turned that into {}.

Fix

providers/openai.rs reads arguments from both done events. For a call that had no delta, it emits them once, as a single ToolCallArgumentsDelta before ToolCallCompleted. Calls that streamed deltas are unchanged; their done payloads are ignored, not compared. In all 34 captured calls with deltas, both done payloads matched the deltas byte for byte, and comparing would mean buffering every call's arguments twice. A call with no arguments anywhere still completes empty.

Verification

  • New regression test parallel_calls_without_deltas_take_their_arguments_from_the_done_events, shaped like the capture (obfuscation, status, spaced JSON, .done-only and output_item.done-only calls, a genuinely empty call)
  • cargo test -p qq-provider (241 lib + 19); minimal profile cargo test -p qq-provider --no-default-features --features test-support (192 + 19)
  • Workspace clippy -D warnings, cargo fmt --check
  • sse_decode bench, base vs branch: allocations identical; openai_responses frame+parse 105/838/1683 µs vs 99/809/1617 µs for 64 KiB / 512 KiB / 1 MiB (noise)
  • Not done: an end-to-end rerun of the fixed binary against Codex. The approval reviewer declined a second live model call. The regression test reproduces the captured byte shape.

Compatibility / performance

No protocol or config change. Provider identity doesn't branch; this is the Responses wire format.

Review repair and final stack verification (ba188a7)

  • Inherits all repaired T15/T17 commits. Empty argument deltas still validate item IDs but do not suppress later complete done arguments. Extended captured-shape regression failed before repair and passes after it.
  • Independent read-only final review: Approve, no blockers.
  • Final workspace fmt, all-target/all-feature Clippy, default-parallel tests and build pass; provider minimal-profile Clippy/tests pass.
  • Earlier runs encountered existing timing failures (including reduced-thread attempt); isolated reruns and final default-parallel full run pass. No root-cause or harmlessness claim.
  • No paid/live-provider calls. Receipts/log paths in tool-layer ledger.

Codex gpt-6-astra and gpt-6-sol stream argument deltas only for the first
call of a parallel batch; the rest carry their arguments solely on
response.function_call_arguments.done and response.output_item.done. The
decoder read only deltas, so those calls ran with {} (tool-layer D9: 234
errors). A captured stream confirmed it: 15 of 16 parallel calls had no
delta on each model.

The decoder now reads arguments from both done events and emits them once,
as a single ToolCallArgumentsDelta before ToolCallCompleted, for a call
that had no delta. Calls that streamed deltas are unchanged.

Refs ENG-1012
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-08T11:01:00.925507Z 6d13df8 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0a7ad8cec8

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@lg2m
lg2m added this pull request to stack #268 October 7, 2026 19:30
@lg2m
lg2m merged commit 1844b43 into main Oct 8, 2026
4 checks passed
@lg2m
lg2m deleted the fix/eng-1012-t16-responses-done-arguments branch October 8, 2026 11:03
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