Conversation
…ng (NVIDIA-NeMo#502) Signed-off-by: Delweng <delweng@gmail.com>
…eMo#502) Signed-off-by: Delweng <delweng@gmail.com>
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.
A backend that reuses OpenAI tool-call ids across responses (e.g. Grok emitting
call_0, call_1, call_0) made Switchyard translate that conversation to Anthropic with duplicatetool_useids. Anthropic returns 400 "tool_use ids must be unique", and clients pair results to calls by id, so agent loops never terminated.Translation now treats id uniqueness as an Anthropic-facing invariant: first-seen ids pass through unchanged; a repeat mints
sydup2_call_0-style ids (distinct from thesy64_scheme, original readable after stripping the prefix). The Anthropic request decoder records the ids a conversation already used in request extensions, and both buffered and streaming response encoders seed from that — no new cross-request state. Everytool_resultis rewritten to match its own call.Verified: new buffered/streaming/extension tests fail before the fix and pass after; full translation suite (231 tests),
cargo fmt --all --checkandcargo clippy --workspace --all-targets -- -D warningsclean.Fixes #502