Skip to content

fix(openai): recover final response tool arguments - #3825

Merged
Sayt-0 merged 2 commits into
mainfrom
fix/copilot-responses-tool-arguments
Jul 24, 2026
Merged

fix(openai): recover final response tool arguments#3825
Sayt-0 merged 2 commits into
mainfrom
fix/copilot-responses-tool-arguments

Conversation

@Sayt-0

@Sayt-0 Sayt-0 commented Jul 24, 2026

Copy link
Copy Markdown
Member

Summary

  • recover Responses API function arguments when providers omit response.function_call_arguments.delta
  • use response.function_call_arguments.done and the completed output-item snapshot as non-duplicating fallbacks
  • buffer final arguments received before response.output_item.added and ignore stale late deltas
  • add regression coverage for shell/read-file argument shapes, interleaved calls, reordered events, and duplicate prevention

Issue expectations

Expectation Implementation
shell receives its cmd argument with GitHub Copilot OpenAI models Final arguments are emitted from response.function_call_arguments.done when no deltas were delivered
read_file receives its path argument The same provider-level recovery applies to every Responses API function tool
No tool-call doom loop Empty arguments are no longer forwarded, and final snapshots are emitted only once
Preserve normal Responses API streaming Existing argument deltas remain unchanged; final events only provide fallbacks and terminate stale deltas

Validation

  • deterministic regression reproduced before the fix with empty arguments, then passed after the fix
  • live GitHub Copilot checks passed with gpt-5.5 and gpt-5.6 variants for shell and read_file
  • go test ./pkg/model/provider/openai -run 'TestResponseStream_' -count=20
  • go test -race ./pkg/model/provider/openai
  • task test
  • task lint
  • task build

Residual uncertainty

GitHub Copilot may expose undocumented stream orderings beyond those observed. The implementation covers the standard ordering, missing argument deltas, final snapshots, early final events, interleaved calls, and stale late deltas.

Fixes #3818

@Sayt-0
Sayt-0 requested a review from a team as a code owner July 24, 2026 09:21
@aheritier aheritier added area/providers For features/issues/fixes related to LLM providers (Bedrock, LiteLLM, Qwen, custom, etc.) area/providers/openai For features/issues/fixes related to the usage of OpenAI models kind/fix PR fixes a bug (maps to fix:). Use on PRs only. labels Jul 24, 2026
@Sayt-0
Sayt-0 enabled auto-merge July 24, 2026 09:39
@Sayt-0
Sayt-0 enabled auto-merge July 24, 2026 09:41
@Sayt-0
Sayt-0 merged commit 0747444 into main Jul 24, 2026
14 checks passed
@Sayt-0
Sayt-0 deleted the fix/copilot-responses-tool-arguments branch July 24, 2026 09:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/providers/openai For features/issues/fixes related to the usage of OpenAI models area/providers For features/issues/fixes related to LLM providers (Bedrock, LiteLLM, Qwen, custom, etc.) kind/fix PR fixes a bug (maps to fix:). Use on PRs only.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

builtin filesystem and shell tools not working with github-copilot OpenAI models

3 participants