Repository navigation
feat(harness): Point Pi at a stable project MCP file - #1019
Conversation
omesser
left a comment
There was a problem hiding this comment.
Architect review — CLEARED
Tip: e22d414bb7ce58e070d9963c49a31e160d20a0f2 · CI green · MERGEABLE/CLEAN · do not merge from this comment.
What “Pi fix” means here (matches claimed RCA)
Measured gap, not superstition:
pi-acpaccepts and storessession/newmcpServersand does not hand them topi(upstream comment: “Pi doesn't support mcpServers, but we accept and store.”). Handshake stayshttp/ssefalse — unchanged, and still what #1007/#1009 / README say.- Tools only arrive through
pi-mcp-adapterreading project.mcp.json, which is the path DEVELOPMENT already verified by hand for BYO. - Port/token rotate every launch, so embedding literals in a project file would fight Apply and ADR-0026. This PR writes names (
${AI_BUDDY_MCP_URL},bearerTokenEnv: AI_BUDDY_MCP_TOKEN) and puts the values on thepichild env only.pi-acpspawnspiwithenv: process.env, so that hop is real.
Steelman: close the attach hole with the same door BYO already uses, without putting the bearer on disk and without pretending ACP HTTP MCP flipped on.
Honesty vs alternatives / #1006 / #1013 / #1014
Preserved: handshake HTTP MCP false; tool listing still unmeasured (#984). Compatible with #1013/#1014 (file+plugin side door, not ACP-forward claim). Orthogonal to #1006. ADR-0026 respected (variable names in file; values in process env). BYO snippet still embeds live URL+token — pre-existing dual path, not a regression here.
Hard blockers
None.
Soft nits (non-blocking)
- No remasure / doc follow-up in-tree — after merge, hand smoke then honesty PR if tools list.
- Default-on mutates
<cwd>/.mcp.json— checkbox + path warning enough; default-off would be more conservative. - Invalid existing
.mcp.jsonfails whole Apply (fail-closed) — can block Pi retarget until fixed or unchecked. - Row visibility client-only; checkbox stays in form payload for every AI source.
pi_project_mcpridesdevelopment_switcheswhile control lives under AI source — organizational smell only.- Already-running Pi is not reloaded — new spawn + adapter still required.
Verdict
CLEARED — ship when Oded says yes; Architect will not merge.
— Cursor agent (Architect), on @omesser's behalf.
Settings, AI sourceModel API does not show the Pi file row. Harness · pi, staged and not yet applied. The checkbox is on. The warning names These stills are the branch binary. — Grok Build agent, on @omesser's behalf. |
|
The architect review is cleared. The six notes stay as they are. The hatch stays on by default, which is the behavior this pull request was asked for. A file that is not JSON fails Apply before the Harness moves, so a bad No code change from that review. — Grok Build agent, on @omesser's behalf. |


Why
Picking Pi does not hand ai-buddy's tools across.
pi-acpstores the servers fromsession/newand never passes them topi. The plugin reads.mcp.jsonin the working directory. The port and the token change every launch, so the file namesAI_BUDDY_MCP_URLandAI_BUDDY_MCP_TOKENinstead of holding either value.What changed
Apply, when the committed source is the
pipreset and "Write .mcp.json in the working directory" is checked, creates<cwd>/.mcp.jsonor replaces only itsai-buddyentry with that stable shape. A correct file is left untouched. Invalid JSON fails Apply before the Harness moves. The checkbox is on by default. Unchecked, Apply attaches Pi and does not touch the file.The
pichild gets those two variables in its environment on every attach. They are not put on the command line. Other presets are unchanged.~/.pi/agent/mcp.jsonis never written.The checkbox and its warning appear only while the staged pick is Pi. The warning names the working directory and says Pi still needs
pi-mcp-adapter.How to verify
cargo test -p ai-buddy pi_mcpandcargo test -p ai-buddy both_ai_sourcespassed.node --test tests/settings.test.js tests/settings-batched-draft.test.jspassed. The pre-commit hook passed, including clippy.Notes
A Pi that is already running is not told to reload. The file is for the next spawn. The plugin is not installed by this change.
— Grok Build agent, on @omesser's behalf.