fix(proxy): support Codex MCP tools in Responses#47
Open
felix-miao wants to merge 1 commit into
Open
Conversation
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.
Summary
This fixes the Codex CLI -> Raven -> GitHub Copilot Responses compatibility gap for MCP tools. Codex is expected to use the OpenAI Responses API (
/v1/responses) when configured withwire_api = "responses", but its tool payload can include shapes that Copilot Responses does not accept directly.Problem
Before this change, Raven forwarded
/v1/responsespayloads to Copilot mostly as-is. That breaks Codex MCP usage in two related ways:image_generation,code_interpreter,file_search,mcp,computer_use_preview, andlocal_shell.namespacetools, for examplemcp__teams__with child function tools likeListChats. Copilot does not supporttype: "namespace", so forwarding these definitions unchanged can fail with unsupported-tool errors.Fix
/v1/responsestools down to the tool types Copilot accepts:functionandweb_search_preview.namespacetool definitions into Copilot-compatible function tools, e.g.mcp__teams__+ListChatsbecomesmcp__teams__ListChats.{ namespace, name }.function_callentries in next-turninputhistory so MCP tool-result continuations remain consistent when sent back upstream.Behavior after this PR
Codex can continue using the correct Raven provider configuration with
wire_api = "responses". MCP tools sent through the Responses API are normalized for Copilot on the upstream side and restored to Codex's expected namespace shape on the client side.Testing
bunx --bun vitest run packages/proxy/test/strategies/copilot-responses-tool-filter.test.ts packages/proxy/test/strategies/copilot-responses.test.ts packages/proxy/test/translate/upstream-compat-gaps.test.ts packages/proxy/test/routes/preprocess.test.ts packages/proxy/test/routes/messages-handler.test.ts packages/proxy/test/core/router.test.tsbun run --filter @raven/proxy typecheckbun run --filter @raven/proxy lintbun run scripts/gate-security.tsgit pushpre-push gates: security, coverage, arch passed