ci: run tests-job xcodebuild in the console GUI session (fix testmanagerd on self-hosted minis)
Why
Diagnosis of the austin-mini testmanagerd failures: xcodebuild test needs testmanagerd's control service, which only exists in the console user's GUI (Aqua) login session bootstrap namespace. The tests job is the only macOS test job that runs xcodebuild with no session setup (unlike ui-regressions, which enables automation mode, and perf-activation, which launchctl asusers into the console session). So on a runner whose agent isn't itself in a logged-in GUI session, the control session never initiates (No such process, Timed out … initiating control session, Executed 0 tests).
What
- New
scripts/ci/run-in-console-session.sh: elevates a command into the logged-in console user's Aqua session vialaunchctl asuser. Guarded — if no real console user is logged in (/dev/consoleowned byroot) or passwordless sudo is unavailable, it falls back to the current bootstrap, i.e. exactly today's behavior. It forwards only env vars that are actually set (so it can't blank a downstream${VAR:-default}), and is a no-op on runners already in a session. - Wire it around the three app-host xcodebuild invocations in the
testsjob, and add the automation-mode enable stepui-regressionsalready uses.
Experiment value
The wrapper logs whether it found a logged-in console user, so the job output reports each runner's session state. If this job lands on an austin mini and the BrowserSystemProxyMirrorTests step (the one that was failing) now passes, that both fixes it and confirms a user is logged in. If it logs "No logged-in console user," that runner needs the machine-side fix (run the agent as the GUI user / log in and stay logged in).
Caveat
This rescues a runner where a console user is logged in but the agent runs outside that session. It cannot rescue a runner with no GUI login at all; that still needs the machine fix.
🤖 Generated with Claude Code
Need help on this PR? Tag /codesmith with what you need. Autofix is disabled.
Summary by cubic
Run macOS tests job xcodebuild steps in the console GUI session to restore testmanagerd control and stop 0-test runs on self-hosted minis. Also enable XCTest automation mode to match ui-regressions.
- Bug Fixes
- Add
scripts/ci/run-in-console-session.shto elevate commands into the logged-in console user vialaunchctl asuser; guarded fallback if no GUI login or no passwordless sudo; forwards only set env vars; logs session status. - Wrap all three app-host
xcodebuildcalls intestswith the new script. - Add an "Enable XCTest automation mode" step using
automationmodetool; warn when missing or sudo not available.
- Add
Summary by CodeRabbit
- Chores
- Improved CI/CD test execution on macOS by enabling XCTest automation mode when supported, with non-blocking warnings when not available.
- Updated macOS regression gates to run app hosting and simulator-related checks within the active logged-in console session to better match real user conditions.
- Ensured unit test runs use the same console-session execution approach for more consistent behavior.