You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If a second browser viewer fails to join a live stream, Orca now removes that failed viewer. The working viewer stays connected, and closing the last working viewer stops the native stream.
What Changed
Shared screencast joins register their subscriber before configuring the native viewport and frame budget. A rejected native update previously escaped without removing that subscriber. The caller never received its stop handle, so the failed join could retain its sender, newest frame, 50 ms retry timer and native-stream ownership indefinitely.
Route configuration failures through the existing subscriber leave path. A reconnect replaces its previous socket only after configuration succeeds, and only retires subscriptions older than itself. Both completion orders of overlapping reconnects preserve the newest viewer.
Why
One rejected join left one unreachable owner. A pre-ready sender rejects delivery, and ghost eviction deliberately excludes viewers that have never received a frame. Closing every successful viewer therefore could leave native capture and publication leases running. The unchanged-base reproduction recorded three failed-sender calls over 100 ms (initial fan-out plus retry ticks).
The existing leave path already cancels pending retries, restores the surviving viewport/budget, resolves subscriber completion and stops an empty native stream. Reusing it keeps ownership in one place.
Linked Issue
N/A — focused internal Electron lifetime audit.
Visual Proof
Before: the three new failure regressions fail against unchanged production at 5237d52f82: the failed distinct-device sender receives later frames, same-device replacement masks a restart failure, and a failed last joiner keeps the native stream alive.
After: Linux Electron 43.8.1 hidden-webview fault injection sends two real Page.startScreencast calls with an invalid format to Chromium. Both native errors reach the caller, the healthy viewer continues receiving actual PNG frames, and neither failed sender receives later attempts. The last successful leave sends exactly one Page.stopScreencast, detaches the debugger and restores both throttling leases. All window presentation/focus methods throw in this harness.
Playwright CDP screenshot of the hidden renderer after the failures:
PNG decoded from the actual binary screencast (pixel at 100,350 verified as BGRA [70,130,30,255]):
The native harness exercises the production runtime/native stream with injected Chromium rejection; it is not a full mobile or SSH interaction recording.
Testing
I manually tested these changes locally
Automated tests added/updated, or explained why not below
Focused runtime/native suites: 55 tests passed in 5 files, including both overlapping-reconnect completion orders, retry/fan-out, native stream lifecycle and renderer publication leases.
Native Linux hidden-renderer proof described above; screenshot inspected through Playwright CDP. Own native apps exited 0 and Playwright session closed; shared isolated display retained.
After rebasing onto main (including perf(browser): throttle idle guests between active operations #34776 idle guest throttling), branch-native pnpm check:changed --maxWorkers=1 passed 20/20 checks in 1602.7 s. An earlier --maxWorkers=2 attempt under host load (load average ~80) timed out only in the unchanged replaced-pane-handle-recovery.test.ts source census.
Renderer publication throttle leases belong to the native stream: they are acquired once when the stream starts and released once when it finishes. A failed join or a same-device replacement therefore never holds its own lease. The failed-last-joiner regression now asserts that the guest lease is restored exactly once.
Packaged-app builds and other-platform coverage are left to CI. Native proof bundle compiled against the production source.
Review
Agent skill upstream boundary
Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.
Notes
No RPC schema, platform path, shell, shortcut or workspace-kind change. Paired-device reconnects use the existing subscriber identity. Remote/mixed-version compatibility and folder workspaces remain unchanged. macOS, Windows, actual SSH and mobile hardware were not exercised. Counts demonstrate ownership and teardown; no CPU, memory, GPU or battery measurement is claimed.
Checklist
This PR is small and focused
I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
Before/after screenshots or videos attached for UI changes, or N/A with reason
Self-reviewed for correctness, security, and performance
Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.
Walkthrough
For an existing browser screencast stream, viewport-owner and shared frame-budget updates now run before earlier subscribers for the same paired device are removed. If an update fails, the joining subscriber is removed and the error is rethrown. Tests cover failed reconnects, replacement stream creation, and reconnects that complete in different orders.
Priority: Normal
Merge Risk: Minimal · up to f65f2
Failed joins and overlapping reconnects have no established regression that would prevent merging after normal checks.
Pre-merge checks: 4 · 1
Failed checks: 1 warning
Check name
Status
Explanation
Resolution
Description check
The description is detailed and covers the required change, rationale, testing, visual proof, review notes, and checklist. However, the required Linked Issue section contains “N/A” instead of an actua…
Add the actual linked issue using the required issue reference format. If the author is a maintainer, attach a pre-existing issue as permitted by the template; otherwise, create or link the issue addressed by this PR.
Passed checks: 4 passed
Check name
Status
Explanation
Title check
The title clearly and concisely describes the primary change: releasing resources when shared screencast joins fail.
Docstring Coverage
No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage
Explanation
No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 0 functions across 2 files.
Full details: Description check
Explanation
The description is detailed and covers the required change, rationale, testing, visual proof, review notes, and checklist. However, the required Linked Issue section contains “N/A” instead of an actual issue reference.
Resolution
Add the actual linked issue using the required issue reference format. If the author is a maintainer, attach a pre-existing issue as permitted by the template; otherwise, create or link the issue addressed by this PR.
Finishing Touches
📝 Generate docstrings
Commit to this branch
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ELI5
If a second browser viewer fails to join a live stream, Orca now removes that failed viewer. The working viewer stays connected, and closing the last working viewer stops the native stream.
What Changed
Shared screencast joins register their subscriber before configuring the native viewport and frame budget. A rejected native update previously escaped without removing that subscriber. The caller never received its stop handle, so the failed join could retain its sender, newest frame, 50 ms retry timer and native-stream ownership indefinitely.
Route configuration failures through the existing subscriber leave path. A reconnect replaces its previous socket only after configuration succeeds, and only retires subscriptions older than itself. Both completion orders of overlapping reconnects preserve the newest viewer.
Why
One rejected join left one unreachable owner. A pre-ready sender rejects delivery, and ghost eviction deliberately excludes viewers that have never received a frame. Closing every successful viewer therefore could leave native capture and publication leases running. The unchanged-base reproduction recorded three failed-sender calls over 100 ms (initial fan-out plus retry ticks).
The existing leave path already cancels pending retries, restores the surviving viewport/budget, resolves subscriber completion and stops an empty native stream. Reusing it keeps ownership in one place.
Linked Issue
N/A — focused internal Electron lifetime audit.
Visual Proof
Before: the three new failure regressions fail against unchanged production at
5237d52f82: the failed distinct-device sender receives later frames, same-device replacement masks a restart failure, and a failed last joiner keeps the native stream alive.After: Linux Electron 43.8.1 hidden-webview fault injection sends two real
Page.startScreencastcalls with an invalid format to Chromium. Both native errors reach the caller, the healthy viewer continues receiving actual PNG frames, and neither failed sender receives later attempts. The last successful leave sends exactly onePage.stopScreencast, detaches the debugger and restores both throttling leases. All window presentation/focus methods throw in this harness.Playwright CDP screenshot of the hidden renderer after the failures:
PNG decoded from the actual binary screencast (pixel at 100,350 verified as BGRA
[70,130,30,255]):The native harness exercises the production runtime/native stream with injected Chromium rejection; it is not a full mobile or SSH interaction recording.
Testing
I manually tested these changes locally
Automated tests added/updated, or explained why not below
Unchanged-base failure controls: 3 failed / 3 passed; production source automatically restored afterward.
Focused runtime/native suites: 55 tests passed in 5 files, including both overlapping-reconnect completion orders, retry/fan-out, native stream lifecycle and renderer publication leases.
Native Linux hidden-renderer proof described above; screenshot inspected through Playwright CDP. Own native apps exited 0 and Playwright session closed; shared isolated display retained.
After rebasing onto
main(including perf(browser): throttle idle guests between active operations #34776 idle guest throttling), branch-nativepnpm check:changed --maxWorkers=1passed 20/20 checks in 1602.7 s. An earlier--maxWorkers=2attempt under host load (load average ~80) timed out only in the unchangedreplaced-pane-handle-recovery.test.tssource census.Renderer publication throttle leases belong to the native stream: they are acquired once when the stream starts and released once when it finishes. A failed join or a same-device replacement therefore never holds its own lease. The failed-last-joiner regression now asserts that the guest lease is restored exactly once.
Packaged-app builds and other-platform coverage are left to CI. Native proof bundle compiled against the production source.
Review
Agent skill upstream boundary
Notes
No RPC schema, platform path, shell, shortcut or workspace-kind change. Paired-device reconnects use the existing subscriber identity. Remote/mixed-version compatibility and folder workspaces remain unchanged. macOS, Windows, actual SSH and mobile hardware were not exercised. Counts demonstrate ownership and teardown; no CPU, memory, GPU or battery measurement is claimed.
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)