Repository navigation
feat(receipt): a Claude reply posted through the MCP tool names its model and effort (F546) - #4195
Open
lilyshen0722 wants to merge 2 commits into
Open
lilyshen0722 wants to merge 2 commits into
lilyshen0722 wants to merge 2 commits into
Conversation
…odel and effort (F546) A Claude Code seat usually answers with its own commonly_post_message call, which never goes through the wrapper's post, so its reply carried no receipt while a Codex reply named model and effort. The claude adapter now hands the spawn's controls (adapter, model, effort, from the same args the spawn runs with) to the Commonly MCP server only, as COMMONLY_REPLY_RECEIPT. The server parses it at start, keeps those three string fields, and attaches them to commonly_post_message posts; the backend already accepts a partial receipt and checks it again. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01N4VWLEgKqoyJ97ffrijbor
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 4 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
…e L1)
A model id is free text, and Claude expands ${...} in an MCP entry's env;
one naming COMMONLY_AGENT_TOKEN would make the adapter hand the runtime
its credential and could store it in a receipt. A control holding a $ is
now left out. ADR-004 notes the tool-posted model is the requested one.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01N4VWLEgKqoyJ97ffrijbor
lilyshen0722
commented
Nov 16, 2026
lilyshen0722
left a comment
Contributor
Author
There was a problem hiding this comment.
Gate review: one subagent review on the stronger model (Opus, medium effort) on a817dfe, because the change touches public seats' MCP config. Tests at that head: adapters.claude 282 pass, commonly-mcp client and tools 149 pass.
No High or Medium.
- Confinement: the receipt key is added after
deliverSeatCredentialandcommonlyMcpReadyFile, so credential delivery and the ready-file decision see the same env as before.--strict-mcp-config, Seatbelt and bwrap are untouched. - Detection: it uses the same check as
mcp-ready.js, and it needs aspawnCommand, so url/http servers are skipped. A lookalike@commonlyai/mcp-*command would get only adapter, model and effort, none of which is secret. - The model can't set it: the receipt comes from config, not tool args, and isn't in the inputSchema. The tools test asserts both.
parseReplyReceiptkeeps three string fields, andbyoReceipt.tsre-validates each one. - Retry: the retry spawn reuses the same
mcpConfigandmodelArgs, so the receipt matches what ran. - Mixed versions: an old cli sets nothing, and an old or warm server ignores the env. Both are safe.
- The
credential-channeltest edit: it excludes only the receipt key and still asserts the rest of the declaration exactly.
Low:
- L1, fixed at c66d091. A free-text model id containing
${COMMONLY_AGENT_TOKEN}would have put a credential placeholder into the MCP env. That makes the adapter hand the runtime its token, and it could be stored in a receipt. A control holding$is now left out. The new test checks that the placeholder never reaches the env. 294 claude tests pass, and lint is clean. - L2, documented. A tool-posted receipt names the model the spawn asked for, which may be an alias; the wrapper's receipt names the model the run reported. ADR-004 now says so.
- L3, accepted. There's no test for the local-checkout server shape. Detection is shared with the ready-file code, which already covers it.
GATE: PASS
Written by Lily Shen, via Claude Code.
This branch has not been 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.
F546: a Claude reply posted through the MCP tool names its model and effort
What the walk showed. Growth's 11-16 D141 walk set Effort "low" in Settings on a BYO Claude Code seat. The spawned process ran with
--effort low --model claude-haiku-5-5, but the reply'smessages.receiptwas null. A Codex reply names its model and effort (codex.js:1880).Why it was null. The wrapper attaches its receipt only to a reply it posts itself (
deliverChatReplyinagent.js). A Claude Code seat usually answers with its owncommonly_post_messagecall, which goes straight from the Commonly MCP server to the runtime route. That route accepts a receipt, but the server never sent one.Can it carry one? Yes, partly. Adapter, model and effort are fixed before the spawn. Turns, tools and duration are only known after the turn, so a tool-posted reply can't carry those.
Change
modelArgsthe spawn runs with (controlsFromArguments), then hands it to our MCP server only asCOMMONLY_REPLY_RECEIPT. It recognises our server the same way the ready-file code does:isShippedCommonlyMcpCommand, ordescribeMcpCommand(...).isCommonly. No other server sees it.loadConfigparses that env once at start and keeps only stringadapter,modelandeffort.commonly_post_messageattaches it asreceipt. It isn't in the tool's input schema, so the model can't set it.byoReceipt.normalizeReceiptalready accepts a partial receipt, re-checks every field and stamps itsource: "self-reported".effortand says which fields a tool-posted reply carries.Tests
adapters.claude.reply-receipt.test.mjschecks three things: the commonly entry gets{adapter, model, effort}, an absent effort is left out, and another MCP server gets nothing. Two of these fail on main. Onecredential-channelassertion now compares the declaration with the receipt key excluded, because the receipt isn't a credential.seat-files.jail.smokeandseatbelt.commit-hooks.smoke, which fail the same way on main in this environment.loadConfigcases cover a valid receipt, extra fields dropped, five unusable values and an unset env. A newcommonly_post_messagecase covers a receipt being attached and none when unset. All 324 tests in 16 suites pass.npm run lintin cli is clean onsrc.Release. This needs a cli publish and a
@commonlyai/mcppublish. Until both reach a seat, nothing changes: an older server ignores the env, and an older cli doesn't set it. It's held for the next cli publish after Tue 11-17's batch.🤖 Generated with Claude Code
https://claude.ai/code/session_01N4VWLEgKqoyJ97ffrijbor