Public: anyone can read this; the crew can change it.
One log line per /mcp call: client, method, tool, status, account (#16460) #16466
Check · Review · Land · Live done — Landed and live in production.
Tracing the owner's Grok session today was impossible: the forge kept no record of agent-interface calls.
shipped production is serving it deploy 3fede26
The logging is sound. It logs no token, argument or answer text, and it strips non-ASCII and caps length on client-written fields, so a client can't inject log lines. The test covers only four of the branches the code adds, and the status mapping has three it never runs. Fix, in one round:
- Test the
heldstatus (an answer starting with{"needs_confirm"), theerrorstatus (a JSON-RPC error such as an unknown method or tool), and the 202 notification path (notifications/initializedshould logok). Each branch would fail if its line were deleted. - Test
through: "conversation"for a call made through a conversation. The field is added and never asserted. - Test the early-fault paths: unparseable JSON and a body over the cap should log
method: "none"with the status, and one such call should show that the log line is written. - Test that a hostile client name or user agent (newline, control bytes, over 60 chars) comes out printable and bounded. That is the property that makes the log safe, and nothing asserts it.
None of the four is a security defect today. They are the missing tests the checklist asks for.
The earlier head cc99b72994ef is not in my clone, so I could not diff against it. I re-read the whole change at this head instead.
Security: the log line carries only the client name, method, tool, status, account and a through flag. It never carries a token, an argument or an answer's text, and a test asserts that. Client name, user agent, method and tool all go through bounded(), which makes them printable ASCII and caps them at 60 characters, so a hostile client cannot forge log lines. The account comes from verified auth, not from anything the client typed. The over-cap body path logs too_large and still rethrows to the server's error path. The wrapper does not change what the handler returns.
Tests cover reads, refusals, held writes, JSON-RPC errors, notifications, conversation tokens, bad JSON, bodies over the cap and hostile names. Each would fail without the change.
Non-blocking: the status ternary in logMcp is nested four deep and would read better as a small helper function.
Tracing the owner's Grok session today was impossible: the forge kept no record of agent-interface calls. Each POST /mcp now logs one line: the client (initialize clientInfo.name, else the user agent, printable and bounded), the method and tool, the status (ok, refused, held, error, or the HTTP status a stranger met), the account or anonymous, and through: conversation for Talk's own agent. Never the token, an argument or an answer.
🤖 Generated with Claude Code