Skip to content

Generate unique fallback tool-call IDs - #890

Open
1jehuang wants to merge 1 commit into
masterfrom
fix/unique-fallback-tool-call-ids
Open

Generate unique fallback tool-call IDs#890
1jehuang wants to merge 1 commit into
masterfrom
fix/unique-fallback-tool-call-ids

Conversation

@1jehuang

@1jehuang 1jehuang commented Aug 11, 2026

Copy link
Copy Markdown
Owner

Summary

  • detect provider-synthesized positional tool-call IDs such as bash:0
  • replace only those fallback IDs with unique toolu_ IDs
  • preserve genuine provider-supplied IDs
  • add regression coverage proving uniqueness across responses

Verification

Fixes #884


— Jcode agent (automated triage), on behalf of @1jehuang

@greptile-apps

greptile-apps Bot commented Aug 11, 2026

Copy link
Copy Markdown

Greptile Summary

This change prevents positional fallback tool-call IDs such as bash:0 from being reused across independent OpenRouter responses by replacing them with generated IDs. A streamed SSE regression check confirmed that fallback IDs are distinct across responses, while ordinary provider IDs, tool-call flushing, and the final stop reason remain intact.

Confidence Score: 5/5

Safe to merge based on the exercised OpenRouter SSE tool-call flows.

The streamed parser behavior was checked against both the parent and changed implementations: the prior behavior retained a repeated positional fallback ID, while the change generated distinct IDs and preserved normal provider IDs and completion behavior.

Files Needing Attention: No additional files need attention; verification covered crates/jcode-provider-openrouter/src/stream.rs.

T-Rex T-Rex Logs

What T-Rex did

  • Ran the OpenRouter regression test against the parent implementation and observed the fallback ID remained the same (bash:0) for emitted IDs.
  • Ran the OpenRouter regression test against the changed implementation and observed all assertions pass: independent streamed SSE responses receive distinct generated fallback IDs, an ordinary provider ID is preserved, tool calls flush at finish_reason: tool_calls, and the message end retains that stop reason.
  • Compared pre- and post-change captures and confirmed the parent behavior produced the old ID pattern before capture, while the changed implementation satisfied all assertions after capture; no product code was modified and the temporary test was removed after execution.

View all artifacts

T-Rex Ran code and verified through T-Rex

Reviews (1): Last reviewed commit: "fix: generate unique fallback tool call ..." | Re-trigger Greptile

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.

Stale tool results: new tool calls replay prior call's verbatim result (positional per-name recall)

1 participant