Skip to content

feat(video): VideoComponent tracks failed opens so the engine can give up - #77

Merged
apotema merged 1 commit into
mainfrom
feat/video-open-attempts
Sep 16, 2026
Merged

apotema merged 1 commit into
mainfrom
feat/video-open-attempts

Conversation

@apotema

@apotema apotema commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

Groundwork for labelle-engine#874.

renderVideos retries Video.open every frame with no limit, so a device whose decoder can never open the clip re-creates a decoder at frame rate and the component never finishes — a play-once intro hangs the boot on a blank screen (a MediaTek tablet: 359 decoder creations in 21 s at 40 % CPU).

Bounding the retry needs per-component state, which belongs next to handle and finished:

  • VideoComponent.open_attempts: u8 — system-managed, not authored.
  • MAX_OPEN_ATTEMPTS = 30 — enough frames for a backend that is merely warming up, far short of forever.
  • finished documents that it is also set when the clip could never be opened, so a consumer waiting on the end of a video is released either way.

The engine-side give-up is labelle-engine#874; that PR depends on this one.

🤖 Generated with Claude Code


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

…e up

A `VideoComponent` whose backend can never open the clip had nowhere to
record that: the video system retried the open every frame forever, so a
play-once intro never finished and a broken decoder was re-created at
frame rate (labelle-engine#874).

`open_attempts` is the system-managed counter and `MAX_OPEN_ATTEMPTS` the
budget: enough frames for a backend that is merely warming up (on Android
the asset manager isn't reachable until the activity is up), far short of
forever. The engine finishes the component when it runs out.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 16, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-16T19:45:50.368980Z 5e4d007 PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@coderabbitai

coderabbitai Bot commented Sep 16, 2026 •

Copy link
Copy Markdown

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Team

Run ID: 5701479d-44dc-41f1-95e5-d18d22223ddd

📥 Commits

Reviewing files that changed from the base of the PR and between 5425b7c and 5e4d007.

📒 Files selected for processing (2)
  • src/root.zig
  • src/video.zig

Included review availability: 7 reviews are currently available. Your included PR review attempts over the past 7 days set your current allowance at 10 reviews per hour.


📝 Walkthrough

Walkthrough

The video component now limits consecutive failed opens, tracks open attempts, and treats unopenable clips as finished. The root module re-exports the limit as VIDEO_MAX_OPEN_ATTEMPTS. A test verifies the counter starts at zero.

Changes

Video open limit

Layer / File(s) Summary
Video attempt limit and completion state
src/video.zig
Adds MAX_OPEN_ATTEMPTS with a value of 30, adds the open_attempts counter, updates finished semantics for unopenable clips, and tests the counter’s zero initialization.
Public video limit export
src/root.zig
Re-exports video.MAX_OPEN_ATTEMPTS as VIDEO_MAX_OPEN_ATTEMPTS.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Merge Risk: ⚪ Minimal · up to 5e4d0

No concrete merge-blocking behavior has been established for this change.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly states that VideoComponent tracks failed video opens so the engine can stop retrying indefinitely. This matches the main change.
Description check ✅ Passed The description directly explains the failed-open retry problem, the new open_attempts state, the retry limit, and the relationship to the engine-side change.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/video-open-attempts

Comment @coderabbitai help to get the list of available commands.

@apotema
apotema merged commit c07e609 into main Sep 16, 2026
4 checks passed
@apotema
apotema deleted the feat/video-open-attempts branch September 16, 2026 21:14
apotema added a commit that referenced this pull request Sep 16, 2026
One feature since v1.30.0, so a minor bump:

* #77 — `VideoComponent.open_attempts` (system-managed) and
  `MAX_OPEN_ATTEMPTS = 30`, exported as `VIDEO_MAX_OPEN_ATTEMPTS`. This is
  the per-component state labelle-engine#875 needs to stop retrying an open
  that keeps failing. `finished` now also documents that it is set when a
  clip could never be opened, so anything waiting on a video's end is
  released either way.

Additive only: a new field with a default and a new constant, and no
contract-version bumps.
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