Skip to content

fix(preview): prevent frame backlog and connection flicker - #938

Merged
nixuuu merged 1 commit into
devfrom
perf/preview-frame-sync
Nov 17, 2026
Merged

nixuuu merged 1 commit into
devfrom
perf/preview-frame-sync

Conversation

@nixuuu

@nixuuu nixuuu commented Nov 17, 2026

Copy link
Copy Markdown
Member

Change

Returning to an active thread can replay buffered Preview frames while its conversation catches up, and refreshing target metadata can briefly replace the image with Connecting. Keep subscriptions stable by comparing the actual target scope, retain the previous image until the next frame is decoded and drawn, and preserve automatic Preview when repairing a history checkpoint.

Web/desktop now acknowledges each frame after drawing it, so the existing worker pacing also bounds the path through BFF and the browser. Discarding an obsolete Desktop/Device target frame releases the replacement image. The additive RPC validates the owner, active grant, original worker link and delivered frame, including linked-computer routing. Existing clients retain stream-consumption acknowledgements; the new mode requires support on the linked home and does not change WorkerLink.

Update the automation, protocol and UI API documentation.

Verification

  • Passed 8 new integration tests for frame acknowledgements, heartbeat pacing, cancellation, validation, owner/grant checks, worker replacement, linked routing and an unsupported linked home, plus 14 existing Preview integration tests through check:tmp.
  • Passed gateway, web and integration-tests package typechecks, lint on edited source, scoped formatting and git diff --check. Regenerated protobuf contracts with bun run gen.
  • Checked real components in Chromium with a simulated stream: metadata refresh kept one subscription in mini and panel views; pausing drawing left at most one pending frame; delayed acknowledgements did not build a playback queue; thread return, minimize/restore and target replacement before decoding worked.
  • Checked light/dark at desktop and 390 px phone widths. Copy audit (§8): passed; existing labels and recovery text are retained, with refreshed long labels checked for truncation. No UI test suite or verification artifacts are included.
  • Full repository checks and builds remain for CI. A live external agent-browser session was not used for the browser verification.

Fixes: #846

@nixuuu
nixuuu enabled auto-merge (squash) November 17, 2026 19:10
@nixuuu
nixuuu merged commit 9fa4828 into dev Nov 17, 2026
15 checks passed
@nixuuu
nixuuu deleted the perf/preview-frame-sync branch November 17, 2026 19:17
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