Skip to content

fix(android): a still screen's reset video waits for its key frame (#1762) - #1828

Merged
V3RON merged 4 commits into
mainfrom
bug/1762
Nov 24, 2026
Merged

V3RON merged 4 commits into
mainfrom
bug/1762

Conversation

@V3RON

@V3RON V3RON commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Closes #1762

Status

Implement: done Review: round 2 + 2 fix-checks passed, 0 open Hardware: pass at 5a2afb0 Gate: running
Next: gate

Done when

  • A still screen's reset video is written once, and not again until a key frame arrives (unit: session-body-and-close.test.ts, both the 4 s reset test and the 5 s-answer test). — both tests pass at 84f82ea (now the 3 s reset test, per the maintainer's decision); each fails with the re-arm restored, the constant changed or the write removed
  • Hardware: e2e/slow-android-stream.test.ts passes on a slow-lane emulator. — slow lane pass at 5a2afb0 (log simlock-slow-e2e-20261124-174823.log); the later commit only edits ADR text

Assumptions

none

Review

Spec review: 0 blocking, 0 fixed, 0 notes. Code review: 1 blocking, 0 fixed, 0 notes. Claims review: 2 blocking, 1 fixed, 0 notes.
Rounds: 2. Tokens: 1.9M.
Runs: 13. Cost USD: 2.5844. Agent seconds: 1253.

Rejected:

  • code: R1 [incorrect] a reset without an answer is never retried — scrcpy v5.0.1 keeps every reset it receives (bytecode of the vendored jar)
  • claims: R2 [incorrect] SurfaceEncoder.java:142 claim unverified — the jar bytecode confirms it

Assessment: complete

Written by an agent.

@coderabbitai

coderabbitai Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The Android screen session now sends a video reset after three seconds without a key frame. It does not send another reset while waiting for the requested key frame. Session tests cover reset timing, write failures, and delayed responses. The ADRs and test documentation now state the three-second interval.

Suggested reviewers: bheemreddy-samsara

Severity of issue fixed: Low

Merge Risk: Minimal · up to 84f82

A still Android screen now requests a key frame after 3 seconds and does not send repeated resets while waiting for the response. The tests and documentation reflect the new interval. No concrete merge-blocking risk remains.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: a still screen's reset video now waits for its key frame, as the fix for issue #1762. It matches the changeset, which limits pending resets to one at a time and shorte…
Description check Passed The description links issue #1762 and reports status, done-when checks, and test evidence for the reset-video change. It describes the changed test files, the 3-second reset interval, and the slow-lan…
Linked Issues check Passed Directly linked issue #1762 reports that the slow-lane still-screen test sometimes sees fewer than four key frames after the first 15 s. The issue asks for a fix to that flaky outcome. The diff at src…
Out of Scope Changes check Passed All changed files relate to the still-screen reset cadence. session.ts changes the reset interval and the re-arm behavior. session-body-and-close.test.ts covers those behaviors. e2e/slow-android-strea…
Full details: Title check

Explanation

The title names the main change: a still screen's reset video now waits for its key frame, as the fix for issue #1762. It matches the changeset, which limits pending resets to one at a time and shortens the reset interval.

Full details: Description check

Explanation

The description links issue #1762 and reports status, done-when checks, and test evidence for the reset-video change. It describes the changed test files, the 3-second reset interval, and the slow-lane hardware pass, so it relates directly to the changeset.

Full details: Linked Issues check

Explanation

Directly linked issue #1762 reports that the slow-lane still-screen test sometimes sees fewer than four key frames after the first 15 s. The issue asks for a fix to that flaky outcome. The diff at src/drivers/android/screen/session.ts lowers RESET_VIDEO_AFTER_MS from 4000 to 3000, so a reset is sent sooner and still lands inside the 5 s bound. The timer callback now clears #resetTimer instead of calling #armReset, so no further reset is sent until a key frame arrives. This matches the single-pending-reset behavior the PR describes. The e2e test keeps its 5.5 s gap bound. Unit tests in session-body-and-close.test.ts are reported to cover the 3 s reset, the re-arm, and the slow-answer case. I did not run them. The reported slow-lane hardware pass at 5a2afb0 is a self-reported result that I could not verify. The issue text does not prescribe an implementation, so the chosen approach satisfies it.

Full details: Out of Scope Changes check

Explanation

All changed files relate to the still-screen reset cadence. session.ts changes the reset interval and the re-arm behavior. session-body-and-close.test.ts covers those behaviors. e2e/slow-android-stream.test.ts updates its documented reset interval. AGENTS.md documents the one-pending-reset rule. ADR 0079 and ADR 0089 update the stated reset interval and its consequences, so they match the code. No unrelated change was found in the reviewed summary or in the session.ts diff.

  • 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.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: QUIET
  • Plan: Advanced
  • Run ID: b2e95921-b9f3-4c1d-a270-c048957b978c
Commits

Reviewing files that changed from the base of the PR and between 69613f7 and 84f82ea.

Files selected for processing: 6

  • docs/internal/adr/0079-one-capture-per-device-is-shared-by-every-viewer-and-every-capture-sends-a-key-frame-every-5-s.md
  • docs/internal/adr/0089-an-android-streams-scrcpy-command-line-stays-under-256-bytes.md
  • e2e/slow-android-stream.test.ts
  • src/drivers/android/screen/AGENTS.md
  • src/drivers/android/screen/session-body-and-close.test.ts
  • src/drivers/android/screen/session.ts

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.

@V3RON

V3RON commented Nov 24, 2026

Copy link
Copy Markdown
Contributor Author

Decision needed

The slow lane ran e2e/slow-android-stream.test.ts at 23f2d14: fail, on the 5.5 s key-frame check only.

key frame gaps in ms: 4516, 5999, 4638, 4369, 4140, 4082: expected 5999 to be less than or equal to 5500

The fix works: six key frames after the first 15 s (before: 1 or 2). But each gap is now the 4 s reset wait plus the emulator's answer (0.1–2 s here), so one gap reached 6.0 s. As asked on #1762, the run stops here instead of changing the e2e bound.

Options:

  1. Shorten the reset wait (RESET_VIDEO_AFTER_MS 4 s → 3 s). Keeps the e2e's 5.5 s bound and ADR 0079 §5's 5 s for answers under 2 s. Slightly more encoder restarts on a still screen. No test bound changes.
  2. Loosen the e2e bound to the wait plus the slowest answer (e.g. 6.5 s or more). No code change; ADR 0079 §5's 5 s bound is then missed on slow emulators, so the ADR text needs a change too.
  3. Something else.

The PR stays a draft until you pick.

Written by an agent.

@V3RON

V3RON commented Nov 24, 2026

Copy link
Copy Markdown
Contributor Author

Maintainer decision (2026-11-24): option 1. RESET_VIDEO_AFTER_MS goes from 4 s to 3 s; the e2e keeps its 5.5 s bound.

Written by an agent.

@V3RON

V3RON commented Nov 24, 2026

Copy link
Copy Markdown
Contributor Author

Review ledger

Round 1: 23f2d14
Round 2: 23f2d14
Round fix-check: 5a2afb0
Round fix-check: 84f82ea

Runs: 13. Cost USD: 2.5844. Agent seconds: 1253.
Tokens input 218, output 46954, cache read 4039822, cache write 524630.
- build implementer: claude-sonnet-5-5 77 s $0.1685
- audit implementer: claude-sonnet-5-5 40 s $0.1565
- review 1 reviewer: claude-sonnet-5-5 55 s $0.1836
- review 2 reviewer: claude-sonnet-5-5 263 s $0.1671
- review 2 spec: claude-sonnet-5-5 21 s $0.1218
- review 2 code behaviour+tests: claude-opus-5-5 196 s $0.798
- review 2 claims: claude-sonnet-5-5 30 s $0.1431
- hardware hardware-verifier: claude-sonnet-5-5 166 s $0.0911
- hardware-fix implementer: claude-sonnet-5-5 171 s $0.2288
- hardware hardware-verifier: claude-sonnet-5-5 136 s $0.0924
- review fix-check reviewer: claude-sonnet-5-5 42 s $0.1738
- fix fix-check implementer: claude-sonnet-5-5 25 s $0.1119
- review fix-check reviewer: claude-sonnet-5-5 31 s $0.1478
Finding outcomes: {"fixed":1,"incorrect":2}. Classes: {"liveness assumed, no reset retry":1,"scrcpy source claim unverified":1,"stale 4 s reset interval in ADRs":1}.
{"findings":[{"id":"R1","role":"code","class":"liveness assumed, no reset retry","outcome":"incorrect","path":"src/drivers/android/screen/session.ts","round":"1"},{"id":"R2","role":"claims","class":"scrcpy source claim unverified","outcome":"incorrect","path":"src/drivers/android/screen/session-body-and-close.test.ts","round":"2"},{"id":"R3","role":"claims","class":"stale 4 s reset interval in ADRs","outcome":"fixed","path":"docs/internal/adr/0089-an-android-streams-scrcpy-command-line-stays-under-256-bytes.md","round":"fix-check","fix":"84f82ea0b861b6b2f840fb2b74997f4ffdc80d7b"}]}

Written by an agent.

@V3RON
V3RON marked this pull request as ready for review November 24, 2026 16:54
@V3RON
V3RON merged commit 2601a0f into main Nov 24, 2026
56 checks passed
@V3RON
V3RON deleted the bug/1762 branch November 24, 2026 17:11
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.

flaky: slow-android-stream still-screen key frames stay fewer than 4 after the first 15 s on a slow-lane emulator

1 participant