Skip to content

feat(browser): operationalize canonical capture missions - #2926

Merged
Sinity merged 3 commits into
masterfrom
feature/browser/canonical-capture-mission-control
Jul 16, 2026
Merged

Sinity merged 3 commits into
masterfrom
feature/browser/canonical-capture-mission-control

Conversation

@Sinity

@Sinity Sinity commented Jul 16, 2026

Copy link
Copy Markdown
Owner

Summary

Makes browser-backed external work receiver-authoritative and observable: one
cross-profile submission lease, globally paced completion monitoring, canonical
closed-tab capture with output-byte validation, stable receiver pairing, and a
working mission-control/ambient status surface.

Problem

The live Sol campaign exposed several coupled failures. Submitted chats were
stranded by browser/profile turnover, one service worker read every submitted
conversation each minute, terminal captures often predated output assets, the
same conversation was read twice at completion, ambiguous submit failures
could become duplicates, stale receiver configuration rendered the popup inert,
and completed jobs could retain stale global cooldowns. The provider then
showed conversation-access protection / too many requests while the receiver
ledger falsely remained submitted.

Solution

  • Make the loopback receiver authoritative for submission/monitor leases,
    cadence, typed provider outcomes, submit-uncertainty quarantine, and handoff
    validation.
  • Give due submissions priority over monitoring while pacing authenticated
    monitor reads globally across all extension instances.
  • Use one extension-owned inactive provider transport and serialize its
    operations; operator tabs are never borrowed or activated.
  • Pass the already-read terminal/backfill native payload into ordinary canonical
    capture, then acquire and validate the exact output asset without a duplicate
    conversation read.
  • Generate readable collision-resistant per-job handoff filenames and require
    prompt/link/file-manifest self-checks; the context pack PROMPT.md is pinned
    byte-identical to the submitted prompt.
  • Bind receiver pairing to stable receiver identity/schema, retain offline
    snapshots, restore the popup execution path, and expose shared operator states
    in popup and isolated ambient surfaces.

Acceptance matrix

  • polylogue-jlme.6: satisfied by executable popup load-order tests, stable
    health/pairing, installed-extension proof, queue rendering, and live canonical
    recovery. Close after merge.
  • polylogue-yyvg.5: substantial foundation delivered; intentionally remains
    open for the provider-neutral mission protocol and automatic simplified UX.
  • polylogue-jlme.5: stable pairing/owned transport delivered; packaged
    two-authenticated-profile/canonical-failover proof remains open.
  • polylogue-5k5l: live sandbox byte acquisition is proven; file-service
    image/audio and remaining stated criteria remain open.
  • polylogue-yyvg.6: prompt/filename upstream hardening and durable protocol
    design are recorded; portfolio projection and incorporation automation remain
    open.

Verification

  • devtools test tests/unit/browser_capture/test_launch_jobs.py tests/unit/browser_capture/test_work_package.py tests/unit/browser_capture/test_receiver.py — 77 passed.
  • npm test — 296 passed across 14 files.
  • npm run lint — clean.
  • devtools verify --quick — all 16 steps passed; final pre-push run 20260716T043957Z-quick-3925811-1a487d27.
  • .agent/scripts/bd-graph-lint — no cycles; zero duplicate labels, horizon inversions, or missing ACs.
  • Five cold adversarial iterations found and drove fixes for global monitor pacing,
    launch starvation, typed auth errors, transport ownership, duplicate terminal
    reads, submit-boundary uncertainty, stale terminal cooldowns, and test gaps.
  • Live q32 proof: canonical artifact
    chatgpt/6a5830bc-0d94-83ed-8d4f-6136a748bc19-76bfadd9563a.json,
    63 turns, three attachments; output ZIP 81,240 bytes, 19 files, SHA-256
    7fa320242b2c6aa6a92e3eada4299e8355a8628eefc41cb4846327f1c6205080,
    byte-identical to the operator download.

Ref polylogue-yyvg.5.
Ref polylogue-jlme.6.
Ref polylogue-jlme.5.
Ref polylogue-5k5l.
Ref polylogue-yyvg.6.

Sinity and others added 3 commits July 16, 2026 06:39
Problem

External Chat work could be stranded after browser turnover, monitor every
submitted conversation in bursts, lose terminal output assets, or retry an
ambiguous submit boundary.

What changed

Make the receiver own submission and monitor leases, global pacing, typed
provider outcomes, terminal handoff reconciliation, and uncertainty
quarantine. Generate readable per-job deliverable names and keep the prompt
inside the deterministic context package byte-identical to the submitted
prompt.

Verification

devtools test tests/unit/browser_capture/test_launch_jobs.py
devtools test tests/unit/browser_capture/test_launch_jobs.py tests/unit/browser_capture/test_work_package.py tests/unit/browser_capture/test_receiver.py
devtools verify --quick

