Repository navigation
Build source CLI before host daemon startup - #1971
Conversation
|
🚨 SLOP COP 🚨 · I am the SlopCop. I started a security, code quality, performance, architecture, and end-to-end review. |
| // gitignored runtime before the daemon starts so a sandboxed thread never | ||
| // has to write back into the daemon's checkout to bootstrap `bb`. | ||
| "dependsOn": [ | ||
| "@bb/cli#build", |
There was a problem hiding this comment.
🚨 slopcop/review — The new CLI build prerequisite does not cover direct source-daemon commands.
pnpm dev:host-daemon and the @bb/scripts command start the source daemon without this Turbo task. A fresh worktree has no apps/cli/dist/index.js, so the new runtime guard stops these supported commands before the wrapper can build the CLI.
Please route every source-daemon command through one CLI preparation step. Add coverage for a missing runtime and a failed CLI build.
There was a problem hiding this comment.
🚨 SLOP COP 🚨 · review
Plain-English summary: This PR builds the developer CLI before the main source daemon starts. It also gives a clear error when the CLI runtime is absent.
I found one P2 startup regression. The Turbo dependency protects the normal pnpm dev path. However, pnpm dev:host-daemon and the @bb/scripts command bypass Turbo. A fresh worktree has no built CLI runtime, so the new guard stops those commands.
Please use one CLI preparation step for every supported source-daemon command. Test a missing runtime and a failed CLI build through those commands.
The security review found no issues. The performance review found no other issue. The architecture scan found no useful shared abstraction for the repeated CLI runtime path.
The focused test passed all 16 tests. The Turbo source startup returned HTTP 200, and the built CLI ran successfully. GitHub CI is green. One separate local full-suite run hit an unrelated deadline test failure.
No browser route changed, so browser validation did not apply. The independent GPT-5.6 review gate confirmed the P2 regression.
What was wrong
The source host daemon injected
apps/cli/bin/bbinto agent shells without ensuring its gitignoreddist/index.jsruntime had been built. From a fresh daemon worktree, the firstbbinvocation therefore attempted the wrapper lazy build inside that separate checkout; sandboxed threads could not write its.turbodirectories and every injected CLI command failed.What changed
@bb/host-daemon#devdepend on@bb/cli#build, so Turbo restores or builds the CLI runtime before starting the source daemon.HOST_DAEMON_PROTOCOL_VERSIONis unchanged. No CLI command, flag, or configuration surface changed, so guide documentation is unchanged.The added host-daemon critical-path cost measured about 9 ms on a local Turbo cache hit and about 230 ms for a cold CLI build on the test machine; app and server startup remain parallel.
How you verified
pnpm exec turbo run test typecheck --filter=@bb/host-daemon --force— 48 test files and 587 tests passed; typecheck passed.pnpm exec turbo run dev --filter=@bb/host-daemon --dry=json --no-update-notifier— confirmed@bb/cli#buildis a direct prerequisite of@bb/host-daemon#dev.pnpm exec turbo run build --filter=@bb/cli --forcefollowed byenv -u BB_CLI ./apps/cli/bin/bb --version— built and launched successfully (0.39.0).Fixes #1970