Skip to content

fix: coalesce pending session replay captures per window - #764

Merged
marandaneto merged 1 commit into
mainfrom
fix/replay-capture-coalescing
Sep 7, 2026
Merged

fix: coalesce pending session replay captures per window#764
marandaneto merged 1 commit into
mainfrom
fix/replay-capture-coalescing

Conversation

@marandaneto

@marandaneto marandaneto commented Sep 7, 2026

Copy link
Copy Markdown
Member

💡 Motivation and Context

Session replay can keep submitting draw-triggered captures while its worker waits up to one second for PixelCopy. This queues redundant work for the same window.

Allow only one queued or running capture per window. Native draw requests and wrapper-driven snapshots share the same check. Duplicate requests are skipped, and the next draw or wrapper tick can retry. Other windows can still schedule captures.

Keep the window busy after a PixelCopy timeout until its callback finishes. Draw-time mask verification still runs on every draw. Capture failures and rejected submissions release the pending task, while stop and session resets do not release unfinished work.

This keeps the existing synchronous worker wait. It does not convert capture to callback-driven completion.

💚 How did you test it?

  • Reproduced 100 queued tasks from 100 draw requests before the fix. The regression test now verifies that only one task is queued.
  • Added tests for independent windows, running captures, rejected submissions, task failures, wrapper result callbacks, stop/uninstall, and PixelCopy callbacks that finish after a timeout.
  • make test: 356 tests passed and 3 skipped.
  • make checkFormat and git diff --check passed.
  • Autoreview of cec2221d against origin/main reported no actionable findings.

📝 Checklist

  • I reviewed the submitted code.
  • I added tests to verify the changes.
  • I updated the docs if needed.
  • No breaking change or entry added to the changelog.

If releasing new changes

  • Ran pnpm changeset to generate a changeset file

🤖 Agent context

Autonomy: Human-driven (agent-assisted)

Implemented with Pi using Git, Gradle, Changesets, and the isolated autoreview helper. The requested scope was to skip redundant captures per window without replacing the PixelCopy wait. The callback is tracked separately so a timeout cannot allow another capture while the previous callback is still running. Human review is required.

@marandaneto marandaneto self-assigned this Sep 7, 2026
@marandaneto
marandaneto marked this pull request as ready for review September 7, 2026 07:42
@marandaneto
marandaneto requested a review from a team as a code owner September 7, 2026 07:42
@marandaneto

Copy link
Copy Markdown
Member Author

quick follow up for #761

@greptile-apps

greptile-apps Bot commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Reviews (1): Last reviewed commit: "fix: coalesce pending session replay cap..." | Re-trigger Greptile

@dustinbyrne dustinbyrne left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The per-window capture gate preserves draw-time privacy observation, eligibility checks and teardown. No material issues found in the implementation or applicable SDK contracts.

@marandaneto
marandaneto merged commit 456f790 into main Sep 7, 2026
17 checks passed
@marandaneto
marandaneto deleted the fix/replay-capture-coalescing branch September 7, 2026 19:26
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