Repository navigation
fix(muse-proxy): alias tool names on the /v1/responses passthrough - #2766
Conversation
Follow-up to the chat-path fix: the passthrough forwarded client bodies verbatim, so the muse-direct provider (a native Responses client going through this route) hit the same client_attestation_denied wall — its workhorse leaf has been failing over since the provider was enabled. The passthrough now applies the same aliasing as the chat translator: shell/bash tool definitions, history function_call items, and tool_choice are renamed on the way out, and the model's calls are translated back on the way in — buffered for JSON responses, line-wise for SSE streams. Bodies without blocked names (or unparseable bodies) forward byte-for-byte as before.
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 49 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 20ba09541d
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (!holder || typeof holder !== 'object') return; | ||
| for (const item of holder.output || []) { | ||
| if (item && item.type === 'function_call' && typeof item.name === 'string') { | ||
| item.name = clientToolName(item.name); |
There was a problem hiding this comment.
Reverse only aliases actually applied to this request
When a native Responses request declares both shell and a genuine terminal tool, the request becomes run_command plus terminal, but this unconditional reverse mapping changes an upstream terminal call into bash, which the client never declared. The streaming path has the same problem through unaliasSseData. Track the aliases applied per request and use that map for both JSON and SSE responses so unrelated tools retain their names.
Useful? React with 👍 / 👎.
| const next = directToolAlias(holder.name, taken); | ||
| if (next !== holder.name) { holder.name = next; aliased = true; } |
There was a problem hiding this comment.
Exclude inherited properties from tool alias lookup
For valid native Responses tool names such as toString or constructor, calling directToolAlias here resolves inherited properties of DIRECT_TOOL_ALIASES rather than an explicit alias. Consequently, holder.name becomes a function and JSON.stringify(parsed) removes the name entirely: a request containing {type: 'function', name: 'toString'} is forwarded with an unnamed tool. These requests previously passed through unchanged. Restrict alias lookup to own properties or use a null-prototype map.
Useful? React with 👍 / 👎.
Follow-up to #2764. The chat-completions direct path got the tool-name aliasing, but the
/v1/responsespassthrough still forwarded bodies verbatim — and the fleet'smuse-directprovider is a native Responses client on exactly that route. Its workhorse leaf has been failing every attempt withclient_attestation_deniedand falling over to other providers.This applies the same aliasing on the passthrough:
shell/bashrenamed in tool definitions, historyfunction_callitems, andtool_choice(same alias map as the chat path).data:lines carrying a function_call item are parsed).Tests: two new cases (JSON round-trip incl. history calls; streaming translation with no alias leaking). Suite: 24/24 pass.
Need help on this PR? Tag
@codesmith-botwith what you need.