Skip to content

fix(ci): query only active E2E runs - #6683

Merged
cv merged 3 commits into
mainfrom
codex/fix-e2e-cancel-pagination
Jul 11, 2026
Merged

cv merged 3 commits into
mainfrom
codex/fix-e2e-cancel-pagination

Conversation

@cv

@cv cv commented Jul 11, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Prevents cancel-superseded from failing once completed E2E workflow history exceeds GitHub's 1,000-result search cap. The controller now lists only non-terminal runs, retains fail-closed pagination, and cancels each matching run at most once. It also removes the temporary base-workflow inventory bridge after #6670 landed on main.

Changes

  • Query the five documented non-terminal workflow-run statuses instead of traversing all historical workflow_dispatch runs.
  • Paginate and validate every status-specific result set before issuing cancellations, retaining the 1,000-result completeness guard per status.
  • Deduplicate run IDs observed across status transitions and keep completed runs excluded.
  • Reproduce the escaped completed-history failure and cover multi-page active results, forward status transitions, and no partial cancellation when an active-status search reaches its limit.
  • Delete the obsolete workflow-inventory.mts --shell compatibility CLI and exercise malformed workflow metadata directly through the production inventory reader.

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: the documented PR cancellation contract is unchanged, and the deleted temporary CLI had no documented or tracked consumer; final documentation-writer audits confirmed no user-facing update is needed.
  • 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: independent controller and cleanup reviews confirmed fixed status constants, PR-title and run-ID validation, benign completion races, validation before cancellation, and no remaining consumer of the deleted bridge.
  • Non-success, skipped, or missing CI check accepted by maintainer — check name, approval link, and follow-up issue:

Verification

  • PR description includes the DCO sign-off declaration 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 — controller integration (1 file, 20 tests); focused E2E workflow boundary (1 file, 17 tests); full e2e-support project (115 files, 926 tests)
  • Applicable broad gate passed — npm test for broad runtime/test-harness changes; npm run check for repo-wide validation/coverage changes — command/result:
  • 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: Carlos Villela [email protected]

Summary by CodeRabbit

  • Bug Fixes

    • Improved pull request gate cancellation to target only eligible “active” workflow runs across multiple run states, avoiding queued or unrelated runs.
    • Refined pagination handling for active-run discovery and ensured cancellation happens only when the correct run becomes eligible.
    • Deduplicates discovered runs before issuing any cancellations.
  • Tests

    • Expanded end-to-end coverage to verify the exact sequence of active-status pagination queries and the cancellation/rejection behavior at page limits.
  • Chores

    • Removed the workflow-inventory CLI used by end-to-end tests, switching validation to direct assertions.

@cv cv self-assigned this Jul 11, 2026
@coderabbitai

coderabbitai Bot commented Jul 11, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

cancelPrGate now queries GitHub workflow runs by active status with per-status pagination, deduplicates and cancels matching runs, and rejects page-limit exhaustion. The workflow inventory CLI is removed, with malformed metadata tested through the inventory reader.

Changes

Active workflow run cancellation

Layer / File(s) Summary
Status-aware run discovery
tools/e2e/pr-e2e-gate.mts
Defines active statuses, queries each status with its own page limit, deduplicates matching runs, cancels discovered runs, and returns the deduplicated count.
Cancellation behavior coverage
test/pr-e2e-gate.test.ts
Validates paginated status queries, selective cancellation, active-status progression, and rejection when a status reaches the paging limit.
Direct inventory validation
tools/e2e/workflow-inventory.mts, test/e2e/support/e2e-workflow.test.ts
Removes the workflow inventory CLI and replaces CLI-based malformed metadata validation with a direct inventory-reader assertion.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant cancelPrGate
  participant GitHubActionsAPI
  participant GitHubCancelAPI
  cancelPrGate->>GitHubActionsAPI: Query each active status and page
  GitHubActionsAPI-->>cancelPrGate: Return workflow runs
  cancelPrGate->>GitHubCancelAPI: Cancel deduplicated eligible run ids
