Hosted Codex PR review support (AI-632)#198
Conversation
Spike-grounded design: Codex MCP injection via ephemeral -c overrides (no config.toml mutation, nothing to clean up); review instructions passed as the initial prompt (no --system-prompt equivalent exists). Incorporates review feedback: thread the kcap CLI path (CapacitorPath) through ReviewLaunchBuilder instead of Environment.ProcessPath, which resolves to kcap-daemon in the daemon and breaks the MCP command for both vendors; and a realistic test strategy (narrow unit tests + gate- removal assertion, no infeasible offline happy-path orchestrator test). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…path Thread the kcap CLI path (CapacitorPath in the daemon) through the builder instead of Environment.ProcessPath, which resolves to kcap-daemon in the daemon and has no mcp review subcommand. Expose a vendor-neutral MCP descriptor; write the temp JSON only for Claude. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Inject the kcap-review MCP server via ephemeral -c mcp_servers.* TOML overrides and pass the rendered review prompt as Codex initial prompt. No temp file, so nothing to clean up. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Remove the hard rejection so Codex reviews flow through the same validation and launcher path as Claude. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
PR Summary by QodoAdd hosted Codex PR review support via kcap-review MCP injection
AI Description
Diagram
High-Level Assessment
Files changed (11)
|
Code Review by Qodo
1.
|
…ivate The public-agent registration kicks off fire-and-forget background work (UpdateRepoPathsAsync via Task.Run behind RepoPathStore file I/O, and AppendAgentRunEventAsync). The test cleared the connection Calls and asserted Count==0 after a private registration, but under slow I/O (CI ubuntu, sequential) a backgrounded call lands after the Clear() — flaking the count. Assert the private-agent skip on a fresh orchestrator + TripwireServerConnection instead, which only ever sees the private registration (zero server calls) and removes the race. Pre-existing flake, surfaced by this PR run; production code unchanged. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
qodo flagged that TomlString only escaped backslash and double-quote. TOML basic strings forbid raw control characters (U+0000-U+001F, U+007F), so a control char in an injected value (command/args/env) would yield invalid TOML and fail the Codex -c config parse. Escape them per spec (short forms for \b\t\n\f\r, \uXXXX otherwise). Adds a test covering control-char escaping across command, args, and env. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
What
Adds hosted Codex PR review support (AI-632). Previously the daemon hard-rejected
LaunchKind.Review+vendor: codexwith "PR review for Codex is not yet supported." A hosted Codex agent can now review a PR with the samekcap-reviewMCP context the Claude path gets.How (spike-grounded)
Verified against
codex-cli 0.142.3. The Codex path turned out simpler than Claude's — it needs no temp files:kcap mcp reviewstdio server is registered via-c mcp_servers.kcap-review.{command,args,env}overrides — no~/.codex/config.tomlmutation, so nothing to clean up. Confirmed all three forms (command, args array, env inline-table) register viacodex mcp get.--system-promptflag exists. The renderedprompt-review.txtis passed as Codex's initial prompt (positional--arg), leaving Codex's base instructions intact.Changes
ReviewLaunchBuilder— now vendor-aware and takes an explicit kcap-CLI path; exposes a vendor-neutralReviewMcpServerdescriptor and writes the temp--mcp-configJSON only for Claude.Environment.ProcessPath, which inside the daemon resolves to the separatekcap-daemonbinary (nomcp reviewsubcommand). The daemon now passes_config.CapacitorPath; the interactivekcap reviewCLI passesEnvironment.ProcessPath ?? "kcap".CodexLauncher.BuildArgs— review branch injecting the-cMCP overrides + prompt, with an AOT-safeTomlStringencoder. ReturnsMcpConfigPath: null.AgentOrchestrator— removed the Codex-review rejection; Codex reviews now flow through the same validation/launcher path as Claude.The Claude review path is unchanged at runtime (only compile-time
!null-forgiving edits); effort handling stays at parity (review branches pass--model/-monly, no--effort).Test plan
ReviewLaunchBuilderTests(vendor split, descriptor, CLI-path),CodexLauncherTestsreview branch (the three-coverrides, prompt-after---, no--system-prompt, nullMcpConfigPath, TOML escaping).dotnet publish -c Releaseclean (no IL3050/IL2026).codex mcp get kcap-reviewwith the injected-coverrides resolves tostdio/command=kcap/args=mcp review --owner … --pr …/env KCAP_URL.Remaining manual acceptance (needs a live server + PR, per the spec): launch a hosted Codex review against a real PR and confirm the agent calls
get_pr_summaryagainst the PR head ref.Out of scope
Windows (AI-72), the generic sandbox/approval selector (AI-633), the persistent reviewer loop (AI-774), and a Codex-tailored review prompt.
Design & plan:
docs/superpowers/specs/2026-06-29-ai-632-codex-pr-review-support-design.md,docs/superpowers/plans/2026-06-29-ai-632-codex-pr-review-support.md.Closes AI-632.
🤖 Generated with Claude Code