Skip to content

fix(examples): strategy evolution author takes BRIDGE_CWD - #1444

Merged
drewstone merged 1 commit into
mainfrom
fix/strategy-evolution-bridge-cwd
Sep 27, 2026
Merged

drewstone merged 1 commit into
mainfrom
fix/strategy-evolution-bridge-cwd

Conversation

@drewstone

Copy link
Copy Markdown
Contributor

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.md and refuses to replace a different file, so the bridge refused the turn.

Change

  • examples/strategy-evolution/strategy-evolution.ts: the bridge executor takes cwd from BRIDGE_CWD, an empty directory on the bridge host.
  • examples/strategy-evolution/README.md: documents BRIDGE_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-offline

  carry-forward            selected  parent sample selection Δ +0.284 on 12 tasks
claim: ship (finalist node_fe43aed7c3028f91b481f9e1ac691e66 beat the root on the 24 test units at confidence 0.95 (1 finalist, family-wise 0.95))
test lift 0.276 [0.195, 0.350] on 24 tasks
spend: $0.0054 known

Live author, AUTHOR_MODEL=claude-code/sonnet, without BRIDGE_CWD (the bridge runs in ~/code/cli-bridge):

Error: strategy author failed: bridgeExecutor: bridge stream error: AgentProfile workspace materialization failed: Refusing to replace existing workspace file: CLAUDE.md — planned sha256:7fdb9d7a… != existing sha256:f20d30c7…

f20d30c7… is the sha256 of ~/code/cli-bridge/CLAUDE.md.

The same run with BRIDGE_CWD set to an empty directory gets past materialization (the directory now holds CLAUDE.md with sha256 7fdb9d7a…, the planned file), and the turn completes:

Error: strategy author: Runtime turn did not report the model actually used; refusing to label the response with the requested model

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's profileChatClient refuses an unreported model by design.
Claude Code reports the served model in its stream-json output (init.model = claude-sonnet-5, also on each assistant message).
cli-bridge's claude backend reads only session_id from the init event (src/backends/claude.ts, the subtype === 'init' branch), although ChatDelta.model and the SSE writer already carry a served model.
Emitting it changes behavior for every Runtime bridge worker that declares an alias such as sonnet, because bridgeExecutor rejects a reported model that differs from the declared one, so it needs its own change with that migration.

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.
@drewstone
drewstone merged commit df74c82 into main Sep 27, 2026
4 checks passed
@drewstone
drewstone deleted the fix/strategy-evolution-bridge-cwd branch September 27, 2026 14:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant