Repository navigation
fix(browser-capture): deduplicate concurrent extension posts - #2785
Conversation
Problem: concurrent extension instances can submit an identical provider\nsnapshot to the same loopback spool without durable attribution or\nsemantic duplicate suppression.\n\nWhat changed: stamp capture posts with the service worker's persistent\ninstance id; ignore observer-only provenance in the dedup fingerprint;\nserialize spool writes with an OS file lock; and return attribution/dedup\nreceipts to the extension.\n\nCompatibility: existing capture envelopes remain valid; new response fields\nare additive.\n\nRef polylogue-3v1.1\n\nCo-Authored-By: Claude <[email protected]>
|
Warning Review limit reached
Next review available in: 3 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the 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 configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (10)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: dfff3e8092
ℹ️ 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".
Problem: mutable browser-capture snapshot JSON is not a byte-prefix\nstream, so its first raw entered quarantined byte-revision governance and\na later acquired replacement could never materialize.\n\nWhat changed: route single-session artifacts from the browser-capture\nwatch source into existing membership revision authority from their first\nobservation. The authority accepts only strict parsed-content growth while\nretaining every prior raw blob and its membership receipt.\n\nRef polylogue-57rp\nRef polylogue-5k5l\n\nCo-Authored-By: Claude <[email protected]>
Problem: concurrent backfill jobs carry observer-only identifiers in both top-level and session provider metadata. Including those values in the spool deduplication hash made identical provider snapshots overwrite the same artifact instead of taking the duplicate path. What changed: remove the job, queue, and extension-instance attribution fields from provider metadata only for the semantic deduplication fingerprint. Preserve any other backfill metadata and raw payload content. Ref polylogue-3v1.1 Co-Authored-By: Claude <[email protected]>
Problem: simultaneous capture messages during a cold MV3 service-worker\nstart could independently mint and post different instance identifiers.\n\nWhat changed: share the in-flight storage read/mint operation, retrying only\nafter that operation fails. Extend the browser-capture membership route proof\nwith a divergent stale replacement and remove a timestamp-tie-sensitive\nassertion.\n\nRef polylogue-3v1.1\nRef polylogue-57rp\n\nCo-Authored-By: Claude <[email protected]>
Exercise concurrent receiver delivery through the real live-batch processor and assert it materializes exactly one archived provider session. Ref polylogue-3v1.1 Co-Authored-By: Claude <[email protected]>
|
Adversarial self-review — iteration 1 Findings and fixes:
What survived scrutiny:
Verification: focused background test 23 passed; focused concurrent receiver-to-archive test 1 passed; focused browser-capture replacement test 1 passed; lint/type checks passed; pre-push |
Problem: the receiver accepted capture posts without an extension instance id, leaving a concurrent capture unauditable. Its cross-process flock contract was also unproven. What changed: reject unattributed POSTs while retaining offline artifact parse compatibility, and add independent-process spool coverage. Ref polylogue-3v1.1 Co-Authored-By: Claude <[email protected]>
|
Adversarial self-review — iteration 2 Findings and fixes:
What survived scrutiny:
Verification: 2-process daemon regression 2 passed; receiver contract 33 passed; token contract 7 passed; lint/type checks passed; pre-push |
|
Final acceptance matrix after adversarial fixpoint (iteration 3: no legitimate gaps found)
No Bead state was changed and this PR is not merged. |
…800,2781 2ilz (origin-interop, PR #2794), 3v1.1 (capture-hardening, PR #2785), and qqyg (hooks-capture, PR #2781) fully satisfied — closed. 9e5.16 (api-parity, PR #2782), 57rp/5k5l (capture-hardening, PR #2785), and 7fj (beads-ingest, PR #2800) partially satisfied — noted with disposition, left open. Co-Authored-By: Claude <[email protected]>
|
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. |
Summary
Harden the browser-capture path for concurrent extension instances and make replaced receiver snapshots materialize through typed membership authority.
Problem
Concurrent extensions could submit the same provider snapshot without durable attribution or semantic duplicate suppression. Backfill jobs added observer-only job, queue, and extension identifiers to provider metadata, making otherwise-identical posts evade that suppression. Separately, a replaced browser-capture JSON snapshot is not a byte-prefix successor, so generic raw-revision authority quarantined it instead of materializing newer acquired attachment bytes.
Solution
browser-capturewatch source through existing membership revision authority from their first observation. Strict message/event/attachment growth governs content changes; metadata-equivalent snapshots retain the existing timestamp-aware membership rule; every raw blob remains retained.Acceptance matrix
8c23ba218) supplied authenticated interpreter/sandbox acquisition and typed outcomes.Verification
nix develop --command devtools test tests/unit/daemon -k 'receiver or capture'— 38 passed.POLYLOGUE_PYTEST_BASETEMP_ROOT=/realm/tmp/polylogue-pytest nix develop --command devtools test tests/unit/daemon/test_browser_capture_instance_attribution.py— 1 passed.POLYLOGUE_PYTEST_BASETEMP_ROOT=/realm/tmp/polylogue-pytest nix develop --command devtools test tests/unit/sources/test_live_batch_support.py -k browser_capture_replacement_advances_membership_head_and_acquires_attachment— 1 passed.npm test -- --run tests/background.test.js— 23 passed.npm test -- --run tests/content/chatgpt.test.js tests/content/chatgpt_bridge.test.js— 34 passed.nix develop --command devtools test tests/unit/sources/test_browser_capture.py -k 'embedded_attachments_are_acquired_in_archive or native_payload_delegation_keeps_envelope_acquired_assets'— 2 passed.devtools verify --quick— all 15 gates passed (20260712T225848Z-quick-1752486-5ad29130).Adversarial review notes
436e9c012; added a divergent stale-snapshot route proof and corrected the membership wording. A further direct review finding that the spool test did not prove archive materialization landed in6deab55d7. The exact/live 57rp and parent 5k5l criteria remain explicitly deferred above.Anti-vacuity: the 57rp fixture calls
LiveBatchProcessor.ingest_filesagainst the production archive writer, then reads source/index database state. Removing the browser-capture membership route restores the old quarantined byte-revision behavior; removing ambiguity handling lets a divergent stale snapshot overwrite the accepted head. The concurrent-writer test invokeswrite_capture_envelopewith a synchronization barrier and distinct backfill job/queue/instance metadata, then runs the real live-batch processor; removing semantic deduplication, its attribution normalization, or the archival route breaks its receipt/artifact/session assertions. The background test drives two real runtime messages concurrently; removing the single-flight promise permits distinct cold-start identifiers and fails its one-id assertion.Ref polylogue-3v1.1
Ref polylogue-57rp
Ref polylogue-5k5l