Skip to content

fix(studio): a preview frame served while its page loads keeps Studio's paused-frame decoder - #8613

Merged
acheigh-heygen merged 3 commits into
mainfrom
fix/paused-frames-own-load
Nov 23, 2026
Merged

acheigh-heygen merged 3 commits into
mainfrom
fix/paused-frames-own-load

Conversation

@acheigh-heygen

@acheigh-heygen acheigh-heygen commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

What

A preview frame Studio serves paused video frames to while its page is still loading keeps that decoder host through the page's own load.

Why

servePausedVideoFrames closed its host on the iframe's next load. A shadow reload is served while its document is still interactive, once the runtime has announced itself. So that load is the same document finishing: the host closed and aborted the decode the frame had just asked for, and sent no reply. The runtime's preview seek then waited out SEEK_CAP_MS (5 s) before showing the frame. Every shadow reload in an app embedding Studio promoted about five seconds late.

It shows in HyperFrames Desktop since its pin moved to 0.9.86 (the provider path landed in 0.9.81, #8466). A clip edit's preview showed the new file ~6.5–9.5 s after the write instead of ~2 s, so Desktop's 6 s "Background removed from the clip" notice faded before the clip appeared. Traced in a Desktop walk: serve at readyState=interactive → decode ask 5 ms later → load 6 ms after that closes the host → data-hf-preview-seek-hold held for exactly 5 s.

A frame Studio cannot read (a sealed preview) still closes on its first load, as before; if it is served before that load it can still wait out the cap. No reported bug reaches that case, so it is left alone here.

No visible change

No .tsx, .css or .html changes, and nothing a still image can show: the change is when a reloaded preview appears, not what it looks like. Measured in a HyperFrames Desktop walk instead: after an edit, the reloaded preview's frame swapped in 5.0 s after it painted on 0.9.86 (data-hf-preview-seek-hold held for the full SEEK_CAP_MS), and ~0.3 s after with this change.

Related work

Refs #8466. Desktop carries this as a patch on @hyperframes/studio@0.9.86 until a release includes it.

How

  • closeOnNextDocument closes the host only once the frame holds a document other than the one served. A frame whose document Studio cannot read (a sealed preview) still closes on its next load, as before.

Test plan

  • Unit test added: pausedVideoProvider.serve.test.ts (a frame keeps being served through its own document's load and stops at the next document's). It fails without the fix and passes with it; the provider suites pass (14/14).
  • Manual testing: in HyperFrames Desktop with this change patched into Studio 0.9.86, a shadow reload promotes ~0.3 s after its frame paints instead of 5 s, and the clip-bar-remove-background walk passes.
  • Documentation updated (not applicable)
  • Comments follow CONTRIBUTING.md "Comments"

🤖 Generated with Claude Code

…'s paused-frame decoder

servePausedVideoFrames closed its decoder host on the frame's next `load`.
A shadow reload is served while its document is still `interactive`, so that
`load` is the same document finishing: the host closed, aborted the decode
already in flight without a reply, and the runtime's preview seek waited out
its five-second cap. Every shadow reload in an embedding app then promoted
about five seconds late.

The host now closes only once the frame holds a different document (a frame
Studio cannot read still closes on its next load), and a close answers every
ask in flight with `failed` so the runtime falls back to its own frames at once.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Edit accuracy: accurate 271 (base branch 271), smooth 44 of those

The gate passes.
Smoothness is reported in the artifact, not gated. A case fails only if it fails 2 of 3 runs.

Quarantined, measured but not gated (0)

acheigh-heygen and others added 2 commits November 23, 2026 19:51
Closing the host on the frame's next document is the fix. Answering in-flight
asks on close only helps a frame Studio cannot read, which no reported bug
reached; it goes, with its test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… said

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@jrusso1020 jrusso1020 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Approve at eb6dad2. The fix is small, targeted, and proven red-first.

What I checked

  • closeOnNextDocument keeps the paused-frame host through the load of the document it was served for, and closes it once the frame holds any other document. A frame whose document Studio can't read still closes on its first load, the same as before. close is idempotent (closed guard), so a host that the .then already closed and that load closes again is harmless.
  • Red first: I swapped in main's pausedVideoProvider.ts and ran the new pausedVideoProvider.serve.test.ts. It fails (expected false to be true on the same-document load). With the fix, the provider suites pass 3 files / 14 tests.
  • Non-blocking: resolveFramePlaybackAdapter serves again once previewEditingClient retires its client at that same load. So for one document there are now two hosts, the first idle until the next document closes it. Before this change, the first host closed at that load. Nothing leaks past the document's life, so this is fine as is.

Need ✅ (every shadow reload waited out the 5 s seek cap) · Size ✅ (one function, one test) · Reuse ✅ · Simpler ✅ · Structure ✅
Risk: low. It changes only when a served frame's host closes, and frames Studio can't read keep the old behavior.

— Rames (hf-review)

@acheigh-heygen
acheigh-heygen added this pull request to the merge queue Nov 23, 2026
Merged via the queue into main with commit 0a68549 Nov 23, 2026
134 of 135 checks passed
@acheigh-heygen
acheigh-heygen deleted the fix/paused-frames-own-load branch November 23, 2026 20:54
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