Skip to content

fix(breaker): make circuit breaker notices one-way - #723

Open
HsienW wants to merge 1 commit into
HarnessMD:mainfrom
HsienW:fix/breaker-one-way-notice
Open

HsienW wants to merge 1 commit into
HarnessMD:mainfrom
HsienW:fix/breaker-one-way-notice

Conversation

@HsienW

@HsienW HsienW commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

What & why

Circuit breaker steer and constrain messages use act: 'request', which defaults to requiring a reply, but breaker has no agent inbox to receive one. This change explicitly sets requires_reply: false and tells agents to contact god rather than reply to breaker, while preserving normal request behavior. Notice send failures are logged with the original error and agent context, show a failure notification instead of the normal constrained notification, and do not prevent later decisions from running.

Addresses #441, item 3 only. This does not address work progress detection or token retry activity, and does not change Hive routing, JSON parsing, or breaker policy.

Failed sends are not automatically retried because a message may already have been partially delivered.

Type of change

  • Bug fix
  • New feature
  • Refactor / cleanup
  • Docs
  • Build / CI

Evidence

Before

A local fixture using the real HiveManager reproduces the original breaker call shape from 2c64612, with requires_reply omitted. Both steer and constrain messages require replies. A normal agent request also requires a reply.

This reproduces the original call behavior using the current Hive implementation. It is not a capture from checking out and running the old application.

2026-10-09-222626

After

Using the same fixture, sendBreakerNotice() produces steer and constrain messages with requires_reply: false. The normal agent request still has requires_reply: true.

These captures verify the message contract. They do not claim that an agent can no longer choose to reply to breaker.

2026-10-09-222654

How I tested it

  • OS: Windows, using PowerShell.
  • Steps:
    1. Ran the local evidence helper in before and after modes against real Hive fixtures.
    2. Ran the dedicated regression tests shown below. All 10 tests passed.
    3. Ran the broader targeted regression command below. All 20 reported tests passed.
    4. Ran npm run typecheck and git diff --check. Both passed.

Dedicated regression tests:

node --test --test-reporter=spec test/hive-breaker-notice.test.cjs
2026-10-09-231108

Broader targeted regression tests:

node --test test/hive-breaker-notice.test.cjs test/hive-unknown-recipient.test.cjs test/hive-malformed-outbox.test.cjs test/breaker.test.cjs

Coverage includes both notice types, normal reply defaults, explicit overrides, terminal handoff, missing reasons, and send failures. Failure tests verify that the original error is logged once, later sends and stop decisions still execute, a log write failure does not hide the send error, and partially delivered messages are not retried.

The tests do not launch Electron or an agent CLI.

Full validation is still pending. An earlier npm run test:focused run reported 25 failures, and the full suite has not been rerun after the latest changes. Those failures have not all been established as baseline issues. An earlier build succeeded, but npm run build has not been rerun after the latest changes.

Checklist

  • Before and after evidence is attached above, under both headings.
  • npm run typecheck passes.
  • npm run test:focused passes.
  • npm run build succeeds.
  • This PR is one change. Unrelated fixes belong in their own PR.
  • I read the diff myself before opening this, and there is no debug output, commented-out code, or unrelated formatting churn in it.
  • Any new UI derives from DESIGN.md / tokens.ts. No custom colors, spacing, or fonts were added; failure notifications reuse the existing notification helper.
  • If I added art, it's my own or compatibly licensed, and listed in ATTRIBUTION.md. Not applicable: no art was added.

- Set requires_reply to false for breaker steer and constrain notices,
and direct agents to contact god instead of replying to breaker.

- Isolate notice send failures so later decisions can continue.
Log the original error with action and agent context, and show a
failure notification instead of the normal constrained notification.
Do not retry potentially partially delivered messages.

- Add regression coverage for reply defaults, terminal handoff,
failure reporting, subsequent stop execution, and partial delivery.

This branch has not been deployed

No deployments
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.

1 participant