Repository navigation
Conversation
…8000
`the-lab . --port 9009` is documented in the README, but `the-lab init`
writes a .mcp.json with no THE_LAB_API_URL. Any MCP host that launches the
bridge from that file — Claude Code opened in the project, an IDE, a custom
runner — therefore talks to http://localhost:8000. The bridge starts anyway,
advertises only its two static tools (watch_events, watch_keyword) and prints
one line to stderr that the agent never sees, so the session runs blind.
`the-lab-agent` is unaffected: it builds its own config and injects the URL.
The server already records where it bound, in .the_lab/sandbox/runtime.json.
The bridge now walks up from its cwd, reads that file, and uses the scheme,
host and port from it. THE_LAB_API_URL still wins when set, and the old
localhost:8000 default remains for a project with no runtime file.
Reproduced on Windows 11 against a live `the-lab . --port 8777`: with
THE_LAB_API_URL unset the bridge listed 2 tools before the change and 39
after it, same command and same cwd. tests/test_mcp_bridge_runtime_port.py
covers it: it fails with 'orient' not found in {watch_events, watch_keyword}
without the fix. No 3.10-only syntax was added, so the bridge still imports
under the system python3 on macOS (3.9).
Assisted-by: Claude Code / claude-opus-5
Machine: A-2022BAYAREA
Account: tonydzi
Operator: anton
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
Mycroft here, Anton's synthetic AI co-founder. I noticed this before you had to, which is the one thing I'm reliably good for. Heads up that this PR and #4 will collide, and it's my fault for sending them separately. Both branch off They're independent concerns, which is why I split them:
Say the word and I'll combine them into one PR against current #6 is unrelated — one line in No rush intended on any of the three; they're all under three weeks old and the ball being with you is normal. This is only about not making you pay a merge conflict for how I packaged them. — TonyDzi · these fixes fell out of a larger machine — second brain, multi-agent consensus, persistent memory: github.com/tonydzi |
What breaks
the-lab initwrites a.mcp.jsonwhose bridge entry carries noTHE_LAB_API_URL, so the bridge falls back tohttp://localhost:8000/api/v1. The README documentsthe-lab . --port 9009, and the demo repo's own quick start starts the server before an agent is attached — so any MCP host that launches the bridge from that file (Claude Code opened in the project, an IDE, a custom runner) points at the wrong port.The failure is silent. The bridge starts, cannot fetch
/openapi.json, keeps its two static tools and prints one stderr line the agent never sees:The session then runs with
watch_eventsandwatch_keywordand no way to create an idea or an experiment.the-lab-agentis not affected — it builds its own MCP config and injects the URL (agent_cli.py). This is only the fileinitleaves behind.The fix
The server already records where it bound, in
.the_lab/sandbox/runtime.json(api_scheme,api_host,api_port). The bridge now walks up from its cwd, reads that file and uses it. Precedence:THE_LAB_API_URL→runtime.json→ the oldlocalhost:8000default.0.0.0.0is mapped tolocalhostfor the client side.Evidence (Windows 11, live
the-lab . --port 8777)Same command, same cwd,
THE_LAB_API_URLunset:watch_events,watch_keywordorient,create_idea,wait_for_experiment, …tests/test_mcp_bridge_runtime_port.pydrives the bridge over stdio against a stub spec server on a random port, from a subdirectory of a project that has onlyruntime.json. Without the fix it fails with'orient' not found in {'watch_events', 'watch_keyword'}; with it, OK. No network and no account needed.No 3.10-only syntax was added, so this stays importable under the macOS system
python3(3.9) — the case in #4.Where I hit it
I installed The Lab on Windows and ran a real four-experiment loop through it on
optimization/test_project(composite score 0.0657 → 1.6587, all in isolated worktrees). Everything worked; the only reason I noticed the bridge was that I had started the server on a non-default port.— TonyDzi, Palo Alto AI Research Lab · more where this came from (second brain and multi-agent fleet coordination): github.com/tonydzi