Skip to content

fix(browser): bound oversized backfill conversations - #2823

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

Sinity merged 2 commits into
masterfrom
feature/fix/backfill-bridge-bounds

Conversation

@Sinity

@Sinity Sinity commented Jul 13, 2026 •

Copy link
Copy Markdown
Owner

Summary

Make ChatGPT conversation backfill survive oversized source responses without sending a full raw conversation through Chrome’s scripting-result bridge.

Problem

The paused ChatGPT backfill has four remaining retries; two failed at Chrome’s 32 MiB bridge. The provider endpoint returns a complete conversation mapping plus non-conversation metadata. The old page transport returned that raw JSON through chrome.scripting.executeScript, so the bridge—not provider auth or the daily policy—rejected the capture.

Solution

  • Read ChatGPT source in MAIN world with a hard 64 MiB source cap and create a bounded compact projection before returning to extension code. The compact result is limited to 24 MiB, with eight MiB headroom below Chrome’s 32 MiB ceiling.
  • Account for both the compact body and its conservative wrapped scripting-result representation; page-side or Chrome-side size errors contain an observable limit/reason and pause safely.
  • Preserve full native parsing only for full native payloads. A compact projection takes the envelope-turn parser route and carries native_compact plus capture:browser-native-compact, never a false native-full or DOM-fallback label.
  • Hold only oversized items with no automatic retry increment. Explicit Resume requeues held items; complete/unchanged items remain terminal and are neither fetched nor posted again.
  • Keep bearer/account credentials in MAIN world; other providers retain their existing generic 32 MiB response bound.

Acceptance criteria

Criterion Evidence
A 33–64 MiB ChatGPT source can complete when its compact projection fits the bridge MAIN-world source cap and declared-over-32 MiB transport regression
A valid compact conversation above 8 MiB is not held unnecessarily 9 MiB compact-projection regression
Inner, escaped wrapper, and browser-side bridge overages fail closed with reason/limit accounting 24 MiB boundary, escaped-wrapper, and executeScript rejection regressions
Compact artifacts parse through their explicit envelope-turn semantics, not as a partial full-native mapping Cross-language extension-envelope → Python browser-parser regression
Compact fidelity survives acknowledgement/retry bookkeeping coordinator ledger regression
Oversize holds neither consume retry attempts nor re-fetch/repost terminal captures; Resume requeues held work only coordinator/storage tests for memory and IndexedDB
Auth remains page-local and no foreground tab is activated MAIN-world transport/auth regression and existing inactive transport flow

Proposed Bead (not created)

The shared .beads/issues.jsonl is staged/owned by another publisher, so this PR records the proposed P1 instead of racing that state:

Recover oversized browser backfill captures through bounded MAIN-world projection

Scope: the acceptance criteria above and controlled operational verification of the four paused ChatGPT retries after an explicit extension reload. Non-goal: this PR does not reload the extension, resume the live job, mutate browser profiles, or alter daemon services.

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 20260713T043804Z-quick-1781436-c43168c3
  • Earlier branch baseline: npm test && npm run lint && npm run validate — 210 passed, lint clean, manifest valid

Anti-vacuity

The transport regression executes the production MAIN-world request function and proves a declared over-32 MiB source becomes a compact result rather than raw bridge data; removing the projection or source bound fails it. The browser-side size-rejection test drives the real background executeScript failure path into an operator hold. The cross-language regression gives a compact envelope a conflicting raw mapping and proves the Python parser uses the durable envelope turns and compact provenance instead.

@coderabbitai

coderabbitai Bot commented Jul 13, 2026 •

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: ef1adc4f-721b-45d4-9286-c243ce7f80da

📥 Commits

Reviewing files that changed from the base of the PR and between 2c65ccb and d0563c6.

📒 Files selected for processing (9)
  • browser-extension/src/backfill/coordinator.js
  • browser-extension/src/backfill/models.js
  • browser-extension/src/backfill/page_transport.js
  • browser-extension/src/backfill/providers.js
  • browser-extension/src/backfill/storage.js
  • browser-extension/src/popup.js
  • browser-extension/tests/backfill.test.js
  • browser-extension/tests/page_transport.test.js
  • browser-extension/tests/popup.test.js

📝 Walkthrough