Ref polylogue-yyvg.5.
Ref polylogue-5k5l.
Ref polylogue-jlme.5.

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

The installed extension could silently run stale code, strand completion
monitoring in a browser profile, miss output assets after tabs closed, and
show an inert or misleading popup with no trustworthy receiver identity.

What changed

Use one extension-owned inactive authenticated transport, serialize provider
operations, reuse native terminal payloads for canonical capture, and route
ordinary/backfill/launched conversations through the same asset path. Add
stable receiver pairing, offline snapshots, typed operator states, ambient
in-page evidence, and an executable mission-control popup.

Verification

npm test (296 tests)
npm run lint
Packaged service-worker fixture exercises background capture without
foreground activation.
Live extension reloaded against receiver rx-e328a27cc0d16cfbac83.

Ref polylogue-jlme.6.
Ref polylogue-yyvg.5.
Ref polylogue-jlme.5.
Ref polylogue-5k5l.

Co-Authored-By: Claude <[email protected]>
Persist the capture incident receipts, Sol handoff integration state,
provider-neutral mission protocol follow-up, and honest residual scope for
receiver pairing, asset coverage, and portfolio automation.

Graph lint reports no dependency cycles, duplicate labels, horizon
inversions, or missing acceptance criteria.

Ref polylogue-yyvg.5.
Ref polylogue-yyvg.6.
Ref polylogue-jlme.5.
Ref polylogue-jlme.6.
Ref polylogue-5k5l.

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

coderabbitai Bot commented Jul 16, 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: 7e33a752-ea08-4375-bedc-0eaf89508606

📥 Commits

Reviewing files that changed from the base of the PR and between b6c78ad and ef2e25e.

📒 Files selected for processing (31)
  • .beads/issues.jsonl
  • browser-extension/README.md
  • browser-extension/manifest.json
  • browser-extension/src/backfill/coordinator.js
  • browser-extension/src/backfill/page_transport.js
  • browser-extension/src/background.js
  • browser-extension/src/content/ambient_surface.js
  • browser-extension/src/content/chatgpt.js
  • browser-extension/src/content/chatgpt_bridge.js
  • browser-extension/src/launch/chatgpt_launch.js
  • browser-extension/src/operator_status.js
  • browser-extension/src/popup.html
  • browser-extension/src/popup.js
  • browser-extension/tests/backfill.test.js
  • browser-extension/tests/background.test.js
  • browser-extension/tests/build.test.js
  • browser-extension/tests/chatgpt_launch.test.js
  • browser-extension/tests/content/ambient_surface.test.js
  • browser-extension/tests/content/chatgpt_bridge.test.js
  • browser-extension/tests/operator_status.test.js
  • browser-extension/tests/page_transport.test.js
  • browser-extension/tests/popup.test.js
  • polylogue/browser_capture/launch_jobs.py
  • polylogue/browser_capture/models.py
  • polylogue/browser_capture/receiver.py
  • polylogue/browser_capture/sol_pro_prompt.py
  • polylogue/browser_capture/work_package.py
  • polylogue/daemon/browser_capture.py
  • tests/unit/browser_capture/test_launch_jobs.py
  • tests/unit/browser_capture/test_receiver.py
  • tests/unit/browser_capture/test_work_package.py
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/browser/canonical-capture-mission-control

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 54e8911 into master Jul 16, 2026
2 checks passed
@Sinity
Sinity deleted the feature/browser/canonical-capture-mission-control branch July 16, 2026 04:41
Sinity added a commit that referenced this pull request Jul 16, 2026
## Summary

Closes `polylogue-jlme.6` after PR #2926 merged the complete popup
execution and receiver-health recovery.

## Problem

The Bead intentionally remained open until the implementation branch and
its live proof were durable on master.

## Solution

Record all five acceptance criteria as satisfied by merged commit
`54e8911b9`: executable popup load order, authenticated receiver
health/pairing, toolbar refresh, regression fixtures, and
installed-extension canonical recovery.

## Verification

- PR #2926 merged.
- Browser-extension suite: 296 passed; lint clean.
- Quick verification: all 16 steps passed.
- Beads graph lint: no dependency cycles; zero duplicate labels, horizon
inversions, or missing ACs.

Ref polylogue-jlme.6.

Co-authored-by: Claude <[email protected]>

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

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

