fix(examples): strategy evolution author takes BRIDGE_CWD - #1444
Merged
Merged
Conversation
A bridge started inside a checkout runs its turns in that checkout, and the author profile refuses to replace the CLAUDE.md it finds there, so the live author path failed before the model ran. BRIDGE_CWD names an empty directory on the bridge host. The README output now shows the interval Eval 0.199 computes.
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.
Problem
The strategy-evolution example's live author path failed before the model ran.
A cli-bridge process runs a turn in its own working directory unless the request names one.
A bridge started inside its checkout therefore runs the author in a directory that already holds a
CLAUDE.md.The author profile writes its instructions to
CLAUDE.mdand refuses to replace a different file, so the bridge refused the turn.Change
examples/strategy-evolution/strategy-evolution.ts: the bridge executor takescwdfromBRIDGE_CWD, an empty directory on the bridge host.examples/strategy-evolution/README.md: documentsBRIDGE_CWD, and the sample output shows the interval Eval 0.199 computes ([0.195, 0.350]; the published 0.282.0 and this branch both compute an upper bound of 0.34985).The offline path is unchanged.
Proof (real runs, drew-gtr-pro, author through a Mac cli-bridge over an SSH tunnel)
Offline, from this branch:
pnpm exec tsx examples/strategy-evolution/strategy-evolution.ts .evolution-cwd-offlineLive author,
AUTHOR_MODEL=claude-code/sonnet, withoutBRIDGE_CWD(the bridge runs in~/code/cli-bridge):f20d30c7…is the sha256 of~/code/cli-bridge/CLAUDE.md.The same run with
BRIDGE_CWDset to an empty directory gets past materialization (the directory now holdsCLAUDE.mdwith sha2567fdb9d7a…, the planned file), and the turn completes:Both searches pause with the failure recorded as
operation-recorded(proposer-error) and resume from their ledgers.Still open (not this PR)
A live author still cannot finish through cli-bridge: no backend on the checked bridges reports its served model.
The streamed chunks carry only the requested id (
claude-code/sonnet,kimi-code/kimi-for-coding), and Runtime'sprofileChatClientrefuses an unreported model by design.Claude Code reports the served model in its
stream-jsonoutput (init.model = claude-sonnet-5, also on each assistant message).cli-bridge's claude backend reads only
session_idfrom the init event (src/backends/claude.ts, thesubtype === 'init'branch), althoughChatDelta.modeland the SSE writer already carry a served model.Emitting it changes behavior for every Runtime bridge worker that declares an alias such as
sonnet, becausebridgeExecutorrejects a reported model that differs from the declared one, so it needs its own change with that migration.