ci(e2e): classify hosted-runner resource pressure and infrastructure loss
Parent epic: #7140
Related dependency: #7101 owns general secret-safe phase heartbeats and progress coverage across E2E targets. This issue owns accurate resource attribution, failure classification, and retry policy.
Problem
Current host-memory snapshots can make healthy Linux page cache look like memory exhaustion, while a GitHub-hosted VM can disappear before cleanup, logs, or artifacts identify the cause. Without cgroup, pressure, process, and Docker evidence, maintainers cannot reliably distinguish:
- application assertion failures;
- a process or container OOM kill;
- disk or inode exhaustion;
- a stalled Docker build; and
- hosted-runner infrastructure loss.
That uncertainty encourages broad retries, which can hide deterministic regressions.
Scope
- Extend the secret-safe heartbeat contract with accurate host measurements where available:
MemAvailable,Cached,SReclaimable, swap use, and load;- cgroup
memory.current, peak/limit,memory.events, and OOM/OOM-kill counters; - memory and I/O pressure stall information;
- top process RSS/PSS consumers;
- Docker container stats, image/build-cache usage, workspace free space, and inode availability; and
- kernel OOM evidence where the hosted environment permits access.
- Emit bounded snapshots before and after expensive image/install/rebuild phases and periodically while a phase is active.
- Produce a machine-readable terminal classification for ordinary failures: assertion, timeout, process OOM, container OOM, disk pressure, or unknown.
- Define workflow-level signatures for hosted-runner loss when the runner disappears before test cleanup can execute.
- Permit at most one retry only for confirmed infrastructure-loss signatures. Never retry assertions, deterministic command failures, policy violations, or classified OOM failures.
- Keep all streamed and uploaded evidence free of command payloads, credentials, tokens, and environment-variable values.
Acceptance criteria
- Low raw
MemFreealone is never classified as OOM. - Tests cover classification of application failure, timeout, cgroup OOM, disk exhaustion, runner loss, and ambiguous failure.
- An ordinary assertion receives zero automatic retries.
- A confirmed hosted-runner-loss result receives no more than one retry and links the two attempts for diagnosis.
- The original failure evidence remains available when a retry succeeds.
- Representative
rebuild-hermesand other heavy lanes emit enough evidence to identify the largest host/container memory consumers and Docker disk use. - The implementation interoperates with #7101 rather than creating a second progress-heartbeat framework.
Non-goals
- Increasing test timeouts.
- Retrying failures that lack a positive infrastructure-loss classification.
- Treating larger runners as a substitute for diagnostics.
will take a look.
Reopening is required based on live evidence from #7391's exact-SHA E2E run 29964501381.
Hermes security-posture job 89073364455 lost GitHub-hosted runner 1021276374 during phase 2/8. The log ended with “The runner has received a shutdown signal” followed by cancellation; there was no assertion failure, artifact upload, or cleanup.
The current #7168 detector did not classify or retry it because GitHub now reports this shutdown as a completed/failed job with one completed/cancelled live step and subsequent completed/skipped cleanup steps. The implementation only accepts the older shape where one step remains in_progress with a null conclusion. The coordination check therefore emitted no runner-loss policy or retry marker.
A second gap is that the existing marker merely permits a later CI event to replace the check; it does not automatically schedule the single retry required by this issue.
Follow-up work is being prepared to:
- recognize both strict GitHub-hosted shutdown API shapes without retrying assertions or ordinary cancellations; and
- dispatch one fresh, exact-identity replacement child automatically, preserve/link attempt 1, and make attempt 2 terminal.
Additional first-attempt evidence for the strict legacy runner-loss shape: run 29964500642 lost two separate ubuntu-latest runners within two seconds.
- Hermes security-posture: runner
1021276370, job 89073362734, failed at 23:50:13 UTC. cloud-onboard: runner1021276371, job 89073362742, failed at 23:50:11 UTC.
Both Jobs API records are completed/failure on runner group 0 / GitHub Actions, with one in_progress/null live step and only pending/null steps after it. GitHub annotated both as hosted-runner communication loss; neither produced a log blob. They failed after about 51 minutes, before the jobs' 75/70-minute workflow timeouts.
This case supports allowing one retry when every non-passing job has the strict hosted-loss shape, including multiple simultaneous lost runners. It must still reject mixed assertion, cancellation, timeout, self-hosted/custom-group, incomplete, duplicate-page, or rerun-attempt evidence.
Fresh exact-shape evidence from E2E run 29966893660:\n\n- PR: #7388\n- Job: Hermes security posture 89080333012\n- Runtime: 2026-07-22 23:42:06Z through 2026-07-23 00:32:11Z, about 50 minutes\n- Workflow and job conclusion: failure\n- Hosted identity: runner 1021280869, name GitHub Actions 1021280869, group 0 / GitHub Actions, label ubuntu-latest\n- Terminal Jobs API shape: the live Vitest step remains in_progress with a null conclusion; every later upload, cleanup, and post-action step remains pending with a null conclusion\n- Job log endpoint result: log not found\n\nThere is no failed assertion, completed timeout step, cleanup output, or downloadable log. This is another live example of the legacy hosted-runner-loss signature covered by the strict attempt-1 classifier. It should receive at most the one infrastructure retry proposed here; an ordinary failed step or mixed terminal evidence must remain non-retryable.
Safety refinement from the live Jobs and Checks APIs:
- Job 89073364455 has the terminalized shape discussed above: the live step is
completed/cancelled, cleanup is skipped, andComplete jobsucceeds. Its only failure annotation is the genericThe operation was canceled. - A job-level timeout can produce the same terminalized step shape. Therefore that shape, a shutdown line in the log, or a generic cancellation annotation is not sufficient positive infrastructure-loss evidence and will receive zero automatic retries.
- Jobs 89073362734 and 89080333012 carry GitHub's canonical hosted-runner-lost-communication failure annotation, bound to the exact workflow SHA and job/check identity. Those are the positive signals the one-time retry may accept.
The implementation is consequently stricter than the earlier proposal: it requires attempt 1, a completed failed workflow, standard GitHub-hosted runner identity, a recognized shutdown step shape, complete exact-run Jobs/Checks API identity, and exactly one canonical runner-loss failure annotation. It rejects generic cancellations, timeout/execution-limit annotations, mixed non-passing evidence, incomplete pagination, identity mismatches, and a second runner loss.
This deliberately trades some retry recall for the guarantee that deterministic failures and ordinary timeouts are never masked.
Okay Sir!
Fresh classification evidence from E2E run 29994589563, attempt 3:
- Four separate standard hosted runners disappeared mid-job with the same authenticated terminal sequence (
The runner has received a shutdown signalfollowed by cancellation), with no assertion, timeout, OOM, or disk failure: - The hosted Hermes inference-switch runner reported 0.1/15.6 GiB
MemAvailable, load 5.57, and 84.1 GiB disk free, then received the shutdown signal about 42 seconds later. - Low available memory alone was not sufficient to cause failure: Anthropic Hermes inference-switch reached the same 0.1 GiB available memory with load 32.46 and still passed and uploaded its artifact.
- The successful rebuild-hermes and stale-base rebuild explain the high usage. They ended with about 0.8 GiB available RAM, 7.8-8.0 GiB swap used, 12.7-12.9 GiB RSS in one anonymous host process, memory PSI full avg60 of 4.44%-6.13%, and I/O PSI full avg60 of 21.93%-28.12%. Docker containers themselves used only about 275 MB. All cgroup, kernel, and container OOM counters remained zero, disk retained about 52 GiB free, and both jobs passed.
- The rebuild log spent 180.7 seconds exporting image layers. This strongly suggests Docker/BuildKit image construction/export as the host-process pressure source, but the current secret-safe evidence intentionally omits executable names, so that attribution is not yet definitive.
Conclusion: Hermes image construction genuinely consumes nearly all physical RAM and roughly 8 GiB swap on the standard runner, supporting the controlled larger-runner experiment. It does not prove that OOM caused these four disappearances. The correct terminal class remains hosted-runner infrastructure loss, and low MemAvailable alone must remain non-authoritative.
One measurement gap also remains: the current five-minute phase threshold did not emit retained resource evidence before the agent-turn, MCP, and shields runners vanished. The non-duplicative follow-up should reuse #7100's existing timer, sample bounded numeric pressure evidence at a shorter fixed cadence, log each sample so the last one survives runner loss, and add only an allowlisted coarse largest-process class such as Docker/BuildKit, OpenShell, or other. It should build on #7399 rather than introduce another collector.
Runner-loss retry controller follow-up is implemented and pushed for review:
- Branch:
codex/7146-runner-loss-retry-linkage - Verified commit:
930be7338
The fix comes from a live controller failure, not a synthetic assumption. In controller run 30046092989, evidence verification authorized one retry for child 30046124587, but dispatch then failed because GitHub had rewritten the gate check details_url to the check self-link /runs/89331274272. The immutable canonical summary still linked the exact selected child.
The controller now recovers the selected run only from that strict canonical first-line binding and revalidates the exact repository, child ID, Actions app, external ID, head/base, current history, child/workflow correlation, job evidence, fingerprints, and PR state before dispatch. Cleanup accepts only an absent details URL or the exact self-link on the immediately succeeding canonical reservation. The classifier and one-retry policy are unchanged.
Validation on current main:
- all 13 PR-gate test files: 234/234 tests pass;
- full diff/pre-commit/pre-push/typecheck gates pass;
- independent security/logic review: no actionable findings;
- documentation review: no docs change required; and
- GitHub commit verification:
valid.
No PR is opened yet because this contributor currently has nine open PRs and repository guidance requires fewer than ten. The verified branch is ready to open when a slot becomes available.
Telemetry follow-up is now in PR #7457 at exact head 628d2e6d27d25c489cbe7b82c2bcbbe97aab8514.
This extends the canonical runner-comparison ledger with bounded v2 endpoint, periodic, phase, and final samples. It reuses the existing progress pulse, records only numeric/fixed-enum resource evidence, preserves v1 read compatibility, and does not change terminal classification or retry policy. It builds on #7100, #7213, #7399, and the three-shard common-egress-agent topology from #7448 rather than duplicating those paths.
Validation at the exact pushed head:
- all 10 commits are signed, DCO-compliant, and GitHub
Verified; - 225/225 serialized telemetry/progress/workflow tests passed across 15 files;
- 165/165 primary focused tests passed across 9 files;
npm run check:diff, documentation validation, and Markdown lint passed;- independent privacy/classifier/compatibility review found no actionable issues; and
- documentation review confirmed
test/e2e/README.mdmatches the implementation.
The broader E2E-support run’s remaining failures were parallel-load timeouts plus one macOS lifecycle baseline reproduced unchanged on origin/main; none were attributed to this change.
The earlier broad branch codex/7146-runner-loss-retry-linkage should not be opened as-is: merged #7450 already covers its selected-child binding and canonical source-check URL handling with stricter validation.
One residual cleanup gap was confirmed from live GitHub metadata. An active reserved PR-gate check, 89428967785, exposes details_url as its canonical self URL, while the post-reservation interruption cleanup on main accepted only a missing URL. That could strand the exact replacement check in progress after a lost create response.
The narrow non-duplicative fix is now in #7465:
- exact head:
010d84cc0, signed and GitHubVerified; - accepts only the immediately succeeding reservation's exact
/runs/<check-id>self URL, preserving all existing identity, history, state, title, and summary guards; - rejects a self URL naming a different check;
- 159/159 focused PR-gate tests and the full diff-scoped hook suite pass; and
- independent logic/security and documentation reviews found no follow-up.
This salvages only the unique cleanup behavior from the old branch and avoids duplicating or weakening #7450.