await updateLaunchJob(job.job_id, ownerInstanceId, {

P2 Badge Stop updating a lease after capture reconciliation

When the exact capture contains the expected handoff bytes, posting it to /v1/browser-captures synchronously runs reconcile_launch_handoff_capture(), which marks the job completed (or paused for an invalid ZIP) and clears lease_owner. This subsequent updateLaunchJob() therefore always receives a lease-owner mismatch; its catch block attempts another update with the same stale owner, so the poll rejects and the successful handoff capture log is never written. Record the pending-acquisition phase before sending the canonical capture, or avoid further lease-owned updates once reconciliation has made the job terminal.

ℹ️ 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".

Sinity added a commit that referenced this pull request Jul 18, 2026
chatgpt-dom-v1 attachment byte acquisition (this branch, commit above)
closes the only remaining gap this bead scoped -- the general
chatgpt-native-v1 sandbox/file-service asset acquisition already
shipped in earlier PRs (#2669/#2672/#2712/#2926).

Hand-merged the one touched record from a fresh `bd export` rather
than copying the whole file: bd resolves its export target independent
of invocation cwd, so it also carries unrelated concurrent-session bead
activity that doesn't belong on this branch.

Co-Authored-By: Claude <[email protected]>
Sinity added a commit that referenced this pull request Jul 18, 2026
…e page bridge (#3075)

## Summary
Closes the last remaining gap in `polylogue-83u.3`: the `chatgpt-dom-v1`
DOM-scrape capture fallback now fetches attachment bytes through the
same authenticated page-bridge mechanism the native adapter already
uses, instead of recording only the chip name with `byte_count=0`.

## Problem
General ChatGPT attachment fetching already ships: `chatgpt_bridge.js`
(`fetchAssetBytes`) and `chatgpt.js`
(`acquireAssets`/`collectAssetDescriptors`) live-fetch
sandbox/file-service bytes for the normal `chatgpt-native-v1` capture
path (landed PR #2669, hardened #2672/#2712/#2926). The only remaining
gap is the older `chatgpt-dom-v1` fallback — used only when the
authenticated backend-api conversation read fails — which had **no
acquisition path at all**: `collectAttachments` recorded just the chip's
name.

## Architecture constraint
`chatgpt-dom-v1` has no backend-api `mapping` to resolve a file/sandbox
id from (unlike `chatgpt-native-v1`); the DOM chip's own `href`/`src` is
the only evidence available, and it is sometimes already a concrete
`https://` URL the page itself rendered (e.g. an inline `<img src>`).

## Solution
Added a `"url"` request kind to `chatgpt_bridge.js`'s `fetchAssetBytes`
that skips the metadata round trip entirely and reuses the **exact
same** fetch+budget+hash mechanism already proven for the
`sandbox`/`file` kinds (refactored the shared tail into
`fetchBytesFromResolvedUrl`), including the existing cross-origin
credential-drop rule (never forward page cookies/bearer to a
provider-issued or DOM-rendered cross-origin URL). `chatgpt.js`'s
`collectTurns` now awaits a new `acquireDomAttachmentBytes` step —
budget-bounded identically to the native path (same
per-file/total-byte/time/consecutive-failure caps) — that requests those
bytes and sets `inline_base64` on the DOM attachment. That is the exact
field `polylogue/sources/parsers/browser_capture.py` already decodes
into `ParsedAttachment.inline_bytes` for every adapter, so **no
receiver/parser change was needed** — `inline_base64` is not a new
payload field, just one `chatgpt-dom-v1` was never wired to populate.

Chips with no resolvable URL stay honestly `byte_count=0`.

## Consistency with polylogue-ptx
`polylogue-ptx` (PR #2928, merged) replaced the extension's
browser-action/campaign machinery with a provider-neutral
`BrowserAction` conduit. This change only extends the existing
content-script/bridge byte-fetch mechanism at its one documented gap; it
does not touch, duplicate, or compete with the `BrowserAction` conduit's
submit/receipt machinery.

## Verification
- `cd browser-extension && npx vitest run` → **329 passed** (1
pre-existing unrelated failure in `build.test.js`'s
packaged-service-worker backfill fixture — reproduces identically
without this change)
- `npx eslint src/ tests/` → clean
- `node scripts/validate-manifest.mjs` → ok
- New coverage: 5 focused `fetchAssetBytes` `"url"`-kind tests (direct
fetch, cross-origin credential drop, same-origin credential keep,
non-https rejection, byte-cap enforcement) plus 2 full-capture
DOM-fallback smoke tests (`chatgpt_bridge.test.js`) executing the real
production sources through a simulated authenticated page, proving a
`chatgpt-dom-v1` capture now yields `inline_base64` whose SHA-256
exactly matches the delivered bytes, and that a chip with no fetchable
URL stays honestly `byte_count=0`.

Ref polylogue-83u.3

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

---------

Co-authored-by: Claude <[email protected]>
@Sinity

Sinity commented Oct 1, 2026

Copy link
Copy Markdown
Owner Author

Historical Codex triage: evidence checked at 5ebcfe5. This records that source revision; it does not claim a fresh review of current master.

Only the rows listed above are dispositioned. Held findings remain open.

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