Stamp --driver <vendor> into the flows MCP registration so JSON harnesses know who is driving - #646
Conversation
PR Summary by QodoStamp --driver into kcap-flows MCP registrations for JSON harnesses
AI Description
Diagram
High-Level Assessment
Files changed (10)
|
…harnesses The reviewer-vendor tool echoes driver_vendor so the suggest-review-flow skill can recommend a reviewer that differs from the driving harness. That value was env-inferable only for Claude Code and Codex (their own-session env vars); the six JSON harnesses (Cursor, Copilot, Gemini, Kiro, OpenCode, Antigravity) export no distinctive var into the long-lived MCP-server child, so they fell back to the unknown-driver path. Those harnesses now register kcap-flows as "kcap mcp flows --driver <vendor>". The stamp is the harness's own vendor and reaches the same subcommand and tool schema; DriverVendor prefers it and keeps env inference as the fallback for Claude/Codex, whose registrations stay unstamped. Pi registers no MCP config, so it stays on the unknown-driver fallback. - KcapMcpServers.ForHarness derives each harness's set from the bare list, stamping only the flows entry; All / ForCodex / the bundled configs stay bare. - HarnessMcpProjections carries the stamp plus DriverStampVendors, the single source of which vendors are stamped and therefore recognised by the audit. - McpRegistrationAudit recognises a flows "--driver <known-vendor>" suffix as canonical, so dedup still owns kcap's own entry; any other extra arg stays a conflict to preserve. FlowsDriverSchemaConformanceTests now asserts each harness stamps its OWN vendor -- a strengthening, not a loosening, of the identical-server invariant. Refs AI-2175. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
c146afe to
566f63e
Compare
Code Review by Qodo
1.
|
…al --driver arg - McpRegistrationAudit no longer treats a "--driver <vendor>" flows entry as a canonical duplicate. Its only callers audit CLAUDE's config (doctor --clean and the Claude launcher), whose flows entry is always the unstamped bundled .mcp.json; the six JSON harnesses' stamped entries live in their own configs, owned via their per-entry marker, and never reach this audit. A stamped entry appearing in Claude's config is a customization to preserve -- so "doctor --clean" can no longer delete it and silently revert driver_vendor from the stamp back to env inference. - README now documents that kcap writes the internal "--driver <vendor>" arg into the JSON harnesses' flows registration -- it is not a flag users set. Refs AI-2175. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
What & why
Part of AI-2175 (proactive second-harness review-flow suggestion). The
list_reviewer_vendorstool echoes adriver_vendorso thesuggest-review-flowskill can recommend a reviewer that differs from the harness the user is driving.That
driver_vendorwas only knowable for Claude Code and Codex, which export a distinctive own-session env var (CLAUDE_CODE_SESSION_ID/CODEX_THREAD_ID) into the long-lived MCP-server child. The six JSON harnesses (Cursor, Copilot, Gemini, Kiro, OpenCode, Antigravity) export no such stable signal, so they fell back to the (already-correct, but weaker) "unknown driver → offer a choice" path.Change
Those six harnesses now register kcap-flows as
kcap mcp flows --driver <vendor>. The stamp is the harness's own vendor, and it reaches the samemcp flowssubcommand and therefore the same tool schema — it only tells the server who is driving.KcapMcpServers.ForHarness(vendor)derives each harness's server set from the bare list, stamping only the flows entry.All/ForCodex/ the bundled.mcp.json/.codex-mcp.jsonstay bare.HarnessMcpProjectionscarries the stamp plusDriverStampVendors— the single list that decides who is stamped and what the audit recognises, so the writer and the recogniser can't drift.DriverVendor.Inferis now arg-first (validated against a closed vendor set) with env inference kept as the fallback for Claude/Codex, whose registrations stay unstamped.McpFlowsServer/Program.csthread the--driverarg through.McpRegistrationAuditrecognises a flows--driver <known-vendor>suffix as canonical (sokcapdedup still owns its own entry); any other extra arg stays a conflict to preserve.Scope note: Claude and Codex are deliberately left env-inferred (unstamped) — no change to their configs or to the Codex TOML ledger. Pi registers no MCP config, so it stays on the unknown-driver fallback.
Forward-looking
Takes effect only after a CLI release + re-install (registrations are written at install time). Until then, driving harnesses keep using the correct unknown-driver behaviour — no regression for anyone.
Tests
KcapMcpServersTests—ForHarnessstamps only flows, leaves the bareAlllist untouched.DriverVendorTests— stamp used verbatim; stamp wins over a conflicting env marker; unknown/blank stamp falls back to env; never echoes arbitrary text.McpRegistrationAuditTests— a known--driver <vendor>flows entry is a removable canonical duplicate;--driverwithout a value, an unknown vendor, or a stamp + trailing junk all stay conflicts.FlowsDriverSchemaConformanceTests— the installed-driver and projection arms now assert each JSON harness stamps its own vendor while Codex stays bare (a strengthening of the identical-server invariant, not a loosening).Refs AI-2175.
🤖 Generated with Claude Code