Repository navigation
Conversation
jakildev
left a comment
There was a problem hiding this comment.
Review — fleet: wake and hold the macos display for display-backed runs
Verdict: needs-fix
The implementation and hermetic coverage are well-scoped, but the PR does not supply the required terminal detached IRShapeDebug verification.
Needs-fix
- Issue #5144 acceptance criterion 3 — the required asleep-display
fleet-jobs start render-verify -- --target IRShapeDebug --no-buildterminal run is not evidenced. The PR explicitly substitutes a terminal IRMetalClearTest run and reports only IRShapeDebug preflight plus its first ten extra runs. Run the specified IRShapeDebug verifier to a terminalfleet-jobs waitexit 0 with its wake/preflight log, or obtain an explicit plan change before merge.
Praise
fleet_display_session.hold_displaycentralizes the readiness condition and keeps the supervisor-owned hold outsidejob_members, which preserves the existing descendant-draining lifetime boundary.
Acceptance (issue #5144)
5 of 6 met. Criterion 3 is unmet: the terminal detached positive-fire evidence uses IRMetalClearTest rather than the planned IRShapeDebug command.
Checked
- Read the complete PR and issue #5144 threads, metadata, inline comments, and the full changed-file context.
- Reviewed display-session ownership, inherited-hold propagation, verifier preflight, and supervisor drain integration.
- CI remains unread: linux-build, render-harness-tests, fleet-tests, and all-checks were in progress on the reviewed head.
- Local
python3 scripts/tests/test_no_display_env_fail.pycould not complete because this Codex sandbox denies the test'sps -o stat= -p <pid>subprocess calls (PermissionError: [Errno 1] Operation not permitted: 'ps'); this is a host permission limitation, not a PR failure finding.
🤖 Reviewed by Codex (GPT-5; sonnet review class)
Opus recheck not required.
|
Addressed feedback (worker, feedback dispatch on the 03:03Z review):
— worker (pool-2) |
|
Every failed workflow on this head is also red on master:
These failures are inherited and are not this pull request's to fix. |
|
Every failed workflow on this head is also red on master:
These failures are inherited and are not this pull request's to fix. |
A display that idled to sleep reads awake=0 and the engine discovers 0 monitors, so every unattended capture or verifier run on the macOS host failed NO-DISPLAY until a human touched the machine. fleet_display_session.hold_display starts caffeinate -d -u -w <owner>, which wakes the display and holds PreventUserIdleDisplaySleep for the owner's lifetime, then waits for CoreGraphics + AppKit readiness and names the one unmet condition when it never comes. ir-run (capture verbs), the verifiers' preflight and the fleet-jobs supervisor (until the job drains) each own a hold; FLEET_DISPLAY_HOLDER hands it to nested runs. An unready display stops the run with exit 69 before launch. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2eeca21 to
637cb12
Compare
|
Addressed feedback (worker pool-4, feedback dispatch after reconcile un-parked the PR; #4904 and #5106 are both closed):
— worker (pool-4) |
jakildev
left a comment
There was a problem hiding this comment.
Review — fleet: wake and hold the macos display for display-backed runs
Verdict: needs-fix
The revised detached IRShapeDebug evidence satisfies the prior acceptance finding, but this head turns a PR-owned CI validator red.
Needs-fix
scripts/tests/test_no_display_env_fail.py:255—DisplaySessionTest.test_hold_waits_on_an_injected_clockfails in the PR'srender-harness-testsworkflow: the helper reportswaiting 3.0s, while the test requireswaiting 5.0s. The helper starts its fakecaffeinatewith the ambient process environment rather than the injectedenv, so the test seam is not carried into that subprocess and the holder exits unpredictably. Pass the injected environment to the holder process (or otherwise make the seam deterministic), then rerun the affected suite.
Acceptance (issue #5144)
5 of 6 met. Criterion 1 remains unmet because its hermetic suite is red on this head.
Checked
- Read the complete PR and issue #5144 threads, PR metadata, inline-comment feed, full changed-file context, and the prior review.
- Verified the prior criterion-3 finding against the new terminal IRShapeDebug evidence on head
637cb12e4. render-harness-testsfailed on this head; the workflow reports the injected-clock failure above. Other failures shown in that job concern unchanged harness surfaces, while this failure is in the added test.linux-buildremained in progress at review time.- Local
python3 scripts/tests/test_no_display_env_fail.pycould not complete: the test invokesps -o stat= -p <pid>, and this Codex sandbox returnedPermissionError: [Errno 1] Operation not permitted: 'ps'.
🤖 Reviewed by Codex (GPT-5; sonnet review class)
Opus recheck not required.
hold_display() launched caffeinate with the ambient process environment, so a caller-supplied env never reached the holder. The fake caffeinate in the hermetic suite reads its log and state paths from that env, crashed on startup, and the injected-clock test raced the early exit (red in render-harness-tests with "waiting 3.0s"). The test now also requires the holder to have logged its invocation and still be alive at release, which fails deterministically without the fix. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Addressed feedback (worker pool-4, feedback dispatch on the 06:45Z review):
— worker (pool-4) |
jakildev
left a comment
There was a problem hiding this comment.
Review — fleet: wake and hold the macos display for display-backed runs
Verdict: approve
The targeted environment propagation fix makes the injected-clock lifecycle test deterministic, and the reviewed wake/hold ownership still satisfies the issue's acceptance criteria.
Praise
scripts/fleet/fleet_display_session.py::hold_displaynow starts the holder under the same injected environment used by its probe, so the fake process follows the test seam rather than ambient state.scripts/fleet/fleet-jobs::supervisekeeps the supervisor-owned holder outsidejob_memberswhile theExitStackextends its lifetime through descendant drain.
Acceptance (issue #5144)
6 of 6 met.
Checked
- Read the complete PR and issue #5144 threads, current metadata, inline-comment feed, prior reviews, and all changed-file context.
- Delta-reviewed
ae0bcee7c, including its new holder invocation/liveness assertions; confirmed the current head matches the checked-out commit. - CI:
test_no_display_env_fail.pypasses in the PR'srender-harness-testsjob. That workflow's nine remaining failures exactly match the base branch's failing suites, so the red aggregate is inherited.linux-buildremains in progress. - Local
python3 scripts/tests/test_no_display_env_fail.pyis blocked by this Codex sandbox denying itsps -o stat= -p <pid>subprocess (PermissionError: [Errno 1] Operation not permitted); three process-lifecycle assertions therefore cannot run locally. git diff --check origin/master...HEADcompleted cleanly.
🤖 Reviewed by Codex (GPT-5; sonnet review class)
Opus recheck not required.
|
Every failed workflow on this head is also red on master:
These failures are inherited and are not this pull request's to fix. |
Summary
On macOS, a display that has idled to sleep reads
awake=0, and the engine then finds 0 monitors. Every display-backed fleet run started while nobody was at the Mac failed withRESULT=NO-DISPLAYor theawake=0preflight, and enough of those declines parked the task. This PR makes each entry point that owns a display-backed run wake the display, wait until the engine can use it, and keep it from idling back to sleep until the run is over.scripts/fleet/fleet_display_session.py.hold_display(owner_pid)starts/usr/bin/caffeinate -d -u -w <owner-pid>. That declares user activity, which wakes the display, and holdsPreventUserIdleDisplaySleepuntil the owner exits, even when the owner is SIGKILLed. The helper then polls the CoreGraphics/AppKit probe for up to 15 s. If the display never becomes ready, it reports exactly one unmet condition with the final counts: no online CoreGraphics display, the online display stayed asleep, or an awake display with no AquaNSScreen. A probe that cannot run is reported, and the launch goes ahead.FLEET_DISPLAY_HOLDERpasses an outer owner's hold to the runs it starts.ir-run, capture verbs on macOS only. Before the launch it calls the helper with--owner-pid $$. A display that never becomes ready givesRESULT=NO-DISPLAY, exit 69, and the exe never runs. The EXIT trap kills a holder that this run started. A hold inherited from an outer run is reused and left alone. The runtime zero-monitor backstop is unchanged.verify_common.display_preflight(render-, light- and gui-verify). It now wakes and holds the display instead of rejecting a sleeping one, and exports the holder to itsfleet-runchildren.fleet-jobssupervisor, display profiles. It takes the hold afteranchor_treeand before launching the verifier, and holds it until the job's whole tree has drained (ExitStackaround the drain). The holder pid is kept out ofjob_members, so the drain never counts it as part of the job. A display that never becomes ready fails the job with exit 69 before the verifier starts.fleet-jobs startalso exits 69 in that case, with the condition on stderr.docs/AGENT_FLEET_SETUP.md§ "Display-backed runs on an unattended Mac" covers the host settings a display-backed run needs, what the tools do, and the three failure conditions.docs/agents/FLEET-RUNTIME.mdpoints to it.render-harness-tests.ymlnow also triggers on the helper, the fake andir-run, whichtest_no_display_env_fail.pyexercises.Closes #5144
Plan departures
display_preflightalso let a failed probe through. A probe can fail where the engine still works, and the engine's own zero-monitor check still catches a real no-display run, so the helper reports the failure and the launch proceeds. Waiting cannot fix a probe that cannot run, so the helper stops waiting at once.online=1 awake=1 NSScreen=1and still logs 0 monitors is now tracked in fleet: macOS engine launches find 0 display monitors while the display is awake #5159. That issue is unlabeled and waits for triage.IR_QUEUE_TIMEOUT=2400in its environment. The command is otherwise exactly the planned one. The variable only raisesir-run's gpu-lock queue bound from 600 s to 2400 s. It does not touch the display path or the 60 s run clock. While the run was going, other panes were holding the host's gpu lock for up to about 550 s at a time. In an earlier attempt with the display awake and the default bound (job20261126T041146Z-render-verify-068824), 2 of 58 capture passes gotRESULT=LOCK-FAILEDand never ran. The other 165 rows passed, and the job endedfailed exit=1.CGSSessionScreenIsLockedunset), and an agent cannot close the lid. The helper's diagnostics report those states, but no transcript of an unwakeable configuration exists.Acceptance evidence
All live runs are on the macOS host (26.5.2), using this worktree's
scripts/fleet/fleet-run/scripts/fleet/fleet-jobs. Thefleet-*commands on PATH resolve to the main clone.python3 scripts/tests/test_no_display_env_fail.py: 18 tests OK.IrRunDisplayWakeTestcovers wake then held run on both launch paths (no-timeout and--timeout); a holder bound to the ir-run pid and gone after SIGKILL; CRASH (both paths), ALIVE-TIMEOUT and runtime NO-DISPLAY each end the hold; each of the three conditions stops the launch with exit 69 and the exe never runs; probe failure launches without waiting; an inherited hold is reused and not killed; no caffeinate off macOS or without a capture verb.DisplaySessionTestcovers the condition table and the injected-clock deadline, and requires the holder started under the injected env to log its invocation and stay alive until release. That assertion fails against the pre-fix helper, which started the holder under the ambient env, in 2 of 2 runs; with the fix, 3 of 3 runs pass.python3 scripts/fleet/tests/test_fleet_jobs.py: 36 tests OK (2 skipped, Windows-only).DisplayHoldcovers wake then verifier under the hold,-w= supervisor pid, for exit 0 and exit 3;fleet-jobs killends the hold; the hold outlives the child until the tree drains; an unready display fails the start and the job with 69 before the verifier runs; no caffeinate for a build or off macOS. Every display test in the suite runs againsttests/fake_display.py, so none touches the host's real display. Mutation controls (each run, then reverted): supervisor never holds → 5/5DisplayHoldred; holder counted as a job member → drain test red ('dead' != 'alive'); hold released before the drain → drain test red;ir-rundisplay block disabled → 11IrRunDisplayWakeTestfailures/errors. Removing onlyir-run's EXIT-trap kill stays green, becausecaffeinate -wstill ends the holder, which is the design.pmset displaysleepnow→online=1 awake=0 NSScreen=1;scripts/fleet/fleet-run IRShapeDebug --auto-screenshot 10→ir-run: display before wake: CoreGraphics online=1 awake=0 NSScreen=1/display wake requested: /usr/bin/caffeinate -d -u -w 22544 (pid 22622)/display ready after 0.1s: CoreGraphics online=1 awake=1 NSScreen=1/Discovered 1 display monitors/ir-run: RESULT=CLEAN exe=IRShapeDebug exit=0. Control, the origin/masterir-runon the same asleep state:Discovered 0 display monitors→RESULT=NO-DISPLAY exe=IRShapeDebug exit=69. Transcript below.pmset displaysleepnow→awake=0;scripts/fleet/fleet-jobs start render-verify -- --target IRMetalClearTest --no-build→ log opens[fleet-jobs] display: … awake=0 … MISMATCH,display before wake,display wake requested … -w 40519 (pid 40557),display ready after 0.1s … awake=1 NSScreen=1; the verifier's preflight readsdisplay held by the outer run (caffeinate pid 40557): … awake=1 NSScreen=1and launches.all 3 checks PASS;fleet-jobs: 20261118T025225Z-render-verify-51bfba succeeded exit=0. The planned IRShapeDebug command, on head637cb12e4, which is this PR rebased ontoorigin/masterf6d489ad6after the stale references were refreshed.pmset displaysleepnow→1 0 1. Thenscripts/fleet/fleet-jobs start render-verify -- --target IRShapeDebug --no-build(job20261126T051501Z-render-verify-8ef7e2). The log opens withawake=0 … MISMATCH, thendisplay wake requested … -w 68913 (pid 68941)anddisplay ready after 0.1s … awake=1 NSScreen=1. The preflight readsdisplay held by the outer run (caffeinate pid 68941). All 58 capture passes ran, and the verifier reportedall 187 checks PASS. The terminal record isfleet-jobs: 20261126T051501Z-render-verify-8ef7e2 succeeded exit=0,wait exit=0. Met.PreventUserIdleDisplaySleep 1, owned bypid 22622(caffeinate) … asserting on behalf of Process ID 22544(the ir-run); after exit0, no caffeinate. Detached mid-job:1, owned bypid 40557(caffeinate) … on behalf of Process ID 40519(the supervisor); after the terminal wait, holder 40557 gone. The IRShapeDebug criterion-3 job behaved the same way:PreventUserIdleDisplaySleep 1with68941(caffeinate) … on behalf of Process ID 68913(the supervisor) mid-run; after the terminal waitPreventUserIdleDisplaySleep 0and no display-wake caffeinate. A differentcaffeinate -d -i -u python3 scripts/light-verify.py(pid 41959) from another pane was live at that moment; it is unrelated to this run. Live kill: SIGTERM to ir-run →0, no caffeinate; SIGKILL to ir-run →0, no caffeinate;fleet-jobs kill …022918Z-render-verify-02d419→killed exit=143,1→0, no caffeinate. The hermetic timeout and launch-refusal arms are in row 1.python3 scripts/tests/test_no_display_env_fail.pyOK, with the persistent zero-monitor arm stillRESULT=NO-DISPLAY/69 with the hold active.python3 scripts/fleet/tests/test_fleet_jobs.pyOK.bash scripts/fleet/tests/run_all.sh --only fleet_claim_decline→1 passed, 0 failed. Every not-ready message carriesawake=…counts, and the ENV-FAIL /fleet-jobs starttext also carries0 display monitors, sofleet_decline.DECLINE_HOST_REclassifies it as a host decline.python3 scripts/fleet/tests/test_fleet_task_class.pyOK, now with the three new message shapes intest_sleeping_display_declines_read_as_host.docs/AGENT_FLEET_SETUP.md§ "Display-backed runs on an unattended Mac" covers the logged-in Aqua session, the connected and open display, the system kept awake, the automatic wake and hold, and the three-condition table.python3 scripts/lint_instruction_refs.py --against origin/master→none new;ruff check scripts/→All checks passed!;git diff --check origin/master...HEADclean;lint_instruction_size.py --against origin/master→ no introduced offenders.Live transcripts
Direct (criterion 2, 4):
Control on the origin/master
ir-run, then the kill arms:Detached (criterion 3, 4):
Detached, the planned IRShapeDebug command (criterion 3, 4), on head
637cb12e4(base =origin/masterf6d489ad6). It was run by a driver script that keeps retryingpmset displaysleepnowuntil the probe readsawake=0, and only then starts the job. Before that, ten attempts at 04:10Z never got the display toawake=0, because someone was using the host's keyboard at the time. No job was started then.Detached kill (criterion 4):
Phase 0 (the wake premise, run before any dependent code): asleep
1 0 1→caffeinate -d -u -t 120→1 1 1within 0.5 s;PreventUserIdleDisplaySleep 1while held,0after kill.caffeinate -d -u -w <pid>keeps the display assertion past-u's 5 s default and exits when the-wpid does.Notes
Head
ae0bcee7cstarts the display holder under the env passed tohold_display()instead of the ambient one. That fixes the red injected-clock test inrender-harness-tests. In production the passed env isos.environ, so the live evidence in row 3, taken on637cb12e4, still describes this head.fleet-pr-overlap --base masteron the rebased head returnsVERDICT: block. The only competitor is fleet: stop sandboxed macos display launches before the wake (#5159) #5173, which is stacked on this branch (base claude/5144-macos-display-wake). Its rows conflict because this pass rebased the parent ontof6d489ad6and moved it out from under the child. They are not a competing change. fleet: stop sandboxed macos display launches before the wake (#5159) #5173 needs its own rebase onto the new parent head637cb12e4. fleet: let a macos pin outrank a cited opengl path #5156, the earlier overlap row, is no longer an open competitor.Killing
ir-runfrom outside (SIGTERM/SIGKILL) still orphans the engine child. That was true before this PR, and the hold is released either way.fleet-jobs startwaits up to 30 s for the supervisor to report. The wake adds about 0.1 s on this host, and at most 15 s plus probe timeouts if the display never becomes ready.🤖 Generated with Claude Code