Repository navigation
Conversation
Owner
Author
|
Holding review: upstream PR #5160 is not yet approved. This stacked PR will be re-evaluated once the upstream lands an approval label. |
This was referenced Nov 18, 2026
A Codex shell command that misses its fleet-run allow rule (a redirection, a compound statement) runs inside Seatbelt, which denies the WindowServer lookup, so the engine discovers 0 display monitors. The shared display-readiness helper now asks the kernel first (sandbox_check on the com.apple.windowserver.active mach lookup) and blocks with a "sandboxed" condition before the wake, the caffeinate holder and the CoreGraphics probe, which aborts there. ir-run capture verbs, the verifier preflight and the fleet-jobs display profiles all inherit the stop through the helper: exit 69, with a line naming the sandbox and the bare-command remedy, which a decline quoting it classifies as sandbox. CODEX.md and the macOS setup guide describe the stop and the launch shapes that fall back into the sandbox. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
jakildev
force-pushed
the
claude/5159-macos-sandbox-display-stop
branch
from
November 26, 2026 08:31
a4e0c9f to
54e5f5a
Compare
Owner
Author
|
Merger: rebased onto current — fleet merger |
Contributor
|
Every failed workflow on this head is also red on master:
These failures are inherited and are not this pull request's to fix. |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
A Codex shell command that misses its
fleet-runallow rule (a redirection, a compound statement, anenv/VAR=prefix) runs inside Codex's Seatbelt sandbox. That sandbox denies the WindowServer lookup, so the engine discovers 0 display monitors. Both awake-display incidents on #5159 come from this.The shared display-readiness helper from #5144 (
scripts/fleet/fleet_display_session.py) now checks this first. Before the wake request, before anycaffeinateholder and before the CoreGraphics/AppKit probe (which aborts inside the sandbox), it asks the kernel:sandbox_check(getpid(), "mach-lookup", SANDBOX_FILTER_GLOBAL_NAME, "com.apple.windowserver.active"). If the lookup is denied, the newsandboxedcondition blocks the launch. The failure line names the sandbox and the remedy (launch the command bare and allow-listed, or usefleet-jobs start render-verify|light-verify|gui-verify, per CODEX.md).ir-runcapture verbs (RESULT=NO-DISPLAY, exit 69), the verifier preflight (ENV-FAIL, exit 69) and thefleet-jobsdisplay profiles (job failed with 69;startexits 69).sandboxand moves the target to another runtime. No new regex was needed.-1), a symbol that won't load, or a non-macOS host counts as "not sandboxed" and falls through to the existing path. Non-capture launches never reach the helper. A sandboxedIrredenEngineTestrun is unaffected.ir-runhelper CLI now prints thefailureline on exit 69, as the verifiers already did, so the remedy reachesir-run's stderr.FLEET_DISPLAY_SANDBOX(denied/allowed/error).fake_display.FakeDisplay.env()pins it toallowed, so the existing fleet: display-backed runs fail whenever the macOS display has idled to sleep #5144 arms keep their meaning when the suite itself runs inside a sandbox (plan correction 2). The fake probe now logs each call, so the denied arms can assert the probe never ran.docs/agents/CODEX.md§ "Capability qualification": the staleALIVE-TIMEOUTsentence is replaced by the pre-launch stop plus theNO-DISPLAY/69 backstop. Redirections, compound statements, subshells andcd … &&are added to the shapes that fall back into the sandbox.docs/AGENT_FLEET_SETUP.md§ "Display-backed runs on an unattended Mac" (fleet: display-backed runs fail whenever the macOS display has idled to sleep #5144's condition table) gets the sandbox condition, which is checked first and classifies as asandboxdecline rather than a host decline.Merge after #5160 (this is stacked on it).
Acceptance evidence
fleet-runstops before launch undercodex sandboxRESULT=NO-DISPLAY … exit=69, no engine log linerender-verifystops in its preflight undercodex sandbox[render-verify] ENV-FAIL: display unreachable: … sandbox …, rc=69fleet-rununsandboxed ends CLEAN with N ≥ 1 monitorsDiscovered 2 display monitors,RESULT=CLEAN, rc=0test_real_kernel_query_reads_a_windowserver_denying_sandbox: nosandbox-exec→ False;(allow default)→ False; WindowServer-deny profile → True. Run undersandbox-exec -p '(version 1)(allow default)'it reportsskipped 'this suite runs inside a sandbox; the profile cannot nest'test_no_display_env_fail.pydenied arm exits 69, says "sandbox", never calls the fakecaffeinateor probe; allowed / error / non-macOS unchangedpython3 scripts/tests/test_no_display_env_fail.py→Ran 24 tests … OK(new:test_sandbox_denial_is_no_display_before_wake_or_probe,test_sandbox_allowed_or_unanswered_keeps_the_wake_path,test_sandbox_denial_leaves_other_launches_alone,test_sandbox_denial_blocks_and_names_the_remedy,test_sandbox_denial_stops_the_verifier_before_the_wake)test_fleet_jobs.pydisplay profile under "denied" ends 69 before the verifier startspython3 scripts/fleet/tests/test_fleet_jobs.py→Ran 37 tests … OK (skipped=2)(new:DisplayHold.test_sandbox_denial_fails_the_job_before_the_wake_or_verifier)windowserver_deniedearly return deleted:test_no_display_env_fail.pyFAILED (failures=4, all sandbox arms);test_fleet_jobs.pysandbox arm FAIL;test_fleet_task_class.pysandbox-class arm FAIL ×3. Restored afterwardsNO-DISPLAY/69IrRunNoDisplayTest.test_persistent_zero_monitor_run_fast_fails_and_stops_childpasses in the 24-test runsandbox; decline suite passestest_fleet_task_class.py→Ran 151 tests … OK(new:test_sandboxed_display_stop_reads_as_sandbox, covering the ENV-FAIL,not started:andir-run:forms);bash scripts/fleet/tests/run_all.sh --only fleet_claim_decline→1 passed, 0 failedpython3 scripts/lint_instruction_refs.py --against origin/master→none new;ruff check scripts/→All checks passed!;git diff --check origin/master...HEAD→ clean;lint_instruction_size.py --against origin/master→ no introduced offendersAll three live runs were on this macOS host on AC power at 2026-11-18T05:17Z, using the plan's command:
codex sandbox -c 'sandbox_mode="workspace-write"' -c sandbox_workspace_write.network_access=true -c 'sandbox_workspace_write.writable_roots=[<worktree>, <its two git dirs>, ~/.fleet, ~/.cache/irreden, /tmp]' -- bash -c '…'.A —
scripts/fleet/fleet-run --timeout 60 IRShapeDebug --auto-screenshot 5, sandboxed (this branch)The same sandboxed command against master's
ir-runstill launched the engine and reproduced incident A's signature:Connection Invalid error for service com.apple.hiservices-xpcservice.,Discovered 0 display monitors, the_LSModifyNotificationfailure, thenir-run: RESULT=NO-DISPLAY exe=IRShapeDebug exit=69.B —
python3 scripts/render-verify.py --target IRShapeDebug --no-build, sandboxedC — control, the same
fleet-runrun unsandboxedOpen-PR overlap
fleet-pr-overlap --base claude/5144-macos-display-wake→VERDICT: overlap. The shared paths with #5160 are this PR's own upstream. The other two trial-merge clean:Plan departures
/usr/lib/libSystem.B.dylibexplicitly. The plan measuredsandbox_checkthrough ctypes without naming a library. The ctypes shape is the one the plan measured:argtypes = [c_int, c_char_p, c_int], with the service name passed as the extra variadic argument.scripts/fleet/fleet-run. The plan's command uses the barefleet-run. On PATH, that resolves through~/binto the main clone, which is master'sir-run. That run is the before transcript quoted under A.fleet-jobssupervisor still writes itsdisplay:discovery line before the hold. Inside the sandbox that line reads as a failed probe. The pre-existing line is left in place, and the sandbox stop runs right after it, before any wake or holder.Closes #5159
🤖 Generated with Claude Code