Skip to content

fix(browser): recover bounded backfill captures safely - #2824

Merged
Sinity merged 5 commits into
masterfrom
feature/fix/backfill-bridge-recovery
Jul 13, 2026
Merged

Sinity merged 5 commits into
masterfrom
feature/fix/backfill-bridge-recovery

Conversation

@Sinity

@Sinity Sinity commented Jul 13, 2026 •

Copy link
Copy Markdown
Owner

Summary

Carry the post-merge safety fixes for bounded ChatGPT browser backfill capture that were identified during cold review of the already-merged bridge-limit PR.

Problem

The original bridge-limit implementation compacted oversized source responses, but cold review found four completion risks: compact envelopes could be interpreted as a partial full-native mapping; fidelity could be rewritten to native_full in durable receiver paths; Chrome’s outer scripting-result boundary was not explicitly accounted for; and a service-worker stop between queue hold and job pause could make the job appear complete. A malformed compact mapping also entered transport retry/backoff instead of failing only that item.

Solution

  • Route chatgpt-native-compact-v1 artifacts through the envelope-turn parser path and emit capture:browser-native-compact, rather than applying full-native ChatGPT parsing to a deliberately reduced mapping.
  • Preserve native_compact through acknowledgement, retry, and empty outcomes.
  • Bound the conservative full scripting-result shape, classify browser-side size rejections as bridge holds, and retain exact/available accounting.
  • Repair a persisted bridge hold before an awakened worker schedules, fetches, or evaluates terminal completion.
  • Treat malformed compact mappings as per-item contract_drift, preserving zero transport retries and allowing later queue items to complete.

Acceptance criteria

Criterion Evidence
Compact capture never claims full-native parser semantics Cross-language parser regression selects envelope turns and compact ingest flag
Compact fidelity persists in the queue ledger acknowledgement regression
Inner, wrapped, and browser-rejected bridge overages are held without retry churn transport/background regressions
Crash between durable hold and pause cannot complete or fetch the job restart guard regression with zero provider calls
Malformed compact source fails one item and does not block remaining work bad+good queue regression

Verification

  • npm test -- --run tests/page_transport.test.js tests/backfill.test.js tests/popup.test.js tests/background.test.js — 125 passed
  • npm run lint — clean
  • npm run validate — manifest ok
  • devtools test tests/unit/sources/test_browser_capture.py -k compact_chatgpt_projection_uses_envelope_turns — 1 passed, 32 deselected
  • Pre-push devtools verify --quick — success; run 20260713T044243Z-quick-1788143-981c83d8

Anti-vacuity

The parser regression supplies a compact marker plus a conflicting raw mapping and proves the durable envelope turns win. The bridge-hold restart test persists the exact intermediate state then wakes a worker and asserts it performs no provider request. The contract-drift test processes a malformed item followed by a valid one and asserts the latter completes without a transport breaker.

Sinity added 5 commits July 13, 2026 06:40
A service worker can stop between recording a bridge-sized capture and\npausing its job. Detect that durable hold before scheduling, fetching, or\nterminal completion and restore the operator-action pause.\n\nCo-Authored-By: Claude <[email protected]>
A malformed compact ChatGPT response is a provider contract failure for one\nqueue item, not a transport outage. Preserve that distinction and allow the\nremaining backfill queue to proceed.\n\nCo-Authored-By: Claude <[email protected]>
Capture fidelity is part of the durable backfill provenance. Preserve the\ncompact designation through acknowledgement, receiver retry, contract pause,\nand native-empty outcomes instead of restating native_full.\n\nCo-Authored-By: Claude <[email protected]>
Route bounded ChatGPT bridge projections through the envelope-turn parser\npath with explicit compact-native provenance, rather than treating the\nreduced mapping as a full native payload.\n\nAccount for the complete scripting result, classify browser-side size\nrejections without retry churn, and preserve the compact designation in\nthe backfill ledger.\n\nCo-Authored-By: Claude <[email protected]>
Expose the compact capture provenance flag from the browser parser module\nso strict type checking recognizes the cross-language parser contract.\n\nCo-Authored-By: Claude <[email protected]>
@coderabbitai

coderabbitai Bot commented Jul 13, 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: 41 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: 50465ce3-aa21-4430-83ba-5ddc79fa40c2

📥 Commits

Reviewing files that changed from the base of the PR and between 9ee34a3 and 6d1560d.

📒 Files selected for processing (9)
  • browser-extension/src/backfill/coordinator.js
  • browser-extension/src/backfill/page_transport.js
  • browser-extension/src/background.js
  • browser-extension/tests/backfill.test.js
  • browser-extension/tests/background.test.js
  • browser-extension/tests/page_transport.test.js
  • polylogue/archive/ingest_flags.py
  • polylogue/sources/parsers/browser_capture.py
  • tests/unit/sources/test_browser_capture.py
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/fix/backfill-bridge-recovery

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 cf30eea into master Jul 13, 2026
4 of 18 checks passed
@Sinity
Sinity deleted the feature/fix/backfill-bridge-recovery branch July 13, 2026 04:47
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