Loading
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% 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 clearly summarizes the main change: limiting CI to active E2E runs.
✨ 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/fix-e2e-cancel-pagination

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

@github-code-quality

github-code-quality Bot commented Jul 11, 2026 •

Copy link
Copy Markdown
Contributor

Code Coverage Overview

Languages: TypeScript

TypeScript / code-coverage/plugin

The overall coverage remains at 96%, unchanged from the main branch.

TypeScript / code-coverage/cli

The overall coverage in the codex/fix-e2e-cancel... branch remains at 78%, unchanged from the main branch.

Show a code coverage summary of the most impacted files.
File main c245efa codex/fix-e2e-cancel... 8ecc3c2 +/-
src/lib/actions...nv-isolation.ts 100% 95% -5%
src/lib/messagi...agent-config.ts 71% 71% 0%
src/lib/inference/local.ts 75% 75% 0%
src/lib/messagi...est-compiler.ts 98% 99% +1%
src/lib/actions...lution-probe.ts 93% 94% +1%
src/lib/messagi...flow-planner.ts 86% 87% +1%
src/lib/messagi...etup-applier.ts 63% 67% +4%
src/lib/onboard...box-recovery.ts 81% 86% +5%
src/lib/messagi.../hook-phases.ts 88% 93% +5%
src/lib/messagi...tate-applier.ts 68% 74% +6%

Updated July 11, 2026 15:51 UTC
Code Coverage is in Public Preview. Learn more and provide us with your feedback.

@github-actions

github-actions Bot commented Jul 11, 2026 •

Copy link
Copy Markdown
Contributor

E2E Advisor Recommendation

Required E2E: None
Optional E2E: None

Workflow run

Full advisor summary

E2E Recommendation Advisor

Base: origin/main
Head: HEAD
Confidence: high

Required E2E

  • None. No product E2E is required. The deterministic risk plan requires no jobs, and the touched files are CI E2E controller/inventory tooling plus tests for that tooling. They do not change runtime/user-flow code paths such as onboarding, sandbox lifecycle, credentials, security boundaries, network policy, inference routing, or real assistant behavior.

Optional E2E

  • None.

New E2E recommendations

  • None.

@github-actions

github-actions Bot commented Jul 11, 2026 •

Copy link
Copy Markdown
Contributor

PR Review Advisor (Nemotron Ultra) — No blocking findings

Merge posture: No blocking advisor findings
Primary next action: Add or justify PRA-T1 and any related test follow-ups.
Open items: 0 required · 0 warnings · 0 suggestions · 1 test follow-up
Since last review: 0 prior items resolved · 0 still apply · 0 new items found

Action checklist

  • PRA-T1 Add or justify test follow-up: Runtime validation
Test follow-ups to resolve or justify

If these cover changed behavior, prefer adding them in this PR; otherwise state why existing coverage is enough or link the follow-up.

  • PRA-T1 Runtime validation — Add or identify targeted runtime/integration validation for the changed behavior; do not report external E2E job pass/fail here.. Runtime/sandbox/infrastructure paths need behavioral runtime validation: tools/e2e/pr-e2e-gate.mts, tools/e2e/workflow-inventory.mts. Controller integrates with GitHub API (fetch, pagination, status transitions); mocked fetch tests provide unit coverage for new invariants. Runtime validation against live GitHub API would be needed for full behavioral confidence but is not required for this PR's scope.

Workflow run details

This is an automated, non-binding review; it still expects maintainers and agents to respond to each required or warning item. Treat suggestions as current-PR improvements when they touch changed code; defer only with maintainer rationale or a linked follow-up. A human maintainer must make the final merge decision.

@github-actions

github-actions Bot commented Jul 11, 2026 •

Copy link
Copy Markdown
Contributor

PR Review Advisor — No blocking findings

