Skip to content

Fix the bench player on the lab minis and reject slow clock-probe bursts (851-3592) - #895

Merged
pondorasti merged 1 commit into
mainfrom
alexandru/851-3592-screen-sharing-v2-t3-black-box-instrument-sck-observer-clock-2
Oct 29, 2026
Merged

pondorasti merged 1 commit into
mainfrom
alexandru/851-3592-screen-sharing-v2-t3-black-box-instrument-sck-observer-clock-2

Conversation

@pondorasti

@pondorasti pondorasti commented Oct 29, 2026 •

Copy link
Copy Markdown
Member

Fixes 851-3592

Follow-up to #893, from the acceptance runs on the lab minis.

Player stall on the minis (affects T2's player and my windows).

  • The app launched with the .prohibited activation policy, so the activation open gives at launch was lost.
  • The player then set presentationOptions (hide the Dock and menu bar) while inactive. AppKit hides the whole app when that happens (NSApplicationDidHide), so the window vanished and the CAMetalDisplayLink stopped after 3 drawables (updates: 3, presentedOnGlass: 0).
  • Commands now declare presentsWindows. BenchLauncher.prepare parses the command before NSApplication.run, and BenchMain sets .regular for those and .prohibited for the rest, so an observer next to the player never takes its focus. The menu bar is hidden only once the app is active (BenchPresentation), and the barcode window sits at .screenSaver level.

C2 slow bursts. A 10-minute run had 4 of 300 bursts in which every probe queued: minimum RTT 2–3.7 ms against a 0.51 ms median. ε is the worst kept burst, so those four failed the run. BenchClockTrack now leaves out bursts whose round trip / 2 is over both twice the median and 0.25 ms, and reports rejectedBursts. C2 fails if more than 5% are rejected.

Smaller fixes.

  • C6's local_i2p_ms key now matches the report schema.
  • BenchLaunch is simpler.
  • A test checks that a clean run rejects no bursts.

Acceptance on the minis. M6, physical 1920×1080 @ 60 Hz displays, grants verified (Screen Recording, Accessibility, Local Network). CI state was recorded per run; numbers are per mini, croissant / tamale.

Check croissant tamale Pass
C1 |ΔPTS|, barcode-strip vs full-display observer, on player --scene video (30 s) p95 0 ms (1,882 versions, 0 unmatched) p95 0 ms (1,881, 0 unmatched) ≤ 16.7 ms ✅
C1 on the on-glass check (30 s) p95 0 ms (1,807) p95 0 ms (1,807) ✅
Observer's own CPU / power (observe, barcode strip, 60 versions/s content) 1.42% of one core, 2.1 mW 1.37%, 2.2 mW reported
On-glass estimate (851-3583 display-link target) − observer PTS. presentedTime is 0 on these displays (1,806/1,807 frames use displayLinkTarget) −0.54 ms p50, −0.50 ms p95 (max −0.50) −0.54 ms p50, −0.50 ms p95 reported
C6 local I2P floor, 200 CGEventPost key presses, own ScreenSharingMetalView window 45.7 ms p50, 50.5 p95, 76.8 max 45.3 p50, 50.4 p95, 64.7 max reported
C6 into player --scene input (T2's S7, CAMetalDisplayLink) 66.1 ms p50, 68.1 p95 64.5 p50, 68.3 p95 reported
C2, 10 min, tamale → croissant (in the workflow run) ε 0.344 ms, windowed residual 0.108 ms (single line 0.113), drift −0.23 ppm, 0/300 bursts rejected, 4,799/4,800 replies ε ≤ 0.5, residual ≤ 0.2 ✅

From a GitHub Actions job: Screen Sharing Bench Calibration run 40811596056, dispatched on this branch with this commit (e8952e1) installed on both minis, no other CI, load ≤ 2.5. Both jobs passed:

tamale croissant
C1 p95 0 ms (1,813) 0 ms (1,807)
On-glass estimate − observer PTS −0.54 / −0.50 ms (p50 / p95) −0.54 / −0.50 ms
Observer CPU 1.36% 1.39%
C6 floor (own window) 45.3 ms p50, 50.6 p95 45.4 ms p50, 50.4 p95
C2 (croissant probing tamale) ε 0.344 ms, residual 0.108 ms ✅

Finding: on these external displays, SCK delivers each frame about 14.7 ms before its PTS. PTS is the upcoming vsync, the on-glass time, which agrees with the −0.5 ms estimate error.

T2's acceptance (player S5/S3, R2 and R3 on a virtual display) passes on both minis; it's posted on 851-3591.

Verification

  • swift test for ScreenSharingBenchTests (50) and CodevisorBenchTests (4) pass. The pre-commit bun run check passed: Swift format, lint and tests. The first attempt timed out in an unrelated WebKit proxy test at load average 110; it passed on the retry.
  • Code review at level high: the valid findings are fixed (menu bar once active, policy decided only in the launcher, an absolute floor and a fail gate for rejected bursts, the schema key name).

🤖 Generated with Claude Code

…sts (851-3592)

The bench app launched with the prohibited activation policy, so the
activation `open` gives was lost; the player then set presentation
options while inactive, AppKit hid the app, and its display link
starved after three drawables. Commands now declare presentsWindows and
the launcher picks the policy before the app starts; the menu bar is
hidden only once active. C2 drops bursts whose every probe queued (over
twice the median round trip and 0.5 ms) and fails if more than 5% go.

Fixes 851-3592

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@pondorasti
pondorasti merged commit 2da6a13 into main Oct 29, 2026
2 checks passed
pondorasti added a commit that referenced this pull request Oct 29, 2026
…93) (#905)

#895 added `presentsWindows` to BenchCommand while #904 was in review, so
LoopbackCommand no longer conformed once both landed. Loopback presents
windows with --onscreen or the own-window source. Also schedule the barcode
verifier's drain from a method, so the tap callback doesn't capture a weak
self var across queues.

Part of 851-3593

Co-authored-by: Claude Opus 5.5 <[email protected]>
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