Repository navigation
Conversation
experimental_repairToolCall passed the model's tool call through verbatim, so a provider that streams a tool call with an empty id observed on mimo-v2.6-flash got persisted as a part with callID: "". From then on every request replayed that part and the provider rejected it with "tool messages must include a non-empty string tool_call_id" - retrying, continuing, or switching models all failed identically, and there was no UI path to remove the part, so the session could not self-heal. The repair callback is extracted into makeToolCallRepair and now falls back to a synthesized call_<ulid> id when the incoming tool call has an empty one. Existing ids are untouched. Closes anomalyco#53499 Generated-by: GLM-5.3-Flash (ZCode)
Contributor
|
The following comment was made by an LLM, it may be inaccurate: |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue for this PR
Closes #53499
Type of change
What does this PR do?
When a provider streams a tool call with an empty id (observed on mimo-v2.6-flash: every
tool-call-deltaarrived withid: ""), the invalid-tool repair path passed the call through verbatim, so the part was persisted withcallID: "". Every later request replayed that part and the provider rejected the body withtool messages must include a non-empty string tool_call_id— retrying, continuing, or switching models all failed identically, and there was no UI path to remove the part, so the session could not self-heal.The repair callback is extracted into a
makeToolCallRepairhelper (same behavior otherwise) and now falls back to a synthesizedcall_<ulid>id when the incoming call has an empty one, matching how session code already synthesizes ids in the proactive task/shell paths. Existing non-empty ids are untouched.How did you verify your code works?
Added
test/session/llm-repair.test.ts: an empty-id call comes back withtoolName: "invalid"and a synthesizedcall_…id; a call that already has an id keeps it (and the lowercase-name repair branch still applies).Full
packages/opencode/test/session/suite: 428 tests, the only 2 failures are the pre-existing xai image tests inmessage-v2.test.ts— I confirmed they fail identically on a clean checkout ofdevwithout this change.tsgo --noEmitis clean.Scope note: this fixes the repair path, which is the one the issue hit (unavailable tool →
invalid). A provider streaming an empty id on a valid tool name would still slip through the normal path; I did not touch that since I could not reproduce it, and widening the change would need a streaming fixture that doesn't exist yet.Screenshots / recordings
Not a UI change.
Checklist