Merge posture: No blocking advisor findings
Primary next action: Add or justify PRA-T1 and any related test follow-ups.
Open items: 0 required · 0 warnings · 0 suggestions · 2 test follow-ups
Since last review: 0 prior items resolved · 0 still apply · 0 new items found

Action checklist

  • PRA-T1 Add or justify test follow-up: Runtime validation
  • PRA-T2 Add or justify test follow-up: Runtime validation
Test follow-ups to resolve or justify

If these cover changed behavior, prefer adding them in this PR; otherwise state why existing coverage is enough or link the follow-up.

  • PRA-T1 Runtime validation — Add or identify targeted runtime/integration validation for the changed behavior; do not report external E2E job pass/fail here.. Runtime/sandbox/infrastructure paths need behavioral runtime validation: tools/e2e/pr-e2e-gate.mts, tools/e2e/workflow-inventory.mts. The changed code is CI/controller infrastructure, so runtime validation can increase confidence, but checked-in tests cover the changed active-status pagination, filtering, dedupe, completed-history avoidance, and fail-closed cancellation behavior. The risk plan lists no deterministic invariants or required jobs.
  • PRA-T2 Runtime validation — Optionally exercise a real or dry-run GitHub Actions listing scenario where completed E2E workflow history exceeds 1,000 runs while active queued/in_progress PR-gate runs remain discoverable through status-specific queries; do not treat external E2E execution status as a code-review finding.. Runtime/sandbox/infrastructure paths need behavioral runtime validation: tools/e2e/pr-e2e-gate.mts, tools/e2e/workflow-inventory.mts. The changed code is CI/controller infrastructure, so runtime validation can increase confidence, but checked-in tests cover the changed active-status pagination, filtering, dedupe, completed-history avoidance, and fail-closed cancellation behavior. The risk plan lists no deterministic invariants or required jobs.

Workflow run details

This is an automated, non-binding review; it still expects maintainers and agents to respond to each required or warning item. Treat suggestions as current-PR improvements when they touch changed code; defer only with maintainer rationale or a linked follow-up. A human maintainer must make the final merge decision.

@cv

cv commented Jul 11, 2026

Copy link
Copy Markdown
Collaborator Author

Addressed the initial codebase-growth-guardrails finding in 538078db3: the test response fixtures now use declarative query/status maps instead of adding five if statements.

Verification after the change:

  • npm run test-conditionals:scan -- --top 25
  • npx vitest run --project integration test/pr-e2e-gate.test.ts — 20/20 passed
  • normal pre-commit, commit-msg, and pre-push hooks passed
  • both PR commits are GitHub Verified

@cv

cv commented Jul 11, 2026

Copy link
Copy Markdown
Collaborator Author

Expected bootstrap behavior for this fix: the current-head cancel-superseded job failed with the same Run listing exceeded its page limit message.

That job is triggered by pull_request_target on synchronize and intentionally checks out ${{ github.workflow_sha }} from trusted main while holding actions: write. It therefore runs the pre-fix controller, not this PR's code; changing it to execute the PR head would cross the workflow trust boundary.

The failure is the defect this PR fixes and is not useful to rerun. After merge, the closed event will load the corrected controller from main. The PR-head behavior is covered by the focused 20-test controller suite, including the full completed-history reproduction, status-filter pagination, transition deduplication, and fail-closed active-status cap.

@cv

cv commented Jul 11, 2026

Copy link
Copy Markdown
Collaborator Author

The remaining e2e-support failure is a base regression, not introduced by this PR.

  • PR job: e2e-support
  • Identical latest-main failure at base c245efa24: run 29157159527
  • Failing contract: e2e-workflow.test.ts still expects four discrete credential-free jobs from the temporary workflow-inventory.mts --shell compatibility bridge.

That bridge was intentionally marked for deletion after #6670's planner-based workflow landed on main; #6670 is now merged, so the old expectation is stale. All other current-head test, platform, CodeQL, CodeRabbit, and both PR-advisor checks passed. I am keeping this separate from the pagination fix until the desired PR scope is confirmed.

