feat(b-0494): circuit breaker viz — slice-2 live bus snapshot#3134
Conversation
- tools/bus/export-cb-snapshot.ts: reads non-expired /tmp/zeta-bus/ envelopes, normalises surface-tagged sender IDs to identity level (otto-cli → otto), derives CLOSED/HALF_OPEN/OPEN state from idle heartbeat count, writes demo/circuit-breaker-snapshot.json - demo/circuit-breaker-snapshot.json: committed snapshot from 73 live envelopes (Otto + Vera show active work; others healthy/no-activity) - demo/index.html: renderCircuitBreakerTab() → async; tries fetching ./circuit-breaker-snapshot.json first (cache:no-cache), falls back to buildCbMockData() on error or absent file — no visible regression when snapshot not present - docs/backlog/P1/B-0494-*.md: backlog row with pre-start checklist dotnet build: 0 warnings, 0 errors ✓ bun tsc --noEmit: clean ✓ bun tools/bus/export-cb-snapshot.ts: 5 entries / 73 envelopes ✓ Co-Authored-By: Claude <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9b94d25164
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
Pull request overview
Slice-2 of the circuit-breaker visualization: replaces the demo's hardcoded mock data with a snapshot derived from live /tmp/zeta-bus/ envelopes, while keeping the mock as a graceful fallback for GitHub Pages visitors when the snapshot is absent or fetch fails.
Changes:
- Adds
tools/bus/export-cb-snapshot.tsto read non-expired envelopes, normalise surface-tagged senders (e.g.,otto-cli→otto), and derive CLOSED/HALF_OPEN/OPEN state per agent. - Commits an initial
demo/circuit-breaker-snapshot.json(73 envelopes, all CLOSED). - Converts
renderCircuitBreakerTab()to async; tries the snapshot first and falls back tobuildCbMockData()on error/empty.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| tools/bus/export-cb-snapshot.ts | New Bun script that derives CB state from live bus envelopes and writes the snapshot JSON. |
| demo/circuit-breaker-snapshot.json | Committed snapshot consumed by the demo at load time. |
| demo/index.html | renderCircuitBreakerTab() now async with snapshot-first / mock-fallback flow. |
| docs/backlog/P1/B-0494-...md | Backlog row documenting slice-2 scope, approach, and pre-start checklist. |
Three reviewer findings addressed: 1. Consecutive idle computation was counting all idle heartbeats in the non-expired window (idleHeartbeats.length). An interleaved pattern like idle→working→idle→idle would report 3 "consecutive" failures instead of the correct trailing streak of 2. Fixed by walking `own` (already sorted newest-first) and stopping at the first non-idle envelope. 2. The `consecutiveFailures` output field now reflects the actual trailing streak, consistent with the field name and the UI contract. 3. argv parsing + I/O were running as unconditional top-level side effects. Wrapped in `async function main()` guarded by `if (import.meta.main)` to match the rest of the toolchain and keep the module importable for tests. Co-Authored-By: Claude <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 66c422d116
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
… bus dir
- `hasWorkSignal` now filters claim envelopes to `action === "claim"` only;
a release envelope no longer keeps an agent in CLOSED/"Active work detected"
after it relinquishes work.
- `readEnvelopes` lets `readdir` throw instead of silently returning []; main()
catches and exits non-zero so misconfiguration is visible rather than
masquerading as a healthy empty-bus snapshot.
- Replaced unsafe `(e.payload as { … })` casts with discriminated-union
narrowing (topic already narrows payload type).
Co-Authored-By: Claude <noreply@anthropic.com>
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
…caught by new audit tool) First real-world use of the new audit-backlog-status-drift.ts tool (peer Otto-Desktop shipped via PR #3758 + PR #3777 quality improvements). Audit flagged B-0494 as a drift candidate; manual per-acceptance-bullet verification confirmed pure-drift: - tools/bus/export-cb-snapshot.ts exists (203 lines) - demo/circuit-breaker-snapshot.json committed - demo/index.html:1836 has snapshot-first fetch with fallback - dotnet build + tsc + panel rendering all implicit (PR #3134 CI green) All 6 acceptance criteria verifiably shipped. Row left open from 2026-05-14 to 2026-05-16 as substrate drift. Closing per the row-close gate step-0 discriminator (PR #3757). Mechanization → audit-tool → manual-verification → close-row workflow is now end-to-end operational. Co-Authored-By: Claude <noreply@anthropic.com>
…ift caught by B-0553 audit tool (#3780) * chore(b-0494): close row — mechanization shipped via PR #3134 (drift caught by new audit tool) First real-world use of the new audit-backlog-status-drift.ts tool (peer Otto-Desktop shipped via PR #3758 + PR #3777 quality improvements). Audit flagged B-0494 as a drift candidate; manual per-acceptance-bullet verification confirmed pure-drift: - tools/bus/export-cb-snapshot.ts exists (203 lines) - demo/circuit-breaker-snapshot.json committed - demo/index.html:1836 has snapshot-first fetch with fallback - dotnet build + tsc + panel rendering all implicit (PR #3134 CI green) All 6 acceptance criteria verifiably shipped. Row left open from 2026-05-14 to 2026-05-16 as substrate drift. Closing per the row-close gate step-0 discriminator (PR #3757). Mechanization → audit-tool → manual-verification → close-row workflow is now end-to-end operational. Co-Authored-By: Claude <noreply@anthropic.com> * chore(B-0045.1/B-0046.1/B-0049.1): close 3 substrate-shelf rows — Stage 1 scaffolds shipped Three sibling substrate-shelf rows surfaced by the audit-backlog-status-drift tool now on main: - B-0045.1: docs/substrate-shelves/biology.md (committed) - B-0046.1: docs/substrate-shelves/economics-history.md (committed; 411 lines) - B-0049.1: docs/substrate-shelves/mystery-schools-eleusinian.md (committed) All three rows explicitly state Stage 1 deliverable is the scaffold doc 'committed in this PR' with status 'open → done on PR merge.' The PRs merged; status stayed open. Drift. Closing. First operational use of the now-on-main audit-backlog-status-drift tool from PR #3758. The tool flagged these correctly; manual verification confirmed full Acceptance shipped (not partial-vs-drift case). Co-Authored-By: Claude <noreply@anthropic.com> --------- Co-authored-by: Claude <noreply@anthropic.com>
…caught by new audit tool) (#3781) First real-world use of the new audit-backlog-status-drift.ts tool (peer Otto-Desktop shipped via PR #3758 + PR #3777 quality improvements). Audit flagged B-0494 as a drift candidate; manual per-acceptance-bullet verification confirmed pure-drift: - tools/bus/export-cb-snapshot.ts exists (203 lines) - demo/circuit-breaker-snapshot.json committed - demo/index.html:1836 has snapshot-first fetch with fallback - dotnet build + tsc + panel rendering all implicit (PR #3134 CI green) All 6 acceptance criteria verifiably shipped. Row left open from 2026-05-14 to 2026-05-16 as substrate drift. Closing per the row-close gate step-0 discriminator (PR #3757). Mechanization → audit-tool → manual-verification → close-row workflow is now end-to-end operational. Co-authored-by: Claude <noreply@anthropic.com>
Summary
tools/bus/export-cb-snapshot.ts— new Bun script: reads non-expired/tmp/zeta-bus/envelopes, normalises surface-tagged sender IDs to identity level (otto-cli→otto), derivesCLOSED/HALF_OPEN/OPENstate per agent from idle-heartbeat count, writesdemo/circuit-breaker-snapshot.jsondemo/circuit-breaker-snapshot.json— committed snapshot from 73 live envelopes (Otto + Vera show active work; others healthy / no recent activity)demo/index.html—renderCircuitBreakerTab()is nowasync; triesfetch('./circuit-breaker-snapshot.json', {cache:'no-cache'})first, falls back tobuildCbMockData()on error or missing file — no visible regression when snapshot absentdocs/backlog/P1/B-0494-*.md— backlog row filed with pre-start checklistAcceptance criteria (B-0494)
tools/bus/export-cb-snapshot.tsexists and runs viabundemo/circuit-breaker-snapshot.jsoncommitted (generated from live bus)renderCircuitBreakerTab()tries snapshot first, falls back to mockdotnet build -c Release→ 0 warnings, 0 errorsbun tsc --noEmitcleanHow to refresh the snapshot
bun tools/bus/export-cb-snapshot.ts # → Wrote 5 entries (73 envelopes) → demo/circuit-breaker-snapshot.jsonRun, commit, push. Future slice: automate via CI or a scheduled script.
Decomposition note (slice-3)
Next: wire a live relay that GitHub Pages visitors can hit to get fresh data without a commit cycle. Tracked as future decomposition of B-0494 / B-0401.
Closes B-0494 slice-2. Parent: B-0435, B-0401.
🤖 Generated with Claude Code