Walkthrough

The backfill bridge now enforces separate ChatGPT response limits, compacts valid conversations, propagates capture fidelity, and handles oversized responses through a paused bridge_oversize queue state that can be explicitly resumed and is represented in the popup.

Changes

ChatGPT bridge backfill

Layer / File(s) Summary
Bounded ChatGPT projection
browser-extension/src/backfill/page_transport.js, browser-extension/tests/page_transport.test.js
Parameterized byte limits and structured errors bound provider responses; valid ChatGPT conversations are compacted and oversized projections fail closed.
Capture fidelity normalization
browser-extension/src/backfill/providers.js, browser-extension/src/backfill/coordinator.js, browser-extension/tests/backfill.test.js
Compact projections emit native_compact metadata, and receiver persistence retains the capture fidelity supplied by the capture payload.
Oversize queue lifecycle
browser-extension/src/backfill/coordinator.js, browser-extension/src/backfill/models.js, browser-extension/src/backfill/storage.js, browser-extension/tests/backfill.test.js
Bridge oversize errors pause jobs and mark items bridge_oversize; resume requeues them as eligible across memory and IndexedDB stores without consuming retry attempts.
Bridge hold UI
browser-extension/src/popup.js, browser-extension/tests/popup.test.js
The popup displays a bridge-limit status and diagnostic message, with explicit resume enabled for held work.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant ChatGPT
  participant PageTransport
  participant BackfillCoordinator
  participant BackfillStore
  participant Popup
  ChatGPT->>PageTransport: return conversation response
  PageTransport->>PageTransport: enforce limits and compact conversation
  PageTransport-->>BackfillCoordinator: return capture or bridge oversize error
  BackfillCoordinator->>BackfillStore: hold item and pause job
  BackfillStore-->>Popup: expose bridge cooldown state
  Popup->>BackfillCoordinator: request explicit resume
  BackfillCoordinator->>BackfillStore: requeue item as eligible
Loading
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/fix/backfill-bridge-bounds

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 added 2 commits July 13, 2026 06:23
Problem: full ChatGPT conversation mappings above the 32 MiB scripting\nbridge cap were treated as transport failures and retried without an\noperator-visible recovery path.\n\nWhat changed: compact bounded ChatGPT conversation projections inside MAIN\nworld, retain separate source and bridge limits, and hold any remaining\noversize item until explicit resume.\n\nCo-Authored-By: Claude <[email protected]>
The compact ChatGPT bridge payload must permit valid conversation text\nthat exceeds a conservative initial limit while remaining below Chrome's\n32 MiB scripting-result constraint.\n\nUse a 24 MiB compact projection bound with 8 MiB headroom and exercise\nboth a successful >8 MiB projection and the fail-closed upper bound.\n\nCo-Authored-By: Claude <[email protected]>
@Sinity
Sinity force-pushed the feature/fix/backfill-bridge-bounds branch from 2c8dfaa to d0563c6 Compare July 13, 2026 04:25
@Sinity
Sinity merged commit 8a1ee05 into master Jul 13, 2026
1 of 11 checks passed
@Sinity
Sinity deleted the feature/fix/backfill-bridge-bounds branch July 13, 2026 04:25

@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

Here are some automated review suggestions for this pull request.

Reviewed commit: 2c8dfaa05f

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

Sinity commented Sep 30, 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.

  • 51.F103 / P2: Fix and current-source recheck assigned to polylogue-dktc4; not claimed fixed. Exact capture correctly identifies the compact marker, but places capture_fidelity only in session.provider_meta (browser-extension/src/common.js:214,253), and the runtime returns that envelope directly. submitReceiver reads the absent top-level capture.provider_meta and defaults to native_full at browser-extension/src/backfill/coordinator.js:383, then copies that value into the completed queue item at line 405, so successful compact captures still receive a false full-fidelity ledger entry.
  • 51.F104 / P2: fixed-already at the checked revision: The MAIN-world error string survives providerPageFetch, and processItem now recognizes provider_contract_drift in the fetchNative catch before transport retry (browser-extension/src/background/runtime.js:2050; browser-extension/src/backfill/coordinator.js:327-338). It marks only the queue item failed with contract_drift and returns the job without pausing it as a repeated transport failure.

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