Skip to content

fix(protocol): rename client tools under an ordinary namespace - #182

Merged
jasonxu114514 merged 1 commit into
jasonxu114514:mainfrom
unrayed:fix/free-tier-wire-name-prefix
Nov 16, 2026
Merged

jasonxu114514 merged 1 commit into
jasonxu114514:mainfrom
unrayed:fix/free-tier-wire-name-prefix

Conversation

@unrayed

@unrayed unrayed commented Nov 16, 2026

Copy link
Copy Markdown
Contributor

Problem

Every shaped free-model request that carries tools is answered with 429 Free usage limit reached (#178, #181). The same session without tools — including the Playground — still works.

Root cause

The free tier matches the literal clint_ on a wire tool name. Everything else about the body is accepted.

Same captured official-CLI body (75,654 B, 20 tools, max_completion_tokens: 32000, stream: true), same host and egress, replayed against a build of this branch:

wire-name prefix result
clint_ (current main) 429 FreeUsageLimitError
CLINT_ 429
clint (no underscore) 200
client_, copilot_, mcp_, srv_, fn_, zz_ 200
client names passed through 200
shaping bypassed entirely 200
prompt injection only, tools untouched 200

The rename itself is accepted and another client's vocabulary is still refused; the clint_ token is what trips the gate — case-insensitive, and the trailing underscore matters.

A/B on this base, same binary apart from the constant:

build result
14faec7 + clint_ 429 in 3.4 s
14faec7 + mcp_ 200 in 2.6 s, tool call restored to the client's shell; follow-up carrying the tool result 200 with the final answer

Session id, project id and egress were identical in both runs, so session re-minting or per-egress quota accounting cannot explain it.

Change

ClientToolPrefix becomes mcp_ — one constant. Responses restore through the same constant (mayCarryToolName, ToolRenames.Resolve), so no other path moves. Comments that spelled the old literal now say "wire-name prefix", and the READMEs describe the wire name as namespace plus digest instead of naming the prefix, so the docs do not pin a value that has to rotate.

mcp_ is deliberate: it also prefixes MCP clients' mcp__<server>__<tool> names, so a rule that refuses it refuses genuine MCP traffic. clint_ was free to ban because nothing legitimate starts with it.

Verification

  • go vet ./..., gofmt -l ., Linux and Windows builds: clean. The repository carries no _test.go files, so no test is added for a constant.
  • Live, on a build of this commit: the captured body returns 200 with a completed tool round trip; the same build with the constant reverted returns 429.

Known limit

Still a fixed string, so it can be learned again; the constant carries a shortcut: note to rotate it when 429s return only on tool-bearing requests. A gate that matches the name shape rather than the prefix would defeat this hedge — the durable alternative, not renaming official-CLI traffic, does not cover Claude Code's vocabulary and is a larger behavioural change.

The free tier refuses the literal "clint_" in a tool name: the same shaped
body is answered with 429 FreeUsageLimitError under clint_ and completes
normally under any other prefix, so the rename itself is accepted and the
prefix alone is what the gate matches.

Keep the wire-name namespace a plain tool-like name instead of a gateway
marker, and stop printing the literal in the READMEs so the docs do not pin
a value that has to rotate.

Verified live on a build of this commit: the captured 20-tool CLI body
returns 200 and its tool call round-trips; the same build with the constant
reverted returns 429. vet, gofmt, Linux and Windows builds pass.
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