Skip to content

fix: stop overlapping background notary proofs - #421

Merged
Step7750 merged 3 commits into
masterfrom
fix/notary-background-overlap
Oct 20, 2026
Merged

Step7750 merged 3 commits into
masterfrom
fix/notary-background-overlap

Conversation

@Step7750

@Step7750 Step7750 commented Oct 16, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • Share a single in-flight trade status ping between the alarm, service worker wake-up, and page bridge triggers
  • Run one notary proof at a time
  • Wait for the offscreen document to be ready before sending it requests, and reset creation state if it fails
  • Use wss:// for the notary session WebSocket
  • Skip background notary proving on Chrome versions without the offscreen WORKERS reason
  • Add a test for the shared ping run

Ref CSF-2167


Note

Medium Risk
Changes concurrency and offscreen/notary session wiring for trade status and TLSN proofs; incorrect deduplication or readiness timing could miss updates or break proving on some browsers.

Overview
Prevents duplicate background work when alarms, service worker wake-ups, or other triggers overlap.

pingTradeStatus now deduplicates concurrent calls without a Steam ID into a single in-flight run, while calls that pass expectedSteamID (page bridge) still run independently so user-specific fetches are not skipped.

Notary proving is limited to one concurrent proof (down from two) because the offscreen document can close after a proof and abort other in-flight work. Background notary is disabled on Firefox and on Chrome builds missing chrome.offscreen.Reason.WORKERS.

Offscreen lifecycle: openOffscreenDocument uses a shared creation promise so parallel openers always wait for the offscreen_ready message before proceeding. The notary session client builds WebSocket URLs via toWebSocketUrl (wss://) for older Chrome that rejects http(s) in WebSocket.

Adds a unit test asserting shared vs independent pingTradeStatus behavior.

Reviewed by Cursor Bugbot for commit b0a15a4. Bugbot is set up for automated code reviews on this repo. Configure here.

- Share one pingTradeStatus run between the alarm, service worker wake-up, and page bridge
- Run one notary proof at a time so closing the offscreen document can't kill another proof
- Share the offscreen creation promise so callers wait for its message listener
- Use wss:// for the notary session socket, older Chrome rejects https://
- Skip background proving when the offscreen WORKERS reason is unsupported
@Step7750
Step7750 requested a review from GODrums October 16, 2026 23:46
Comment thread src/lib/alarms/csfloat_trade_pings.ts
@Step7750
Step7750 merged commit 51ec9c3 into master Oct 20, 2026
4 checks passed
@Step7750
Step7750 deleted the fix/notary-background-overlap branch October 20, 2026 19:15
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.

2 participants