Repository navigation
fix(harness): Serve the MCP endpoint from the probe before it attaches - #1035
Merged
Merged
Conversation
Fails alone: the fake advertises http and gets no loopback URL (#984). Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…Harness Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
omesser
commented
Sep 26, 2026
omesser
left a comment
Owner
Author
There was a problem hiding this comment.
Architect review — CLEARED
Tip: 8c5a9dcd95df11034c9cb9270e042df69e353f88
Title: fix(harness): Serve the MCP endpoint from the probe before it attaches
CI: green (ubuntu / macos / windows × PR Tests; Pages build ok, deploy skipped)
Mergeable: MERGEABLE / CLEAN
Scope: probe path + docs (+111 / −32, 6 files). App serve in main.rs untouched. Closes #984.
Verified
| Claim | Tip state |
|---|---|
Probe served MCP before attach so choose_mcp takes the HTTP branch |
probe calls mcp_http::serve then spawns answer_probe_calls before handshake print / turn. |
Same dispatch as the frame loop (ADR-0026 / ADR-0023) |
answer_probe_calls uses ai_buddy_core::dispatch::dispatch with empty roster, no ExpressionHandle, StubWindowSource. Not a stub receiver; not a second tool impl. |
| Loud failure when bind fails | Capitalized NO LOOPBACK LISTENER line under mcp. |
mcp listed observes tools/list server-side |
LISTED AtomicUsize + tools_listed(); printed after the turn. |
| Fake ACP records transport; regression test | mcp=http / mcp=stdio recording + the_probe_serves_the_loopback_endpoint_before_it_attaches. |
| README / DEVELOPMENT honesty | Pi row states never-asked + #1019; stock probe note says list delivery ≠ tool call; measured Goose/Codex/Copilot rows. |
StubWindowSource unconditional |
cfg(not(macos)) removed; probe needs it on macOS. |
No Hard. Probe-only blast radius matches body.
Soft residuals (non-blocking)
rememberon the probe path still writes realmemory.md(already documented). Acceptable for a stock probe.- Named Harnesses not re-probed here (
claude/hermes/opencode/cursor-agent/grok) — body says so; not required for #984. ENDPOINTOnceLock is process-wide (app already); fine for one probe process.
Verdict
CLEARED. Ready for human merge; Architect does not approve or merge.
— Cursor agent (Architect), on @omesser's behalf.
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.
Why
scripts/probe-harness.shreturned frommain.rsbeforemcp_http::serveran, somcp_http::endpoint()wasNoneon the probe path.choose_mcpthen skipped the HTTP branch even for a Harness that advertisedmcpCapabilities.httpand handed over the--mcp-stdioshim with an empty environment, which exits on its first call (ADR-0026). The probe printedmcp http truenext to that shim and said nothing, and every per-Harness MCP claim in the README was read off that silence.Confirmed at runtime before the change, against Goose:
The probe now serves the endpoint before it attaches, so
choose_mcptakes the branch the app takes, answers any tool call through the samedispatchthe frame loop uses, and reports undermcp listedwhether the Harness fetchedtools/list. A probe whose loopback bind fails says so in capitals undermcp.Closes #984.
Scope
harness::probeservesmcp_http::servebeforeattach, spawnsanswer_probe_calls, and printsmcp listedafter the turn andmcp callper tool call.harness::answer_probe_callsdispatches throughai_buddy_core::dispatch::dispatchwith an empty roster, noExpressionHandle, andStubWindowSource.speakcomes backsuccess: false;rememberwrites the realmemory.md, which the probe already documented.mcp_http::tools_listedcountstools/listanswers.ai_buddy_core::window_source::StubWindowSourceloses itscfg(not(macos)); nothing used it on any platform.mcp=httpormcp=stdiofromsession/new, and a test asserts the probe hands an http-advertising Harness the loopback URL.docs/DEVELOPMENT.mdand the script header describe the new lines.Tradeoffs
The issue's second route, a loud warning with no endpoint, was rejected once route one measured as small: one channel, one thread, and the existing
dispatch. The receiver is not a stub, which ADR-0026 rules out, and not a second tool implementation, which ADR-0023 rules out.PROBE_PROMPTstays fixed. Delivery of the tool list is observed server side throughmcp listed, so it does not depend on a model being up or obeying. Which tools a Harness then shows its model came from the tool-class research note's own client, and the README note now says so.Blast Radius
Probe path and its docs only. The app's
servecall inmain.rsis untouched;tools_listedis a read-only counter it never reads.StubWindowSourcebecoming unconditional compiles on macOS and adds one unused-by-the-app type elsewhere.Built and tested on macOS only.
src-tauri/src/platform/x11/does not compile on this machine; the change touches no platform module.Verification
cargo test -p ai-buddy(588 passed) andcargo test -p ai-buddy-core(494 passed);cargo clippy --workspace --all-targets -- -D warningsclean;node --test tests/343 passed; pre-commit green includingshfmtandshellcheckon the script.the_probe_serves_the_loopback_endpoint_before_it_attachesfails on the first commit when run alone (mcp=httpcount 0) and passes after the fix.scripts/probe-harness.shafter the fix:mcpmcp listedgoosehttp://127.0.0.1:55848/mcpcodexhttp://127.0.0.1:55878/mcpend_turn,Wave | Hello from the probe.copilothttp://127.0.0.1:55909/mcpend_turn,Wave | Hello from the probe.piai-buddy --mcp-stdio(with environment)pi-acpstoressession/newservers and never passes them topi(#1019)Goose before and after, the same machine and prompt:
Not run here:
claude,hermes,opencode,cursor-agent,grok. Nothing in this change is Harness-specific.🤖 Generated with Claude Code
— Claude Code agent, on @omesser's behalf.