Skip to content

feat(bg): B-0442.4 — bus publish WIRING (slice-3 detector is STUB; substrate-honest per Riven's P0 caution)#3023

Merged
AceHack merged 1 commit into
mainfrom
otto-b0442-4-bus-publish-slice-4-impl-2026-05-13
May 13, 2026
Merged

feat(bg): B-0442.4 — bus publish WIRING (slice-3 detector is STUB; substrate-honest per Riven's P0 caution)#3023
AceHack merged 1 commit into
mainfrom
otto-b0442-4-bus-publish-slice-4-impl-2026-05-13

Conversation

@AceHack
Copy link
Copy Markdown
Member

@AceHack AceHack commented May 13, 2026

Summary

Slice 4 of B-0442. Wires the bus-publish path for the missed-substrate cascade detector. Slice 3 (real branch-HEAD vs squash compare) is NOT implemented; `detectCascade` adapter is a stub that returns null.

Substrate-honest framing (Riven's P0 lesson)

This PR is the same shape as B-0440.4 (PR #3017) — but learns from Riven's adversarial catch on that PR (envelope `6c689634-...`): the framing is "bus-publish wiring complete; detector stub awaiting real compare logic" — NOT "missed-substrate cascade detection is operational."

In production, this service WILL fetch merged PRs but WILL NOT detect cascades until slice 3 lands.

What ships

  • Bus-publish path (try/catch wrapped + structured publish-error surfacing)
  • Adapter abstraction (detectCascade injectable for tests)
  • CascadeFinding payload schema (prNumber, branchName, missingCommits, urgency)
  • CLI flags (--no-publish, --agent, --to, --fetch-limit)
  • Canonical SENDER_IDS / AGENT_IDS reuse (cross-PR pattern from Riven/Vera/Copilot)

Tests

```
bun test
11 pass
0 fail
42 expect() calls
```

Three-service reactive-loop status

Service Skeleton Real detection Bus publish
B-0440 standing-by #3006 #3011 + #3022 (commit + PR signals) #3017
B-0441 backlog-ready #3007 #3012 (backlog scan) #3020
B-0442 missed-substrate #3008 #3014 (merged-PR fetch) ⚠️ THIS PR (wiring only; detector stub)

Composes with

🤖 Generated with Claude Code

…not real cascade detection)

Slice 4 of B-0442. Wires the bus-publish path for the missed-substrate
cascade detector. Slice 3 (branch-HEAD vs squash-content compare)
is NOT yet implemented; the detectCascade adapter is a stub that
always returns null.

SUBSTRATE-HONEST FRAMING (per Riven's P0 catch on the analogous
B-0440 cascade — envelope 6c689634-...):

This PR ships:
- Bus-publish path (try/catch wrapped, structured publish-error
  surfacing, missed-substrate-cascade topic from B-0400)
- Adapter abstraction (detectCascade injectable for tests; real
  slice-3 comparator plugs in later)
- CascadeFinding payload schema (prNumber, branchName,
  missingCommits, urgency)
- CLI flags (--no-publish, --agent, --to, --fetch-limit)

This PR does NOT ship:
- Real branch-vs-squash comparator (slice 3)
- Auto-recovery-PR opening (slice 5)
- Cron registration (slice 6)

In production right now, this service WILL fetch merged PRs but
WILL NOT detect any cascades (stub returns null). The reactive
loop is wired but inert until slice 3 lands.

Riven's P0 warning preserved: do NOT frame this as "missed-
substrate cascade detection is operational." The framing is "bus-
publish wiring complete; slice-3 detector stub awaiting real
compare logic."

Key design choices:
- Adapter pattern (now / fetchRecentMergedPRs / detectCascade /
  publishCascade) for full test injectability
- spawnSync (execFile-style) for gh CLI invocation
- Canonical SENDER_IDS / AGENT_IDS reuse (Riven/Vera/Copilot
  cross-PR finding)
- try/catch on publishCascade (daemon survives bus IO failures)

Tests: 11 pass / 0 fail / 42 expect() calls.

Composes with:
- B-0442.2 (PR #3014 — merged-PR fetch this extends)
- B-0440.4 (PR #3017 — same bus-publish pattern; first reactive
  loop closed)
- B-0441.4 (PR #3020 — proactive companion; same try/catch pattern)
- B-0400 schema extension (PR #3016 — missed-substrate-cascade topic)
- Riven adversarial review (envelopes 6c689634 + e8174b34)

Co-Authored-By: Claude <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings May 13, 2026 19:27
@AceHack AceHack enabled auto-merge (squash) May 13, 2026 19:27
@chatgpt-codex-connector
Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@AceHack AceHack merged commit a12d795 into main May 13, 2026
27 checks passed
@AceHack AceHack deleted the otto-b0442-4-bus-publish-slice-4-impl-2026-05-13 branch May 13, 2026 19:29
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Wires the B-0442 missed-substrate detector’s slice-4 “reactive loop” by adding an injectable cascade-detection adapter (still stubbed) and publishing missed-substrate-cascade envelopes to the local bus when cascades are detected.

Changes:

  • Adds bus publish plumbing (--no-publish, --agent, --to) and per-finding envelope publishing to pollOnce.
  • Introduces CascadeFinding schema + injectable detectCascade/publishCascade adapters (with real detector intentionally stubbed to null until slice 3).
  • Updates tests to cover cascade publish wiring, publish skipping, and publish failure behavior.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
tools/bg/missed-substrate-detector.ts Adds slice-4 bus publish wiring, new config flags, cascade finding type, and injectable adapters.
tools/bg/missed-substrate-detector.test.ts Expands unit tests for cascade detection injection + publish behavior and new CLI flags.

Comment on lines +164 to +168
const findings: CascadeFinding[] = [];
for (const pr of fetch.prs) {
const finding = adapters.detectCascade(pr);
if (finding !== null) findings.push(finding);
}
AceHack added a commit that referenced this pull request May 13, 2026
…d optional' claim (#3024)

* docs(bg): substrate-honest README per Riven's P2 — qualify 'foreground optional' claim with delivered surface

Resolves Riven's P2 finding (bus envelope 6c689634-...). README now:
- Explicit 'Architectural claim (substrate-honest)' section names the
  gap between 'nudges via bus' and 'foreground optional' per Riven's
  framing-correction
- Per-service slice status table (1+2+3+4 for B-0440; 1+2+4 for B-0441;
  1+2+4 with slice-3 STUB for B-0442)
- Failure-mode handling section documents lastPublishError, gh-error
  explicit surfacing, daemon no-result-accumulation
- What's-still-pending section names B-0442.3 + slice 5 + slice 6 as
  the gap-to-aspirational-claim
- Updated run examples (--no-publish dry-run, --to agent-routing)

Composes with Riven adversarial review (envelope 6c689634) + Otto
reply (envelope e8174b34) + the slice cascade (PRs #3006-#3023).

Co-Authored-By: Claude <noreply@anthropic.com>

* fix(bg-readme): role-refs + slice-ID disambiguation + remove ephemeral envelope ID

Addresses Copilot + Vera review on PR #3024:
- Replace persona name (Riven) with role-ref + durable PR pointers (#3017, #3022, #3024)
- Remove ephemeral bus envelope ID 6c689634-... — references PR threads instead
- Disambiguate 'B-0442.3' as 'B-0442 slice 3' (not a per-row file)
- Remove 'subscriber agents can react autonomously' overclaim — services nudge, subscribers slice 5+ not shipped

Co-Authored-By: Claude <noreply@anthropic.com>

---------

Co-authored-by: Claude <noreply@anthropic.com>
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.

2 participants