@cv

cv commented Jul 11, 2026

Copy link
Copy Markdown
Collaborator Author

Folded the approved post-#6670 cleanup into 8ecc3c218:

  • deleted the obsolete tools/e2e/workflow-inventory.mts compatibility CLI;
  • removed the stale discrete-job shell-output test;
  • kept malformed workflow metadata fail-closed coverage directly against readFreeStandingJobsInventory, the production planner path;
  • confirmed there are no remaining tracked consumers or references.

Verification:

  • focused e2e-workflow.test.ts: 17/17 passed;
  • complete e2e-support project: 115 files / 926 tests passed;
  • normal commit and pre-push hooks passed;
  • all three PR commits are GitHub Verified.

This directly resolves the inherited main e2e-support failure documented above.

@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.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
test/e2e/support/e2e-workflow.test.ts (1)

673-674: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Retain a migration check for the removed inventory CLI.

This deletion removes the only shown coverage that exercised workflow-inventory.mts. Add an explicit check that the superseded entry point is absent or unreachable; the new reader assertion only proves the replacement path works.

🤖 Prompt for 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.

In `@test/e2e/support/e2e-workflow.test.ts` around lines 673 - 674, Retain
explicit migration coverage for the removed workflow-inventory CLI by adding a
test alongside the malformed metadata case that verifies workflow-inventory.mts
is absent or unreachable. Keep the existing replacement reader assertion, but
ensure the test also confirms the superseded entry point cannot be invoked.

Source: Path instructions

🤖 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.

Outside diff comments:
In `@test/e2e/support/e2e-workflow.test.ts`:
- Around line 673-674: Retain explicit migration coverage for the removed
workflow-inventory CLI by adding a test alongside the malformed metadata case
that verifies workflow-inventory.mts is absent or unreachable. Keep the existing
replacement reader assertion, but ensure the test also confirms the superseded
entry point cannot be invoked.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: a8a460d5-eb47-4cee-ab11-2ca40feb4c2d

📥 Commits

Reviewing files that changed from the base of the PR and between 538078d and 8ecc3c2.

📒 Files selected for processing (2)
  • test/e2e/support/e2e-workflow.test.ts
  • tools/e2e/workflow-inventory.mts
💤 Files with no reviewable changes (1)
  • tools/e2e/workflow-inventory.mts

@cv

cv commented Jul 11, 2026

Copy link
Copy Markdown
Collaborator Author

Reviewed CodeRabbit’s minor suggestion to add a migration test asserting that tools/e2e/workflow-inventory.mts is absent or unreachable. I’m intentionally not adding that test: deleting the file and confirming there are no tracked consumers is the removal, while a permanent filesystem-absence assertion would turn an obsolete filename into a new compatibility contract/catalog that must itself be maintained. The retained malformed-metadata test exercises readFreeStandingJobsInventory directly, so the production planner path remains covered.

@cv
cv merged commit cb1b54f into main Jul 11, 2026
56 of 57 checks passed
@cv
cv deleted the codex/fix-e2e-cancel-pagination branch July 11, 2026 16:01
Hadar301 pushed a commit to Hadar301/NemoClaw-OpenShift that referenced this pull request Jul 12, 2026
<!-- markdownlint-disable MD041 -->
## Summary
Prevents `cancel-superseded` from failing once completed E2E workflow
history exceeds GitHub's 1,000-result search cap. The controller now
lists only non-terminal runs, retains fail-closed pagination, and
cancels each matching run at most once. It also removes the temporary
base-workflow inventory bridge after NVIDIA#6670 landed on `main`.

