Skip to content

fix(extension): add automatic capture circuit breaker - #2979

Merged
Sinity merged 1 commit into
masterfrom
feature/fix/capture-circuit-breaker
Jul 17, 2026
Merged

Sinity merged 1 commit into
masterfrom
feature/fix/capture-circuit-breaker

Conversation

@Sinity

@Sinity Sinity commented Jul 17, 2026

Copy link
Copy Markdown
Owner

Summary

Adds a persisted, reversible extension control that stops automatic provider capture and freshness traffic during an incident.

Problem

The prior incident required uninstalling the unpacked extension because the existing ambient toggle only hid UI. Automatic capture/freshness paths could still issue provider requests and a pending freshness alarm could revive work after a receiver fault.

Solution

The popup now exposes an Automatic capture and provider refresh breaker. It persists across worker restarts, gates automatic tab capture and freshness queues before provider traffic, clears the capture-freshness alarm while paused, and re-arms convergence on resume. Explicit popup sync remains available.

Ref polylogue-yyvg.6.1.

Verification

  • npm test -- --run tests/background.test.js tests/popup.test.js — 105 passed.
  • npm run lint — passed.
  • devtools verify --quick — 16/16 passed.
  • npm test — 317 passed; the pre-existing packaged-worker fixture failure reproduced unchanged.

Problem: disabling the ambient UI did not stop background provider capture.
During an incident the only available containment was removing the unpacked
extension, while queued freshness work could survive service-worker restarts.

What changed: persist a global automatic-capture breaker in extension
settings, expose it in the popup, gate automatic tab and freshness paths
before provider traffic, and clear the pending freshness wake while paused.
Explicit operator sync remains available.

Co-Authored-By: Claude <[email protected]>
@coderabbitai

coderabbitai Bot commented Jul 17, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@Sinity, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 53 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 168399cc-6ce9-4bc1-89fd-1ea784a85655

📥 Commits

Reviewing files that changed from the base of the PR and between d762eb4 and 14f2c43.

📒 Files selected for processing (5)
  • browser-extension/src/background.js
  • browser-extension/src/popup.html
  • browser-extension/src/popup.js
  • browser-extension/tests/background.test.js
  • browser-extension/tests/popup.test.js
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/fix/capture-circuit-breaker

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@Sinity
Sinity merged commit 211ce80 into master Jul 17, 2026
2 checks passed
@Sinity
Sinity deleted the feature/fix/capture-circuit-breaker branch July 17, 2026 07:23
Sinity added a commit that referenced this pull request Jul 18, 2026
…3098)

## Summary
Four commits closing AC gaps on the three P0 extension beads flagged by
the 2026-07-17 warroom It.17 sweep, all scoped to `browser-extension/` +
receiver code:

1. `polylogue-yyvg.6.1` AC1: a deterministic fixture proving no ChatGPT
conversation/attachment request occurs for a terminal conversation
across a receiver outage *combined with* a simulated service-worker
restart.
2. `polylogue-ptx` AC6: a static/contract test rejecting reintroduction
of the retired `BrowserPostCommand`/`BrowserLaunchJob` campaign
machinery or campaign-identity vocabulary.
3. `polylogue-ptx` AC7: receiver-side coverage of all six typed
pre-submit failure outcomes (the extension side already had it; the
receiver's identical state-machine branch did not).
4. `polylogue-yyvg.7`: a real (partial) slice of the exception-driven
popup redesign — a single-item `computeAttention()` surface plus a
pending-browser-action count, and progressive-disclosure diagnostics for
the previously always-visible machinery (receiver pairing/reset, work
queue, backfill panel, raw logs, receiver settings).

## Problem
All three beads had their core behavior land already (`yyvg.6.1` via
#2977/#2979/#2981/#2983/#2986; `ptx` via #2928; `yyvg.7`'s first UX
slice via #2928/#2929) but were left open pending explicit AC-by-AC
checks, and several AC clauses specifically wanted *fixtures*, *guards*,
or *UI surfaces* that didn't exist yet — see full AC-by-AC verdicts
recorded in each bead's notes (`polylogue-yyvg.6.1`, `polylogue-ptx`,
`polylogue-yyvg.7`).

## Solution
- `browser-extension/tests/background.test.js`: new fixture combining a
receiver outage with a simulated service-worker restart against a
terminal conversation.
- `tests/unit/architecture/test_browser_action_conduit_vocabulary.py`:
static scan over `polylogue/browser_capture/`,
`polylogue/daemon/browser_capture.py`, and `browser-extension/src/`.
- `tests/unit/browser_capture/test_actions.py`: parametrized
`test_typed_provider_failures_block_and_release_the_lease` over all six
receiver failure outcomes.
- `browser-extension/src/operator_status.js`: new `computeAttention()`
(strict single-item typed priority list: auth/pairing mismatch → action
`outcome_unknown` → capability mismatch → archive failure → null) and
`pendingBrowserActionCount()`, added to the existing shared status
module already used by ambient/message-layer/popup.
- `browser-extension/src/popup.html` + `popup.js`: a "Pending browser
actions" count and hidden-by-default "Attention" section under the
header; receiver pairing/reset, work queue, backfill panel, recent
capture log, debug log, and receiver settings now live inside one
collapsed `<details id="diagnostics">`. Clicking an attention item's
action opens diagnostics and drives the real underlying control (no
second authority copy).

**Honesty on scope**: commit 4 is explicitly a partial yyvg.7 slice, not
full closure — pixel-level mockup convergence, a compact bounded "Now"
summary, the "explicit submit/destructive approval" and "destructive
conflict" attention categories (no backing data model yet), a DOM/height
budget check, and the live installed proof all remain open. Recorded
honestly in the bead notes rather than claimed done.

## Verification
- `npx vitest run` (in `browser-extension/`) → 335 passed, 1
pre-existing unrelated failure (packaged service-worker backfill fixture
in `tests/build.test.js`; reproduced unchanged on a clean tree with this
branch's changes stashed out)
- `npm run lint` / `npm run validate` (in `browser-extension/`) → clean
/ manifest ok
- `devtools test
tests/unit/architecture/test_browser_action_conduit_vocabulary.py` → 1
passed
- `devtools test tests/unit/browser_capture/test_actions.py` → 18 passed
- `devtools verify --quick` (pre-push hook, all four pushes) → exit 0

Ref polylogue-yyvg.6.1, polylogue-ptx, polylogue-yyvg.7

---------

Co-authored-by: Claude <[email protected]>
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