feat(setup): S2-bridge — guided-detect lib + auto-dispatch opt-in flip (one-click-installer) - #445
Merged
Merged
Conversation
… marker (kickoff §7) Maintainer decision 2026-05-31 (one-click-installer kickoff §7): auto-dispatch is real, metered autonomous work — the PostToolUse hook must not fire on every */kickoff.md write (old opt-OUT footgun). Gate lives in the HOOK ONLY: kickoff.ts `bridge: skip` semantics keep serving the manual dispatch.ts path (/dispatcher, /pipeline) unchanged. - .claude/hooks/runtime-bridge-dispatch.sh: after the file-exists guard, exit 0 unless first line is exactly `<!-- bridge: auto -->` (trimmed match, mirrors kickoff.ts:24-27 skip-marker precedent). Path filters + #411 P4 meta-launch skip retained. - tests/hooks/runtime-bridge-dispatch-optin.test.sh: paired-negative — (a) unmarked kickoff = no dispatch (RED before the gate: failed with DISPATCH-CALLED, proving non-vacuity), (b) marked = dispatch fires (positive control), (c) meta-launch + marker = still skipped (P4 regression guard). tsx stubbed via PATH-prepend; jq/node asserted to avoid vacuous pass. - audit-self.yml: wire the test into principles-meta-tests job. - Docs flipped opt-out → opt-in (runtime-bridge-setup.md, README.md, DESIGN.md, setup-runtime-bridge.sh say-text, dispatch.ts comments) + stale-hook-copy re-run note for consumers who installed before the flip.
Plan Task 4 (docs/superpowers/plans/2026-05-31-one-click-installer.md) verbatim: setup.d/bridge-guided.sh exposes bridge_health_ok <url> (keys on /health — succeeds whether aif runs in docker or natively), bridge_diagnose <url> (up|docker|native|absent), and bridge_guided_run (diagnose → matching bring-up advice → delegate our-side writes to the existing setup-runtime-bridge.sh). Sourceable lib-only via BRIDGE_LIB_ONLY=1. TDD: tests/install-sh/bridge-guided.test.sh RED with lib missing (PASS=1 FAIL=2) → GREEN PASS=3 FAIL=0.
artyhoo
enabled auto-merge (squash)
June 10, 2026 12:33
7 tasks
artyhoo
added a commit
that referenced
this pull request
Jun 10, 2026
…equired at library layer (kickoff §7) (#446) Completes the S2-bridge opt-in flip (#445). The hook gate shipped in #445 guards the PostToolUse path only; the stage dispatch (one-click-installer kickoff §7, maintainer decision 2026-05-31) mandates the inversion in kickoff.ts itself: - buildKickoffSpec defaults to requireAutoMarker: true — the safe default for any future programmatic caller; an unmarked kickoff yields no spec. - <!-- bridge: skip --> hard-blocks every path; nothing overrides it. - cli/dispatch.ts is the ONE explicit opt-out ({ requireAutoMarker: false }): the manual on-demand contract (/dispatcher, /pipeline, operators) stays unchanged per §7 «everything else stays manual». - Test 5 converted to the opt-in contract: (a) unmarked → null (paired-negative), (b) auto marker → spec, (c) skip → null on every path, (d) manual-path opt-out → spec. Prior-art: skipped — default inversion within existing runtime-bridge capability, no new capability.
This was referenced Jun 10, 2026
artyhoo
added a commit
that referenced
this pull request
Jun 10, 2026
…ring (one-click-installer S5) (#452) SCOPE 1: setup.d/bridge-guided.sh:32 had two bugs in the state=up branch: (a) bare relative path to setup-runtime-bridge.sh broke when cwd != repo root (lib is sourced, so $0 is the caller); (b) consumers installed via install.sh have no packages/runtime-bridge/ at all -> unconditional fail. Fix (Option C, dual-implementation §3 graceful degrade): resolve root via BASH_SOURCE, run the script by absolute path when present (framework repo), else print a docs/runtime-bridge-setup.md pointer and return 0. Paired-negative (script absent) + positive (script present, cwd=/tmp) cases added to tests/install-sh/bridge-guided.test.sh; falsifier verified: new cases FAIL=3 against the old lib code. SCOPE 2: .github/workflows/audit-self.yml — wire the 5 install-sh tests from S1-S3 (#443-#447) as per-file steps in principles-meta-tests, after the runtime-bridge opt-IN gate step (convention from #445). transform-internal-refs.test.sh was already wired; not duplicated. Plan Task 9 verification: full install-sh suite green (6 files, all FAIL=0), e2e dry-run in /tmp throwaway wrote nothing, shellcheck clean (2 pre-existing SC2317 info on the lib-only sentinel pattern, intended). Prior-art: skipped — graceful-fallback fix + CI wiring + verification, no new capability (./setup shipped S3, spec §11).
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.
Summary
S2 sub-wave 3/3 of the one-click-installer umbrella (plan Task 4 + its kickoff §7 ⚠ prerequisite, after S1 #442). Two commits: (A) flips runtime-bridge auto-dispatch from opt-OUT to opt-IN per maintainer decision 2026-05-31 — the PostToolUse hook now dispatches ONLY kickoffs whose first line is
<!-- bridge: auto -->; (B) adds the runtime-agnostic bridge guided-detect libsetup.d/bridge-guided.sh.Design (cold-reviewed, 2 rounds): the gate lives in the hook only —
packages/runtime-bridge/src/kickoff.tsuntouched, so the manualtsx cli/dispatch.tspath (incl.bridge: skipsemantics) that /dispatcher and /pipeline depend on keeps current behavior. Verified no other silent auto-dispatch path exists (settings.json:141 is the single hook wiring; consumers get the gated hook via setup-runtime-bridge.sh copy).Changes
.claude/hooks/runtime-bridge-dispatch.sh— opt-IN gate after the-fguard (trimmed-exact first-line match, mirrors kickoff.ts:24-27; CRLF-safe); fix(pipeline): Stage 3 — suppress spurious aif auto-dispatch on meta-launch kickoffs (P4) #411 P4 meta-launch skip preserved.tests/hooks/runtime-bridge-dispatch-optin.test.sh— 3 cases: (a) unmarked kickoff → no dispatch, (b) marked → dispatches (positive control, tsx stubbed), (c) meta-launch+marker → still skipped (P4 regression guard). (a)/(b) share one path differing only in first line; pre-gate red phase pasted ((a) FAILED before the hook edit — negative arm proven non-vacuous, T-OCI-B)..github/workflows/audit-self.yml— CI run-line for the new test (folder convention: tests/hooks/* enumerated individually).setup.d/bridge-guided.sh+tests/install-sh/bridge-guided.test.sh— verbatim plan Task 4 (bridge_health_ok/bridge_diagnose/bridge_guided_run, health-first, never assumes docker). TDD red → green PASS=3.Prior-art consult
tests/hooks/, outsidepackages/); Commit B's lib is outsidepackages/. No new deps.Test plan
bash tests/hooks/runtime-bridge-dispatch-optin.test.sh→ PASS=3 FAIL=0 (+ pre-fix RED for case (a) pasted — worker verify-trace)bash tests/install-sh/bridge-guided.test.sh→ PASS=3 FAIL=0 (red phase pasted)bash -nhook + lib → exit 0grep -rn 'bridge: auto'→ marker present at all 7 documented sitesci-success(runs on PR; includes the newly wired hook test)§1.7 Self-discipline check (REQUIRED if PR touches discipline-bearing files)
§1.7 Skipped: operational hook behavior flip + lib + tests + doc inversions; no rules, principles, shipped templates or goal-bearing docs touched.
🟢 Простыми словами
Раньше написанный агентом kickoff-файл автоматически уходил в исполнение внешней системой (aif), если его явно не пометили «пропусти» — опасный дефолт: реальная автономная работа стартовала молча. Теперь наоборот: ничего не уходит само, пока первой строкой файла не написано «bridge: auto». Плюс добавлена библиотечка, которая перед установкой проверяет «жив ли мост» по health-запросу — неважно, в докере он или нет.
Observations (out of scope, follow-ups)
packages/runtime-bridge/test/runtime-bridge.test.ts:86-121Test 1 stale-but-green since fix(pipeline): Stage 3 — suppress spurious aif auto-dispatch on meta-launch kickoffs (P4) #411 (asserts only exit-0); doubly stale post-flip — rewrite as negative arm or drop (follow-up).aif-dispatch-dedup.test.tsimport runsdispatch.tsmain()without argv → unhandled rejection at dispatch.ts:185. Fix = argv/import.meta guard, separate PR.docs/meta-factory/dispatcher-skill-rphase.md:17could gain a one-liner about the hook-layer opt-in (R-phase record left untouched)../setup) may want an installer-level reminder for consumers holding pre-flip hook copies.