fix: register claude-code transforms so tool calls pass through - #735
Open
wayniacal wants to merge 1 commit into
Open
fix: register claude-code transforms so tool calls pass through#735wayniacal wants to merge 1 commit into
wayniacal wants to merge 1 commit into
Conversation
server.ts reads pipelineCtx.*, never the adapter methods, and ADAPTER_TRANSFORMS had no entry for adapter "claude-code". Claude Code clients therefore got the createRequestContext defaults, blockedTools empty and passthrough undefined, so the SDK subprocess ran the client's task internally on the proxy host with its own built-in Read/Write/Bash while the CLI executed the same tool_use blocks locally. Every side effect happened twice, milliseconds apart. Observed on a scheduled agent: one run produced three near identical API posts and two racing git pushes to the same branch, from three agents (the CLI, the SDK mirror of its turn, and a second SDK session spawned by the CLI's tools=0 structured-output request). Mirrors claudeCodeAdapter, held in sync by the parity tests. Same class of bug as rynfar#546.
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.
ADAPTER_TRANSFORMShas no entry forclaude-code, sogetAdapterTransforms("claude-code")returns[]and a Claude Code client keeps thecreateRequestContextdefaults:blockedTools: [],passthrough: undefined. The SDK subprocess then runs the client's task itself, on the proxy host, with its own built-in Read/Write/Bash, while the CLI executes the sametool_useblocks locally. Every side effect happens twice.claudeCodeAdapter.usesPassthrough()already returnsresolvePassthrough(true), but nothing calls it.server.tsreadspipelineCtx.*.MERIDIAN_PASSTHROUGH=1does not reach this path either.Same class as #546, where
openaihad to be added to the transform'sadaptersarray for the same reason.How it surfaced
A scheduled agent on 1.57.0 that edits a git repo and posts a summary through an HTTP API. One run produced three posts:
Proxy log for that run:
652b45ffis the CLI'stools=0structured-output request (conversation title). With no transform, that one also became a full agent with built-in tools, so it did the entire task independently: its own file edits, its own commits, a racing push to the same branch. Its transcript records it reading the other session's concurrent edits and concluding a linter had reformatted the file, then deleting 21 lines to "dedupe". It emitted the title at the end, after the side effects.Anything a Claude Code client does through Meridian is currently doubled this way. Writes, commits, HTTP calls.
Fix
transforms/claudecode.tsmirrorsclaudeCodeAdapter, registered underadapter.name("claude-code", not"claudecode"). Core tool names stay PascalCase, since Claude Code's toolkit isRead/Write/Edit/Bash/Glob/Grep; reusingopenCodeTransformsverbatim would hand the deferral logic OpenCode's lowercase names and defer the tools it means to load eagerly.Tests
Parity suite extended for
claude-code, including a check that the registry entry exists at all, since that is the failure here rather than a wrong value. Full suite passes (2106 + the isolated files, 0 failures).Verified against the live proxy with an agent asked to append one line to a file: