Skip to content

ci(e2e): retry final-main hosted runner loss#7392

Closed
prekshivyas wants to merge 9 commits into
mainfrom
codex/e2e-main-runner-loss-retry-v2
Closed

ci(e2e): retry final-main hosted runner loss#7392
prekshivyas wants to merge 9 commits into
mainfrom
codex/e2e-main-runner-loss-retry-v2

Conversation

@prekshivyas

@prekshivyas prekshivyas commented Jul 22, 2026

Copy link
Copy Markdown
Collaborator

Summary

Final-main E2E runs currently remain red when GitHub loses hosted runners, even when every failed job has the confirmed stranded-step signature. This change adds a separate trusted controller that reruns failed jobs once for that exact infrastructure-loss case while leaving assertions, timeouts, mixed failures, cancelled runs, and later attempts untouched.

Related Issue

Addresses #7140, proposed direction item 5; this does not close the larger epic. It extends the classification and retry policy delivered by #7168 for #7146 from the PR gate to final-main E2E runs.

Changes

  • Add a default-branch workflow_run controller for completed scheduled or full-manual E2E main runs. A separate controller is required because the subject E2E run cannot rerun itself before its own terminal jobs complete.
  • Authenticate the repository, workflow path and title, event, branch, head repository, tested SHA ancestry, run ID, and first-attempt failure before reading evidence.
  • Reuse the merged feat(e2e): classify hosted-runner resource pressure and infrastructure loss #7168 GitHub-hosted stranded-step classifier, require a complete paginated job listing, and fail closed on assertions, timeouts, ordinary failures, mixed evidence, ambiguous evidence, or a stale attempt.
  • Reread the subject run immediately before calling GitHub's failed-job rerun endpoint, serialize controllers by run ID, and keep validated attempt links in the job log while the job summary stays free of network-derived content.
  • Add behavioral, adversarial, workflow-boundary, pagination, replay, provenance, and PR-gate regression coverage, plus the maintainer-facing E2E runbook entry.
  • Keep this work orthogonal to ci(e2e): centralize larger runner routing #7391 (larger-runner routing), ci(e2e): record runner comparison telemetry #7247 (runner telemetry), and ci(e2e): gate final-main fanout on base-image publication #7373 (base-image publication gating). This PR does not modify .github/workflows/e2e.yaml or those features' files.

Type of Change

  • Code change (feature, bug fix, or refactor)
  • Code change with doc updates
  • Doc only (prose changes, no code sample modifications)
  • Doc only (includes code sample changes)

Quality Gates

  • Tests added or updated for changed behavior
  • Existing tests cover changed behavior — justification:
  • Tests not applicable — justification:
  • Docs updated for user-facing behavior changes
  • Docs not applicable — justification: This changes internal CI operations only. test/e2e/README.md documents the maintainer behavior; the required documentation review confirmed that no user-facing docs/ page or changelog entry applies.
  • Sensitive paths changed (security, policy, credentials, preflight, onboarding, inference, runner, sandbox, or messaging)
  • Sensitive-path review completed or maintainer-approved waiver recorded — reviewer/approval link/justification: A nine-category pre-PR review found no findings. The write token is job-scoped, only github.workflow_sha is checked out, no repository secrets are exposed, subject provenance is independently queried, mutation tests protect the boundary, and the run is reread immediately before mutation. Maintainer review remains requested through this PR.
  • Non-success, skipped, or missing CI check accepted by maintainer — check name, approval link, and follow-up issue:

Documentation Writer Review

DGX Station Hardware Evidence

  • Tested on DGX Station
  • Tested commit:
  • Station profile/scenario:
  • Result:
  • Supporting evidence:

Verification

  • PR description includes a Signed-off-by: line and every commit appears as Verified in GitHub
  • Normal pre-commit, commit-msg, and pre-push hooks passed, or npm run check:diff passed when hooks were skipped or unavailable
  • Targeted behavior tests pass for the current change set, or tests are marked not applicable above — 23 focused classifier/controller/workflow tests and 45 PR-gate regression tests passed; npm run test:changed passed 23 tests.
  • Applicable broad gate passed — npm run checks, npm run typecheck:cli, project-membership, test-title, and source-shape validation passed.
  • Quality Gates section completed with required justifications or waivers
  • No secrets, API keys, or credentials committed
  • npm run docs builds without warnings (doc changes only)
  • Doc pages follow the style guide (doc changes only)
  • New doc pages include SPDX header and frontmatter (new pages only)

Signed-off-by: Prekshi Vyas prekshiv@nvidia.com

Summary by CodeRabbit

  • New Features
    • Added an automated “runner-loss” retry workflow for main E2E runs that re-runs eligible failed jobs only when evidence confirms lost GitHub-hosted runner conditions and the run matches the expected boundary.
  • Documentation
    • Updated the E2E scheduled-operations documentation with the retry rules and explicit “no-retry” scenarios (ordinary failures, mixed cases, timeouts, stale/second-attempt runs, untrusted dispatch identity, incomplete job listings).
  • Tests
    • Added comprehensive E2E tests covering hosted-runner-loss evidence classification and retry decision/boundary validation, plus added watch coverage for the new workflow.

Signed-off-by: Prekshi Vyas <prekshiv@nvidia.com>
@prekshivyas prekshivyas self-assigned this Jul 22, 2026
@coderabbitai

coderabbitai Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Adds hosted-runner-loss classification utilities, a boundary validator for a trusted GitHub Actions retry workflow, and a controller that retries eligible E2E main runs after verifying workflow identity, ancestry, complete job evidence, and run freshness.

Changes

E2E runner-loss retry

Layer / File(s) Summary
Hosted runner-loss evidence
tools/e2e/hosted-runner-loss.mts, tools/e2e/pr-e2e-gate.mts, test/e2e/support/hosted-runner-loss.test.ts
Workflow-job validation and hosted-runner-loss classification are centralized and tested, while the PR gate consumes the shared evidence implementation.
Trusted retry workflow boundary
.github/workflows/e2e-main-runner-loss-retry.yaml, tools/e2e/main-e2e-runner-loss-retry-workflow-boundary.mts, test/e2e/support/main-e2e-runner-loss-retry-workflow.test.ts, test/helpers/vitest-watch-triggers.ts, test/vitest-watch-triggers.test.ts
The new workflow is constrained by exact triggers, permissions, actions, steps, environment values, concurrency, and command boundaries, with contract validation and watch-trigger coverage.
Retry controller and GitHub flow
tools/e2e/main-e2e-runner-loss-retry.mts, test/e2e/support/main-e2e-runner-loss-retry.test.ts, test/e2e/README.md
The controller validates runs, checks authenticated main ancestry, verifies complete paginated job evidence, rejects stale attempts, posts eligible reruns, renders summaries, and documents the behavior.

Estimated code review effort: 4 (Complex) | ~60 minutes

Sequence Diagram(s)

sequenceDiagram
  participant E2ERetryWorkflow
  participant RetryController
  participant GitHubAPI
  participant RunnerLossClassifier
  E2ERetryWorkflow->>RetryController: provide run ID and attempt
  RetryController->>GitHubAPI: fetch run and main ancestry
  GitHubAPI-->>RetryController: validated run metadata
  RetryController->>GitHubAPI: list complete job pages
  GitHubAPI-->>RunnerLossClassifier: workflow jobs
  RunnerLossClassifier-->>RetryController: verified runner-loss evidence
  RetryController->>GitHubAPI: POST rerun-failed-jobs
Loading

Suggested labels: feature

Suggested reviewers: cv, jyaunches

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 3.70% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title matches the main change: adding a CI workflow to retry E2E main runs after hosted runner loss.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/e2e-main-runner-loss-retry-v2

Comment @coderabbitai help to get the list of available commands.

@github-code-quality

github-code-quality Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Code Coverage Overview

Languages: TypeScript

TypeScript / code-coverage/plugin

The overall coverage in commit 408352d in the codex/e2e-main-runne... branch remains at 96%, unchanged from commit d13e34a in the main branch.

TypeScript / code-coverage/cli

The overall coverage in commit 408352d in the codex/e2e-main-runne... branch remains at 80%, unchanged from commit d13e34a in the main branch.

Show a code coverage summary of the most impacted files.
File main d13e34a codex/e2e-main-runne... 408352d +/-
src/lib/onboard...ndbox-create.ts 83% 33% -50%
src/lib/onboard...-create-plan.ts 88% 75% -13%
src/lib/onboard...-desktop-gpu.ts 89% 77% -12%
src/lib/onboard...ndbox-create.ts 91% 83% -8%
src/lib/state/m...-acquisition.ts 89% 84% -5%
src/lib/sandbox...rce-identity.ts 87% 87% 0%
src/lib/state/m...ock-identity.ts 95% 95% 0%
src/lib/state/m...lock-storage.ts 97% 97% 0%
src/lib/shields/index.ts 71% 72% +1%
src/lib/state/g...way-registry.ts 94% 95% +1%

Updated July 23, 2026 04:52 UTC

Signed-off-by: Prekshi Vyas <prekshiv@nvidia.com>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@test/e2e/support/main-e2e-runner-loss-retry.test.ts`:
- Around line 99-137: Update the routes construction in the test setup to
eliminate the if statement checking options.secondPage. Add the optional
second-page githubFetchRoute through a conditional spread in the routes array
literal, preserving the existing route matching and response behavior while
keeping the test body linear.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 87ea051b-5dfe-4a0b-9592-fb516530c45f

📥 Commits

Reviewing files that changed from the base of the PR and between 3ef2ca8 and 8b1b9c8.

📒 Files selected for processing (11)
  • .github/workflows/e2e-main-runner-loss-retry.yaml
  • test/e2e/README.md
  • test/e2e/support/hosted-runner-loss.test.ts
  • test/e2e/support/main-e2e-runner-loss-retry-workflow.test.ts
  • test/e2e/support/main-e2e-runner-loss-retry.test.ts
  • test/helpers/vitest-watch-triggers.ts
  • test/vitest-watch-triggers.test.ts
  • tools/e2e/hosted-runner-loss.mts
  • tools/e2e/main-e2e-runner-loss-retry-workflow-boundary.mts
  • tools/e2e/main-e2e-runner-loss-retry.mts
  • tools/e2e/pr-e2e-gate.mts

Comment thread test/e2e/support/main-e2e-runner-loss-retry.test.ts
Comment thread tools/e2e/main-e2e-runner-loss-retry.mts Fixed
Signed-off-by: Prekshi Vyas <prekshiv@nvidia.com>
@senthilr-nv senthilr-nv added chore Build, CI, dependency, or tooling maintenance area: ci CI workflows, checks, release automation, or GitHub Actions area: e2e End-to-end tests, nightly failures, or validation infrastructure security labels Jul 22, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@tools/e2e/main-e2e-runner-loss-retry.mts`:
- Around line 270-277: Update renderRetrySummary() and its caller
appendJobSummary() to accept the validated original and retry attempt links,
then include only those safe URLs in the generated GITHUB_STEP_SUMMARY content.
Reuse the links already produced by renderRetryLog() rather than stdout-only
text, and update the existing summary test to verify both links are present.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 8d72efda-921f-4128-8409-5a805d8731ce

📥 Commits

Reviewing files that changed from the base of the PR and between 27a1a4f and 1fbebf8.

📒 Files selected for processing (3)
  • test/e2e/README.md
  • test/e2e/support/main-e2e-runner-loss-retry.test.ts
  • tools/e2e/main-e2e-runner-loss-retry.mts
🚧 Files skipped from review as they are similar to previous changes (2)
  • test/e2e/README.md
  • test/e2e/support/main-e2e-runner-loss-retry.test.ts

Comment thread tools/e2e/main-e2e-runner-loss-retry.mts
@github-actions

github-actions Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

PR Review Advisor — Informational

Advisor assessment: Informational / high confidence
Next action: Review the warnings below.
Findings: 0 blockers · 1 warning · 0 suggestions
Status: Canonical ledger: 0 blocker(s), 1 warning(s), 0 suggestion(s).

Model lanes

  • GPT-5.6 Terra (primary): Completed · high confidence · 0 blockers · 1 warning · 0 suggestions
  • Nemotron 3 Ultra (second opinion): Completed · high confidence · 0 blockers · 0 warnings · 0 suggestions
  • Model comparison: normalized findings differ; normalized E2E selections match; Nemotron reported the same number of blockers, 1 fewer warning, the same number of suggestions.

Nemotron output stays in workflow artifacts and does not change the assessment above.

E2E guidance

Advisory only. E2E / PR Gate selects and runs jobs independently.

Recommended E2E: cloud-onboard, credential-sanitization, security-posture

1 warning · 0 suggestions

Warnings

Warnings do not block.

PRA-1 Warning — Treat a cancelled sibling job as ambiguous runner-loss evidence

  • Location: tools/e2e/hosted-runner-loss.mts:136
  • Category: correctness
  • Problem: The ordinary-failure check excludes jobs whose conclusion is cancelled. A failed workflow with one runner-loss marker and one cancelled sibling job therefore produces retryable evidence.
  • Impact: The controller can rerun failed jobs after a mixed terminal state, contrary to the documented fail-closed policy for ambiguous failures.
  • Recommendation: Reject retry evidence when any job outside the confirmed runner-loss set has a non-success terminal result, including cancelled.
  • Verification: Inspect verifiedRunnerLossEvidence with a failed workflow containing one marker job and one cancelled job; detectRunnerLoss must return false.
  • Test coverage: Add a classifier and controller test for a failed run with one hosted-runner-loss job and one cancelled sibling job, and assert no rerun POST occurs.
  • Evidence: tools/e2e/hosted-runner-loss.mts:136-139 excludes cancelled from ordinaryFailureEvidencePresent. tools/e2e/main-e2e-runner-loss-retry.mts passes this evidence to detectRunnerLoss and decideRetry before POSTing rerun-failed-jobs. test/e2e/README.md:72-75 says mixed or ambiguous failures receive no automatic retry.

Workflow run details

This automated review informs maintainers. Warnings and suggestions do not require a response. A maintainer decides whether to merge.

@prekshivyas
prekshivyas requested review from cv and jyaunches July 22, 2026 21:25
cv added 3 commits July 22, 2026 15:01
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Signed-off-by: Carlos Villela <cvillela@nvidia.com>

@cv cv left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved on exact head beebc05 against base 7e8945a. Product-scope gate passes through accepted v0.0.93 issue #7140, proposed direction item 5. Nine-category security review found no findings: the trusted workflow has least-privilege permissions and pinned actions, receives no repository secrets, validates repository/workflow/event/branch/run/SHA ancestry and complete job evidence, rejects cancelled or mixed ordinary failures, serializes by run, and rereads the attempt before the one allowed mutation. Adversarial, pagination, workflow-boundary, stale-confirmation, and cancelled-run regressions cover the sensitive path. CodeRabbit has no unresolved threads and the advisor second opinion reports 0 blockers/warnings/suggestions. Approval remains contingent on current GitHub checks and exact-SHA E2E authorization/evidence completing successfully.

@cv cv left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-approved on refreshed exact head 1036d73 against base 02cf73d. The merge from current main was conflict-free and adds only the already-merged Quickstart documentation/test ownership changes; the PR-specific diff and prior product-scope/security conclusions are unchanged. Fresh hosted CI and new exact-SHA E2E evidence remain required.

@cv cv left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-approved on refreshed exact head cecdb89 against base 1bb15a0. The #7343 merge was conflict-free; its documentation-receipt workflow/package/test changes are inherited from main and disappear from the three-dot PR diff. The PR-specific file set, product scope, and nine-category security assessment remain unchanged. Fresh hosted CI and new exact-SHA E2E evidence are required.

@apurvvkumaria

Copy link
Copy Markdown
Collaborator

@prekshivyas @cv — the current-state duplication audit confirms that #7392 / codex/e2e-main-runner-loss-retry-v2 still owns the missing scheduled/manual final-main retry. No open PR replaces it; merged #7423 intentionally protects only the PR gate.

Would you like to revive and salvage #7392 on current main? Please do not reopen or cherry-pick the old branch unchanged: its pr-e2e-gate.mts classifier refactor predates #7423 and would weaken the hardened annotation/log, runner/check identity, bounded transport, and two-pass validation now on main. A current successor should reuse or extract #7423’s hardened evidence path, require every non-passing job to be positively classified (including rejecting cancelled siblings and mixed failures), reject duplicate/incomplete job evidence, re-read and fingerprint immediately before the one mutation, and keep the first phase limited to authenticated standard GitHub-hosted runners.

If you are no longer taking this follow-up, please say so here and I can prepare the narrow current-main successor without duplicating your work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: ci CI workflows, checks, release automation, or GitHub Actions area: e2e End-to-end tests, nightly failures, or validation infrastructure chore Build, CI, dependency, or tooling maintenance security

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants