fix(webmcp): send Origin-Agent-Cluster so tools can register - #7
Merged
Merged
Conversation
The document has to be origin-isolated before WebMCP will accept a tool, and that is a separate requirement from the origin trial. Production had only `Origin-Trial`, which produced the worst failure available: `document .modelContext` existed, so the banner reported `native` in green, while all sixteen `registerTool` calls threw and `registerTools` returned an empty array. Live URL, green status line, `0 tools`, nothing agent-callable. The header now ships whether or not a token is configured, since isolation is not part of the trial — `headers()` no longer has a path that returns nothing.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This branch was successfully deployed
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.
What was wrong
Production at
traces.ribdsp.comserved onlyOrigin-Trial. Verified from outside:No
Origin-Agent-Cluster.git grepfound the header nowhere in the repo.WebMCP will not accept a tool unless the document is origin-isolated, and that is a
separate requirement from the origin trial. Having one without the other produced the
worst failure the app can produce:
document.modelContextexists, soregisterToolsreportsnativeregisterToolcalls throwcatchatregister-tools.ts:69— correctly written so one bad schema cannotcost the other fifteen tools — turns sixteen failures into sixteen
console.warnlines and an empty
registeredarrayToolStatusBannerrenders the green branch: WebMCP live · 0 toolsA live URL, a green status line, and nothing on the page an agent can call.
The change
headers()now sendsOrigin-Agent-Cluster: ?1whether or not a token is configured,because isolation is not part of the trial. There is no longer a path that returns no
headers at all.
Test plan
npm run buildgreen.next/routes-manifest.json, in order:[{Origin-Agent-Cluster ?1}, {Origin-Trial ...}][{Origin-Agent-Cluster ?1}]— sonpm run devwithout.env.localis origin-isolated toocurl -sI https://traces.ribdsp.comshows both headers16 tools, and the sixteen[traces] host rejected tool ...console warnings are goneNote for whoever picks this up next
This fixes the cause but not the blind spot.
nativewithregistered.length === 0still renders the green branch intool-status-banner.tsx:132, which is the exact scenario that component's owndocstring says it exists to prevent. That case deserves to be as loud as
unavailable. Left alone here — different area, and it wants its own decision.