Skip to content

fix(session): settle pending tool calls on schema errors - #30091

Closed
codeg-dev wants to merge 2 commits into
anomalyco:devfrom
codeg-dev:fix/required-tool-args-validation
Closed

fix(session): settle pending tool calls on schema errors#30091
codeg-dev wants to merge 2 commits into
anomalyco:devfrom
codeg-dev:fix/required-tool-args-validation

Conversation

@codeg-dev

@codeg-devcodeg-dev commented May 31, 2026

Copy link
Copy Markdown

Issue for this PR

Closes#30093

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Settles a pending tool part to error when the stream later emits a matching schema-validation tool-error. This covers malformed built-in tool calls such as bash with an empty object, while preserving empty objects for tools that have no required args.

Prepared with AI assistance.

How did you verify your code works?

  • bun run typecheck
  • git diff --check
  • LSP diagnostics clean for packages/opencode/src/session/processor.ts and packages/opencode/src/session/retry.ts
  • Built and installed a custom binary on private host: opencode --version -> 1.15.13-empty-tool-validation
  • Runtime smoke with a mock OpenAI-compatible provider emitted malformed bash empty-object args; exported session local session recorded the bash tool part as status error, not pending.

Focused tests are blocked in this worktree by an existing fixture issue: both the new processor test and unrelated test/provider/header-timeout.test.ts fail before assertions with ProviderModelNotFoundError for test/test-model.

Screenshots / recordings

Not a UI change.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@github-actions

Copy link
Copy Markdown
Contributor

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

@github-actionsgithub-actionsBot added the needs:compliance This means the issue will auto-close after 2 hours. label May 31, 2026
@codeg-dev

codeg-dev commented May 31, 2026

Copy link
Copy Markdown
Author

Runtime smoke verified on private host with custom binary 1.15.13-empty-tool-validation: mock provider emitted malformed bash empty-object args; exported session local session shows the bash tool part settled as status error, not pending.

@github-actionsgithub-actionsBot removed needs:issue needs:compliance This means the issue will auto-close after 2 hours. labels May 31, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

@codeg-dev

codeg-dev commented Jun 6, 2026

Copy link
Copy Markdown
Author

Additional v1.16.2 verification update:

  • Re-applied the pending/running tool settlement change in a focused custom artifact: 1.16.2-codeg.20260606.
  • macOS artifact SHA-256: cde7462823cbb639b7f9b09a757699c1e983a9b650e79eae3a6d7025643d295b.
  • Windows x64 artifact SHA-256: 2496173eaf3005078dbcb3fbccc626219365f69848931d308a53f793c94021b3.
  • Verified openai/gpt-5.5 tool-failure recovery after a failing bash false call on private host, private host, private host, and codeg-hq.
  • Sentinels observed: MTB_CUSTOM_GPT55_TOOL_FAILURE_DONE, FOB_NOTEBOOKLM_DISABLED_TOOL_DONE, OPS_CUSTOM_GPT55_TOOL_DONE, and HQ_CUSTOM_GPT55_TOOL_DONE.

This confirms the issue remains relevant on top of v1.16.2 and the patch still resolves the pending/running tool-call settlement path without changing the selected model.

@codeg-dev
codeg-devforce-pushed the fix/required-tool-args-validation branch from dd5c500 to 8ca3c99CompareJune 7, 2026 01:43
@codeg-dev

Copy link
Copy Markdown
Author

Rebased onto latest dev and force-pushed. CI is green (check-compliance ✅, check-standards ✅). Ready for review — this PR was 295 commits behind so the refresh should help avoid future merge conflicts. Thanks!

@mikeatlas

Copy link
Copy Markdown

bump

@codeg-dev

Copy link
Copy Markdown
Author

AI-assisted verification update (2026-06-09 KST): I cherry-picked this PR onto the current OpenCode 1.16.2 baseline for our local custom artifact 1.16.2-codeg.20260609-omo481.

Verified:

  • macOS darwin-arm64 build/typecheck completed for the custom artifact.
  • Windows x64 single-binary artifact launched successfully on Windows 11.
  • Windows smoke: opencode --version, opencode serve, /agent, /skill, /command, /session, and embedded web UI root all passed.
  • Embedded web UI fingerprint matched the official binary UI assets (/assets/index-B36vrVAZ.js, /assets/index-ksHcXe9H.css), with no hosted SPA fallback involved.

No regression observed in this local cross-platform smoke pass.

@codeg-dev
codeg-devforce-pushed the fix/required-tool-args-validation branch from 8ca3c99 to 18f1324CompareJune 18, 2026 07:53
@github-actions

Copy link
Copy Markdown
Contributor

Automated PR Cleanup

Thank you for contributing to opencode.

Due to the high volume of PRs from users and AI agents, we periodically close older PRs using automated criteria so maintainers can focus review time on the most active and community-supported contributions.

This PR was closed because it matched the following cleanup criteria:

  • The PR was created more than 1 month ago
  • The PR had fewer than 2 positive reactions
  • Positive reactions are counted as thumbs-up, heart, celebration, or rocket reactions on the PR

PRs created within the last month are not affected by this cleanup.

If you believe this PR was closed incorrectly, or if you are still actively working on it, please leave a comment explaining why it should be reopened. A maintainer can review and reopen it if appropriate.

Thanks again for taking the time to contribute.

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

pending tool call can remain stuck after schema validation error

3 participants

@codeg-dev@mikeatlas@EQCommunication