## Changes
- Query the five documented non-terminal workflow-run statuses instead
of traversing all historical `workflow_dispatch` runs.
- Paginate and validate every status-specific result set before issuing
cancellations, retaining the 1,000-result completeness guard per status.
- Deduplicate run IDs observed across status transitions and keep
completed runs excluded.
- Reproduce the escaped completed-history failure and cover multi-page
active results, forward status transitions, and no partial cancellation
when an active-status search reaches its limit.
- Delete the obsolete `workflow-inventory.mts --shell` compatibility CLI
and exercise malformed workflow metadata directly through the production
inventory reader.

## Type of Change

- [x] 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
<!-- Check exactly one tests line and one docs line. Check other lines
when applicable. Add every requested justification or approval
reference. -->
- [x] Tests added or updated for changed behavior
- [ ] Existing tests cover changed behavior — justification:
- [ ] Tests not applicable — justification:
- [ ] Docs updated for user-facing behavior changes
- [x] Docs not applicable — justification: the documented PR
cancellation contract is unchanged, and the deleted temporary CLI had no
documented or tracked consumer; final documentation-writer audits
confirmed no user-facing update is needed.
- [x] Sensitive paths changed (security, policy, credentials, preflight,
onboarding, inference, runner, sandbox, or messaging)
- [x] Sensitive-path review completed or maintainer-approved waiver
recorded — reviewer/approval link/justification: independent controller
and cleanup reviews confirmed fixed status constants, PR-title and
run-ID validation, benign completion races, validation before
cancellation, and no remaining consumer of the deleted bridge.
- [ ] Non-success, skipped, or missing CI check accepted by maintainer —
check name, approval link, and follow-up issue:

## Verification
<!-- Check each applicable item only when supported by the requested
evidence. Run targeted tests once per relevant change set and rerun
after later edits or hook autofixes that can affect the tested behavior.
Do not rerun hook-covered checks. -->
- [x] PR description includes the DCO sign-off declaration and every
commit appears as `Verified` in GitHub
- [x] Normal `pre-commit`, `commit-msg`, and `pre-push` hooks passed, or
`npm run check:diff` passed when hooks were skipped or unavailable
- [x] Targeted behavior tests pass for the current change set, or tests
are marked not applicable above — controller integration (1 file, 20
tests); focused E2E workflow boundary (1 file, 17 tests); full
`e2e-support` project (115 files, 926 tests)
- [ ] Applicable broad gate passed — `npm test` for broad
runtime/test-harness changes; `npm run check` for repo-wide
validation/coverage changes — command/result:
- [x] Quality Gates section completed with required justifications or
waivers
- [x] No secrets, API keys, or credentials committed
- [ ] `npm run docs` builds without warnings (doc changes only)
- [ ] Doc pages follow the [style
guide](https://github.com/NVIDIA/NemoClaw/blob/main/docs/CONTRIBUTING.md)
(doc changes only)
- [ ] New doc pages include SPDX header and frontmatter (new pages only)

---
<!-- DCO sign-off is required in this PR description, and every commit
must appear as Verified in GitHub. Run: git config user.name && git
config user.email -->
Signed-off-by: Carlos Villela <[email protected]>


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **Bug Fixes**
- Improved pull request gate cancellation to target only eligible
“active” workflow runs across multiple run states, avoiding queued or
unrelated runs.
- Refined pagination handling for active-run discovery and ensured
cancellation happens only when the correct run becomes eligible.
  - Deduplicates discovered runs before issuing any cancellations.

- **Tests**
- Expanded end-to-end coverage to verify the exact sequence of
active-status pagination queries and the cancellation/rejection behavior
at page limits.

- **Chores**
- Removed the `workflow-inventory` CLI used by end-to-end tests,
switching validation to direct assertions.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Signed-off-by: Carlos Villela <[email protected]>
@wscurran wscurran added area: ci CI workflows, checks, release automation, or GitHub Actions area: e2e End-to-end tests, nightly failures, or validation infrastructure bug-fix PR fixes a bug or regression labels Jul 30, 2026
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 bug-fix PR fixes a bug or regression

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants