Make app-host CI failures sticky and pipe-safe
Summary
First repair slice for #7471, #9348, #12180, and #13095.
Current-main census started from 3cc2087b0f75d8204e0b5a92476cedc53a891c32. The freshest full-suite main-adjacent run inspected was 35567420859 (2026-09-21): all six app-host shards failed and emitted 2/4/2/3/1/3 host restart markers respectively. Shard 5 also hit the existing 300-second Swift Testing allowance in BrowserDesignModeScreenshotEvaluatorTests.
This slice makes the harness preserve those failures instead of trying to turn them green:
- wrapper retries are allowed only before any XCTest/Swift Testing execution evidence;
- every wrapper invocation/attempt has a unique log + metadata record;
- every app-host invocation carries an explicit per-test execution allowance;
- each attempt can emit its own
.xcresultbundle; - broad shards capture xcodebuild to a regular file and stream it through an explicitly-owned tail process;
- focused app-host calls use the same file-backed capture model instead of
xcodebuild | tee; - the RemoteTmuxMirror crash rerun is removed, so a later passing invocation cannot erase an earlier crashed invocation;
- broad batches always classify zero-exit output, so zero matching tests remain red;
- SwiftPM recovery only retries when the failed execution contains no test-execution evidence;
- every failed app-host shard uploads logs, selector files, hang samples, xcresults, Ghostty
.ghosttycrashdata, and macOS DiagnosticReports before isolated-home cleanup.
Regression coverage
- classifier tests cover pre-test retry safety, XCTest/Swift Testing execution evidence, and zero-test summaries;
- wrapper test proves an assertion followed by a retryable test-runner communication error remains status 65 and never launches the later green attempt;
- new capture test leaves a detached writer alive for 60 seconds and proves the capture wrapper still returns immediately with the command's original status;
- workflow guard runs the new capture regression.
Follow-up slices
The known-main failure ratchet/census catalog and deterministic product/test fixes stay separate so this CI-truth patch can land independently.
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 later green attempt can no longer erase a real crash or hang. This is the first slice toward #7471, #9348, #12180, and #13095.
Retries
- Wrapper and SwiftPM retries now only run before any test-execution evidence; the RemoteTmuxMirror crash rerun is removed.
- Every attempt gets an explicit per-test timeout, its own log,
.metarecord, and.xcresultbundle, all keyed by the wrapper's parent PID.
Capture and diagnostics
- Replaces
xcodebuild | teewith file-backed capture plus an owned tail process in app-host and macOS e2e workflows; console-session launches enforce it automatically with per-invocation capture paths. - Detached test children can't hold the CI pipe open, and final output is drained exactly once.
- A workflow guard forbids reintroducing pipe-based capture for any app-host step.
- Typed test-results JSON is extracted beside each
.xcresult. - Zero-test summaries are classified as failures, and failed shards upload logs, xcresults, hang samples, and crash/diagnostic reports.
Summary by CodeRabbit
-
Bug Fixes
- Improved reliability of app-host and end-to-end test runs by preserving complete command output and exit statuses.
- Added safeguards against hanging test processes, with automatic timeout handling.
- Failed tests now retain clearer per-attempt logs and result diagnostics.
- Retries are limited to failures occurring before test execution; assertion failures and crashes remain failed without rerunning.
- Focused test suites now run once on successful or failed attempts, avoiding misleading reruns.
-
Tests
- Added validation to ensure CI workflows consistently capture and report test output.