Repository navigation
feat: start cli-bridge when Local CLI Bridge finds none running - #333
Conversation
|
Marked ready through gh-drew by fleet lane op-factory:braid-readme (run run_e914760ec242f6e2ab5792467c7af78f, claude-code session 49bd7311-9fb3-429f-b162-213767718abd) at head 3b7b96e. Gate receipts for this head: 3, the newest exit 0 at 2026-12-02T16:18:53Z. Gates running or queued for this head: none. |
tangletools
left a comment
There was a problem hiding this comment.
✅ Auto-approved PR — 3b7b96e9
Blanket team auto-approval is intentional. This is not a code review.
No automated review runs on this PR. This approval rests on the rule above alone.
tangletools · auto-approval · reason: blanket_auto_approve · 2026-12-02T16:19:12Z
|
Merged through gh-drew by fleet lane op-factory:braid-readme (run run_e914760ec242f6e2ab5792467c7af78f, claude-code session 49bd7311-9fb3-429f-b162-213767718abd) at head 3b7b96e. Gate receipts for this head: 3, the newest exit 0 at 2026-12-02T16:18:53Z. Gates running or queued for this head: none. |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
What changes
When Braid discovers the Local CLI Bridge (first-run setup, Retry discovery, and startup with a saved Local CLI Bridge connection) and nothing accepts a connection at its loopback address, Braid starts
cli-bridgefromPATH:BRIDGE_HOST,BRIDGE_PORT);cli-bridge/cli-bridge.login Braid's data directory, with its data incli-bridge/datathere unlessBRIDGE_DATA_DIRis set;claude,codex,opencode,piunlessBRIDGE_BACKENDSis set (the bridge's own default omits Codex, OpenCode and Pi);BRAID_*variables in its environment.Braid then waits up to 30 s for the bridge's health endpoint and reads its catalog as before.
Braid only starts a bridge when the normal, credentialed discovery got a refused connection. A bridge or anything else that answers, even with an error or a timeout, is left alone, and a remote or HTTPS endpoint never starts anything. Two Braids starting at the same moment cannot run two bridges: the second bridge fails to bind and exits, and both Braids see the first one answer.
When
cli-bridgeis not onPATH, setup shows one plain line and the setup link, with no stack trace or local path:(90x24; the link wraps inside the setup panel.) The same sentence and link are the only bridge notice on the profile and connection steps, and the Local CLI Bridge row reads
unreachable.The started bridge outlives Braid
Braid never stops a bridge, including one it started. A bridge can hold native sessions that a later Braid resumes, and another Braid window can be using it; Braid cannot tell at exit whether either is true. Stopping only bridges Braid started would also mean tracking ownership across Braid processes. The cost is a background process that stays until the user stops it, which
docs/getting-started.mdnow says.Not covered
A bridge that dies during a session is not restarted at send; that send fails as it does today, and the next Braid start (or Retry discovery) starts it again. Switching to Local CLI Bridge with
/connectioninside a running session does not start one either.Proof
New
test/local-cli-bridge-autostart.test.tsruns the builtbraidin a real terminal at 90x24. The only stand-in is acli-bridgescript onPATH, an HTTP server that answers/healthand/v1/models.cli-bridgeonPATH: Braid starts it on 127.0.0.1 and the configured port, setup lists the started bridge's model, the Local CLI Bridge row ishealthy, and setup reaches review. The bridge's log line is incli-bridge/cli-bridge.log, and the bridge is still alive after Braid's terminal closes.cli-bridgeonPATH: the screen shows the sentence and the link, with no stack trace or absolute path, and no bridge directory is created.Red on
e33a2133(the test alone on main): the first two cases fail and the third passes. Green on3b7b96e9, together withproduction-connection-setupandcloud-setup-user-path(18/18). An earlier revision sent an unauthenticated health probe before discovery;public plain startup uses private origin-bound Bridge authcaught it, and now discovery's own credentialed request is the only probe.Run ID: run_e914760ec242f6e2ab5792467c7af78f
Session: 49bd7311-9fb3-429f-b162-213767718abd