Skip to content

fix(muse-proxy): alias tool names on the /v1/responses passthrough - #2766

Merged
dezren39 merged 1 commit into
mainfrom
fix-muse-pt-alias
Oct 30, 2026
Merged

dezren39 merged 1 commit into
mainfrom
fix-muse-pt-alias

Conversation

@dezren39

@dezren39 dezren39 commented Oct 30, 2026 •

Copy link
Copy Markdown
Member

Follow-up to #2764. The chat-completions direct path got the tool-name aliasing, but the /v1/responses passthrough still forwarded bodies verbatim — and the fleet's muse-direct provider is a native Responses client on exactly that route. Its workhorse leaf has been failing every attempt with client_attestation_denied and falling over to other providers.

This applies the same aliasing on the passthrough:

  • Request: shell/bash renamed in tool definitions, history function_call items, and tool_choice (same alias map as the chat path).
  • Response: names translated back — whole-body for JSON responses, line-wise for SSE streams (only data: lines carrying a function_call item are parsed).
  • Bodies with no blocked names, and unparseable bodies, forward byte-for-byte exactly as before (the existing verbatim test still passes unchanged).

Tests: two new cases (JSON round-trip incl. history calls; streaming translation with no alias leaking). Suite: 24/24 pass.


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.

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.
@dezren39
dezren39 requested a review from a team as a code owner October 30, 2026 14:25
@coderabbitai

coderabbitai Bot commented Oct 30, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You'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.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: ff97dfad-2f79-41f7-823a-f63399604a4f
Commits

Reviewing files that changed from the base of the PR and between 7363b49 and 20ba095.

Files selected for processing: 2
  • bin/muse-proxy.mjs
  • bin/muse-proxy.test.mjs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-30T14:28:33.468036Z 20ba095 PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@dezren39
dezren39 merged commit fe47fa0 into main Oct 30, 2026
1 check passed

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread bin/muse-proxy.mjs
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);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Comment thread bin/muse-proxy.mjs
Comment on lines +1083 to +1084
const next = directToolAlias(holder.name, taken);
if (next !== holder.name) { holder.name = next; aliased = true; }

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

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.

1 participant