Make app-host CI failures sticky and pipe-safe (current main)
Summary
Rebased replacement for #13377 onto current main at 7ad603e3673ba388dd4b8c7e518b449bc5ab4061.
This is the first repair slice for #7471, #9348, #12180, and #13095. It makes app-host CI preserve real failures and bound hangs before the known-main failure ratchet is added.
Failure accounting
- wrapper retries are allowed only before any XCTest/Swift Testing execution evidence;
- an earlier assertion/crash/timeout remains red even if a later invocation could pass;
- every invocation/attempt gets distinct log + metadata identity;
- zero matching tests remain a failure;
- SwiftPM recovery only retries when tests never started.
Hangs
- every app-host console launch crosses a regular-file capture boundary;
- detached tmux/SSH/test descendants inherit the regular file rather than the Actions stdout pipe;
- the capture helper streams live output through an explicitly-owned follower and drains final bytes exactly once;
- broad batches retain a hard batch timeout and record unfinished-test starts + app-host samples;
- every app-host xcodebuild invocation carries an explicit per-test execution allowance, preserving caller overrides.
Diagnostics
- per-attempt
.xcresultbundles and typedxcresulttoolsummaries/tests are retained; - failed shards upload app-host logs, metadata, selector files, hang samples, Ghostty crash reports, macOS DiagnosticReports, and xcresults;
- diagnostic identities include shard/tag/attempt and focused selectors through metadata.
Current-main topology
Current main extracted guard checks into .github/workflows/ci-guards.yml. This rebase preserves that split: runtime changes remain in ci.yml, and pipe-safety validation runs from ci-guards.yml.
Evidence
The predecessor #13377 exposed the pre-ratchet state instead of masking it: its latest full-suite run had all six app-host shards red. That is expected until the known-main census/ratchet slice lands. Its earlier review finding about direct app-host calls bypassing capture is addressed here at the common run-in-console-session.sh boundary.
Follow-up slices
- reproducible current-main bundle enumeration + failure census;
- shrinking known-main ratchet for XCTest + Swift Testing;
- focused deterministic product/test-fixture repairs with red-before/green-after evidence.
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.
Summary by cubic
Makes app-host CI failures sticky and pipe-safe so a passing rerun can no longer erase a real crash, and detached test processes can't keep a job alive.
Behavior changes
- App-host wrapper retries only when the failure happened before any test execution; an assertion, crash, or timeout on any attempt keeps the shard red.
- Every app-host launch writes to a regular capture file with a separately-owned live tail, so detached tmux/SSH/test descendants can't hold the Actions pipe open, and cancellations forward to the whole command group with a bounded cleanup wait.
- Each invocation gets distinct log, metadata, and per-attempt
xcresultidentity, withxcresultcapture preserved across the console-session hop; failed or cancelled shards upload logs, crash reports, and hang samples. - Zero matching tests remains a failure, and the SwiftPM resolution retry runs only when tests never started.
Summary by CodeRabbit
-
CI Improvements
- Improved CI output capture to preserve logs, exit statuses, and output from detached processes.
- Added clearer timeout handling and diagnostics for app-host and end-to-end test runs.
- CI failures now retain relevant logs, test results, crash reports, and other diagnostic artifacts.
- Retries are limited to failures occurring before test execution; crashes and test failures remain terminal.
- Added explicit test execution timeouts to app-host test runs.
-
Tests
- Added validation for output capture, retry behavior, timeout handling, and failure diagnostics.