fix(bstack): fresh-install portability — un-dangle the self-improving/autonomy layer (BRO-1715)#92
Conversation
…/autonomy layer (BRO-1715)
bstack's DISCIPLINE harness transplanted to a fresh non-~/broomva workspace,
but its SELF-IMPROVING / AUTONOMY layer was silently ~/broomva-hosted. Four
packaging bugs made a fresh `git clone bstack && bstack bootstrap` install look
healthy while the control loop was dead on arrival. The all-green in ~/broomva
was a self-hosting artifact (~/broomva IS the bstack monorepo).
- Bug 1: five loop/autonomy hooks (bstack-autoupdate, knowledge-wakeup,
auth-preflight, autonomous-posture, arc-continuation) were wired at
${BROOMVA_HOME}/.claude/skills/bstack/scripts/ — a dir no install step
creates (bstack installs by git-clone, never `npx skills add`). Re-rooted all
five at $BSTACK_REPO/scripts/ (where their SELF_DIR siblings co-locate; the
same substitution install-rcs-stability.sh already bakes). bootstrap.sh
Phase 3 AND repair.sh (which duplicates the merge) now substitute $BSTACK_REPO.
- Bug 2: .control/leverage-setpoints.yaml (reference r0) never seeded → the
sensor ran referenceless. bootstrap.sh Phase 2 now scaffolds it (idempotent).
- Bug 3: doctor §7 checked workspace-relative skills/<n>/scripts/*.py but
P6/P9/P12 install globally (-g) → now also resolves the global skill dirs.
- Bug 4: doctor defaulted WORKSPACE to $HOME/broomva → false-GREEN off-broomva.
Now resolves via scripts/lib/resolve-workspace.sh and fails loud (exit 3) on
a non-workspace rather than defaulting.
- New doctor §25 resolves every wired hook command (conservative shlex-based
absolute-path extraction; hard-gaps a bstack-shipped dangle, soft-infos a
not-yet-installed companion skill) — closes the §24 name-grep-only false-GREEN.
- New tests/fresh-install-portability.test.sh: hermetic, bootstraps into an
empty scratch workspace, 6 assertions RED-before/GREEN-after.
P20 cross-review: 8/10 (fresh-context adversarial pass; substitution correctness,
exit-3 containment, test honesty, idempotency all independently verified).
Codex/Strata-A unavailable (usage limit). §25 hardened per finding #2.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (7)
📝 WalkthroughWalkthroughThis PR fixes fresh-install portability for the bstack self-improving/autonomy layer when installed outside ChangesFresh-install portability fix
Estimated code review effort: 3 (Moderate) | ~30 minutes Sequence Diagram(s)sequenceDiagram
participant bootstrap.sh
participant repair.sh
participant settingsSnippet as settings.json.snippet
participant settingsJson as .claude/settings.json
participant doctor.sh
bootstrap.sh->>settingsSnippet: read template with $BSTACK_REPO placeholder
bootstrap.sh->>settingsJson: substitute $BSTACK_REPO with SKILL_ROOT and merge
repair.sh->>settingsJson: substitute $BSTACK_REPO and merge/scaffold hooks
doctor.sh->>settingsJson: parse wired hook commands
doctor.sh->>doctor.sh: resolve workspace, validate .git/.control
doctor.sh->>doctor.sh: check skill paths under global roots
doctor.sh-->>bootstrap.sh: report gaps (hard/info) or ok
Possibly related PRs
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
What & why
bstack's discipline harness transplanted cleanly to a fresh non-
~/broomvaworkspace, but its self-improving / autonomy layer was silently~/broomva-hosted. Four packaging bugs made a freshgit clone bstack && bstack bootstrapinstall look healthy while the control loop was dead on arrival — the all-green in~/broomvais a self-hosting artifact (~/broomvais the bstack monorepo, so it's the one workspace that passes vacuously).Fixes BRO-1715. Packaging only — no primitive added, no governance rule changed.
The four bugs (all re-confirmed on disk, RED-tested before fix)
bstack-autoupdate,knowledge-wakeup— the loop actuation wire,auth-preflight,autonomous-posture,arc-continuation) wired at${BROOMVA_HOME}/.claude/skills/bstack/scripts/— a dir no install step creates (bstack installs by git-clone, nevernpx skills add). All 5 dangled; the BRO-1707 ship-signal that ridesknowledge-wakeupdied with them.$BSTACK_REPO/scripts/(where theirSELF_DIRsiblingsleverage-sensor.py/leverage-ship-sensor.py/autonomous-arc.shco-locate; the same substitutioninstall-rcs-stability.shalready bakes).bootstrap.shPhase 3 andrepair.sh(which duplicates the snippet merge) now substitute$BSTACK_REPO..control/leverage-setpoints.yaml(reference r0) never seeded →leverage-sensor.pyran referenceless (empty metrics); doctor §23 could never certify closure.bootstrap.shPhase 2 scaffolds it (idempotent, never overwrites,authored_by: bstack-defaultleft for the human to sign).skills/<n>/scripts/*.py, but P6/P9/P12 install globally (-g→~/.claude/skills+~/.agents/skills)./kgcheck).WORKSPACEdefaulted to$HOME/broomva, so a barebstack doctorfrom an unrelated dir audited the healthy~/broomva.scripts/lib/resolve-workspace.sh(env → cwd-is-workspace →~/.bstackconfig → cwd); fails loud (exit 3) on a non-workspace rather than defaulting.New
shlex-based absolute-path extraction; hard-gaps a bstack-shipped dangle, soft-infos a not-yet-installed companion skill).tests/fresh-install-portability.test.sh— hermetic (no network/gh, isolated$HOME). Bootstraps into an empty scratch workspace; 6 assertions, RED-before / GREEN-after.Validation
tests/*.test.shsuite 33/33 + canary 5/5; shellcheck clean; snippet valid JSON.~/broomvadoctor 102/102 (a first §25 draft false-positived on thepython3 <script>Stop hook — fixed with interpreter/quote-aware extraction).bstack doctor— verify primitive contract #2.Migration
Existing installs: re-run
bstack repairto re-root the 5 hooks + seedleverage-setpoints.yaml. A workspace whose livesettings.jsonstill carries the old~/.claude/skills/bstack/scripts/paths will now surface them as §25 hard gaps (a true finding — those hooks were dead).Known follow-up (out of scope)
branch-janitor.shis not inbootstrap.sh's WORKSPACE_HOOKS deploy list and isn't askills/path, so fresh installs still show "P8 mechanism missing" (pre-existing).\$PWDand leak scaffold artifacts (METALAYER.md,schemas/*.schema.json) into the repo root — a test-hygiene follow-up, not touched here.🤖 Generated with Claude Code
Summary by CodeRabbit
Bug Fixes
Tests