Skip to content

feat(b-0494): circuit breaker viz — slice-2 live bus snapshot#3134

Merged
AceHack merged 3 commits into
mainfrom
feat/b-0494-circuit-breaker-live-bus-snapshot
May 14, 2026
Merged

feat(b-0494): circuit breaker viz — slice-2 live bus snapshot#3134
AceHack merged 3 commits into
mainfrom
feat/b-0494-circuit-breaker-live-bus-snapshot

Conversation

@AceHack
Copy link
Copy Markdown
Member

@AceHack AceHack commented May 14, 2026

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-cliotto), derives CLOSED/HALF_OPEN/OPEN state per agent 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 recent activity)
  • demo/index.htmlrenderCircuitBreakerTab() is now async; tries fetch('./circuit-breaker-snapshot.json', {cache:'no-cache'}) first, falls back to buildCbMockData() on error or missing file — no visible regression when snapshot absent
  • docs/backlog/P1/B-0494-*.md — backlog row filed with pre-start checklist

Acceptance criteria (B-0494)

  • tools/bus/export-cb-snapshot.ts exists and runs via bun
  • demo/circuit-breaker-snapshot.json committed (generated from live bus)
  • renderCircuitBreakerTab() tries snapshot first, falls back to mock
  • dotnet build -c Release → 0 warnings, 0 errors
  • bun tsc --noEmit clean

How to refresh the snapshot

bun tools/bus/export-cb-snapshot.ts
# → Wrote 5 entries (73 envelopes) → demo/circuit-breaker-snapshot.json

Run, 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

- 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>
Copilot AI review requested due to automatic review settings May 14, 2026 13:18
@AceHack AceHack enabled auto-merge (squash) May 14, 2026 13:18
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 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".

Comment thread tools/bus/export-cb-snapshot.ts Outdated
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

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.ts to read non-expired envelopes, normalise surface-tagged senders (e.g., otto-cliotto), 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 to buildCbMockData() 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.

Comment thread tools/bus/export-cb-snapshot.ts Outdated
Comment thread tools/bus/export-cb-snapshot.ts Outdated
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>
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 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".

Comment thread tools/bus/export-cb-snapshot.ts Outdated
Comment thread tools/bus/export-cb-snapshot.ts Outdated
… 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>
Copilot AI review requested due to automatic review settings May 14, 2026 13:31
@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.

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

Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.

@AceHack AceHack merged commit fc996db into main May 14, 2026
29 of 30 checks passed
@AceHack AceHack deleted the feat/b-0494-circuit-breaker-live-bus-snapshot branch May 14, 2026 13:34
AceHack added a commit that referenced this pull request May 16, 2026
…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>
AceHack added a commit that referenced this pull request May 16, 2026
…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>
AceHack added a commit that referenced this pull request May 16, 2026
…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>
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