Skip to content

Stop the gateway from altering native Claude Code behavior - #42

Merged
greenpolo merged 2 commits into
mainfrom
fix/native-claude-passthrough
Sep 29, 2026
Merged

greenpolo merged 2 commits into
mainfrom
fix/native-claude-passthrough

Conversation

@greenpolo

Copy link
Copy Markdown
Owner

Claude requests now reach Anthropic as Claude Code sent them, and Anthropic's answers and failures reach Claude Code as they would natively.

  • Accept requests up to Anthropic's 32 MB limit (was 8 MiB, which caused false "Request too large" errors) and return Anthropic's own request_too_large body.
  • Pass Claude streams through unchanged; tool observation can no longer inject a stream error.
  • Drop the connection on Anthropic failures so Claude Code's own retry runs.
  • Forward every non-Messages /v1/* route (e.g. /v1/files) as raw bytes.
  • Stop overriding API_TIMEOUT_MS.
  • Replace the per-tool-call PreToolUse command hook with the Mods classic.PreToolUse handler (multi/ models only). Known tradeoff: plan mode entered mid-turn no longer reaches the OpenAI reviewer through this hook.
  • Session-identity check applies to provider routes only.
  • Native Claude subagent spawns skip the gateway.
  • Add opt-in gpt-6.1-sol to the Zen catalog.

npm run check (572 tests) and npm run test:mod (75 tests) pass. Not yet exercised in a live Claude Code session.

🤖 Generated with Claude Code

https://claude.ai/code/session_01659JR7q9uk8UxjbNTAr3R3

greenpolo and others added 2 commits September 29, 2026 16:35
Claude requests now reach Anthropic as Claude Code sent them, and
Anthropic's answer or failure reaches Claude Code as it would natively:

- Accept requests up to Anthropic's 32 MB limit (was 8 MiB) and answer an
  oversized one with Anthropic's own request_too_large error.
- Pass Claude streams through unchanged; tool observation stops quietly
  when it cannot parse instead of injecting a stream error.
- Drop the connection on an Anthropic failure so Claude Code retries,
  instead of a rebranded "Native gateway" error.
- Forward every non-Messages /v1/* route (e.g. /v1/files) as raw bytes.
- Stop overriding API_TIMEOUT_MS; provider streams already send headers
  and pings early.
- Replace the per-tool-call PreToolUse command hook with the Mods
  classic.PreToolUse handler, posting only for multi/ models.
- Apply the session-identity check only to provider routes.
- Skip gateway calls for native Claude subagent spawns.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01659JR7q9uk8UxjbNTAr3R3
Zen serves gpt-6.1-sol; Codex refuses it on ChatGPT plans, so the OpenAI
provider keeps gpt-6-sol. It is opt-in and not in the default Zen picker.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01659JR7q9uk8UxjbNTAr3R3
Copilot AI balanced review requested due to automatic review settings September 29, 2026 20:35

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@greenpolo
greenpolo merged commit b1fa3b5 into main Sep 29, 2026
12 checks passed
@greenpolo
greenpolo deleted the fix/native-claude-passthrough branch September 29, 2026 21:09
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.

2 participants