Skip to content

Record zero-job startup failures as no_agent in routing history recovery - #80800

Open
rabeckett wants to merge 1 commit into
mainfrom
fix/zero-job-startup-no-agent
Open

rabeckett wants to merge 1 commit into
mainfrom
fix/zero-job-startup-no-agent

Conversation

@rabeckett

Copy link
Copy Markdown
Collaborator

Fixes #80795

In adaptive routing (#79102), when a workflow run fails before GitHub Actions creates any jobs (for example a YAML or startup failure such as Auto-Triage Issues run 4768), listJobsForWorkflowRunAttempt returns an empty job list [].

Previously, listRuns in actions/setup/js/push_routing_history.cjs skipped any failed run without a push_routing_history job so that runs compiled while adaptive routing was turned off are not charged. Because an empty job list also lacks a push_routing_history job, zero-job startup failures were skipped too, leaving a gap in runs.jsonl and causing later saves to re-query listJobsForWorkflowRunAttempt for that run until it ages off the 100-run page.

This PR distinguishes zero-job startup failures from runs that created jobs without push_routing_history, keeping pre-opt-in runs ignored while recording zero-job startup failures as non-counted no_agent audit lines without incrementing state.unexplained.

Example

Suppose run 50 already saved on the current generation, run 51 failed while adaptive routing was off (jobs list contains only agent), and run 52 failed at workflow startup with zero jobs ([]). When run 54 saves:

Earlier run Jobs returned Before this PR With this PR
Run 51 (adaptive routing off) [agent] Skipped, unexplained unchanged Skipped, unexplained unchanged
Run 52 (zero-job startup failure) [] Skipped, re-queried on later saves Recorded as no_agent, unexplained unchanged, skipped on later saves while retained in runs.jsonl

With this PR, run 54 appends a non-counted no_agent line for run 52 to runs.jsonl:

{"run":"9052","number":52,"attempt":1,"at":"2026-11-24T10:00:00Z","generation":null,"scope":null,"mode":null,"role":null,"pair":null,"outcome":null,"credits":null,"counted":false,"note":"no_agent"}

Deduplication after an audit line ages out of the 500-line runs.jsonl retention window is tracked separately in #80780.

Changes

  • actions/setup/js/push_routing_history.cjs: in listRuns, apply the missing-writer / completed-writer skip guard only when jobs.length > 0, so zero-job runs stay in listing with agent_ran: false and applyRun records a non-counted no_agent audit line.
  • actions/setup/js/push_routing_history.test.cjs: add a unit test covering zero-job startup failures (failure and startup_failure conclusions) alongside a failed run whose jobs contain only agent, verifying no_agent recording, unchanged state.unexplained, ignored pre-opt-in runs, and no redundant jobs lookup on the next save.

Verification

Validated on 0e97fe910b:

  • npx vitest run --no-file-parallelism --testTimeout=60000 push_routing_history.test.cjs routing_history.test.cjs: 2 test files, 64 passed.
  • npm run typecheck: passed (0 errors).
  • npx prettier --end-of-line auto --check push_routing_history.cjs push_routing_history.test.cjs: passed.
  • eslint --config eslint-factory/eslint.config.cjs push_routing_history.cjs push_routing_history.test.cjs: passed (0 errors).

When a workflow run fails before GitHub Actions creates any jobs,
listJobsForWorkflowRunAttempt returns an empty array. Keep zero-job
completed runs in listRuns with agent_ran=false so applyRun records a
non-counted no_agent line without charging unexplained, while still
skipping runs that have jobs without push_routing_history.

Fixes #80795

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@rabeckett
rabeckett marked this pull request as ready for review November 24, 2026 20:25
Copilot AI adaptive review requested due to automatic review settings November 24, 2026 20:25
@github-actions

github-actions Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

✅ PR Specification Reviewer completed successfully!

PR Specification Reviewer

Outcome: reported_action

The agent completed and reported one or more actions. The no-op output is a completion signal, not a claim that no action was taken.

The [aw] No-Op Runs tracker omits agent messages. The category uses structured run status, not interpretation of agent prose.

No-op message

PR #80800 reviewed at head 0e97fe9: applicable adaptive-routing/compiler contracts remain aligned; no specification update, inline finding, or review submission was needed.

Generated by PR Specification Reviewer for #80800 · copilot · gpt56 · ~3 AIC · ⌖ ~2 AIC · ⊞ 1.8K · history

@github-actions

github-actions Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

✅ Ponytail Reviewer completed successfully!

Ponytail Reviewer

Outcome: reported_no_action

The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible.

The [aw] No-Op Runs tracker omits agent messages. The category uses structured run status, not interpretation of agent prose.

No-op message

Lean already. Ship.

Generated by Ponytail Reviewer for #80800 · codex · routed: gpt61 medium · ~4 AIC · ⌖ ~1 AIC · ⊞ 176 · history

@github-actions

Copy link
Copy Markdown
Contributor

🧠 Matt Pocock Skills Reviewer is reviewing this pull request using Matt Pocock's engineering skills...

@github-actions

Copy link
Copy Markdown
Contributor

🔬 Test Quality Sentinel is analyzing test quality on this pull request...

@github-actions

github-actions Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

✅ PR Code Quality Reviewer completed the code quality review.

PR Code Quality Reviewer

Outcome: reported_action

The agent completed and reported one or more actions. The no-op output is a completion signal, not a claim that no action was taken.

The [aw] No-Op Runs tracker omits agent messages. The category uses structured run status, not interpretation of agent prose.

No-op message

Completed PR #80800 review: no merge-blocking findings; review submitted and review-history ledger appended.

🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt56 · ~3 AIC · ⌖ ~1 AIC · ⊞ 1.7K · history

@github-actions

Copy link
Copy Markdown
Contributor

Comment Memory

Peek at saved memory (spec-review-history)
{"id":"ldg-aa9d749b-49a6-48e8-aed0-9f79d7eb94d6","parents":[],"payload":{"id":"ldg-41d510c0-7171-4fb0-9781-1548a015de14","operation":"append","value":{"finding_count":0,"head_sha":"0e97fe910be6a66ae25406473226574d16b12ee0","outcome":"aligned"}},"sha":"sha256:b0d71bf6a01409ff90b11911c790e1b93c6052e3d784ebafa09f78f9385eee53","timestamp":"2026-11-24T20:32:44.339Z","type":"ledger_append","version":1}
History

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

Reviewed the changed lines in push_routing_history.cjs and its focused test. No merge-blocking correctness or reliability issue was found. The new zero-job path is guarded by the existing generation/run-number fence, and the added test covers recording, unexplained accounting, and deduplication behavior. The independent specialist pass completed; its candidates were adjudicated and discarded as either fenced out, speculative, or non-blocking coverage concerns.

🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt50 · ~3 AIC · ⌖ ~1 AIC · ⊞ 1.7K
Comment /review to run again

@github-actions

Copy link
Copy Markdown
Contributor

Comment Memory

Peek at saved memory (review-history)
{"id":"ldg-96747836-6228-4519-880a-4ea369545555","parents":[],"payload":{"id":"ldg-ccfac13b-3e01-493c-844a-cea0bf496f1c","operation":"append","value":{"finding_count":0,"head_sha":"0e97fe910be6a66ae25406473226574d16b12ee0","outcome":"no_findings"}},"sha":"sha256:abe6e204f1cce117763fc4688a6dfe84f9f189bad93dcbc8ec48a76b8b9dbbda","timestamp":"2026-11-24T20:34:09.697Z","type":"ledger_append","version":1}
History

Copilot AI 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.

🟢 Approval recommended

No active review issues remain for the change that records zero-job startup failures in routing history.

No open issues 🎉

What changed in this PR

This PR fixes #80795 by recording zero-job startup failures in adaptive routing history as non-counted no_agent entries, avoiding repeated job lookups while those entries remain retained.

Changes:

  • Preserve zero-job failures for audit recording without increasing state.unexplained, while continuing to ignore runs with jobs but no history writer.
  • Add regression coverage for failure and startup_failure conclusions, pre-opt-in exclusions, and job-lookup deduplication on subsequent saves.
File Description
actions/​setup/​js/​push_routing_history.test.cjs Tests zero-job audit entries, unchanged unexplained counts, and subsequent lookup behavior.
actions/​setup/​js/​push_routing_history.cjs Limits the writer-job skip guard to runs with at least one job.

Review effort: Balanced (adaptive)

@github-actions

Copy link
Copy Markdown
Contributor

🧪 Test Quality Sentinel Report

✅ Test Quality Score: 90/100 — Excellent

Analyzed 1 test(s): 1 design, 0 implementation, 0 violation(s).

📊 Metrics (1 tests)
Metric Value
Analyzed 1 (Go: 0, JS: 1)
✅ Design 1 (100%)
⚠️ Implementation 0 (0%)
Edge/error coverage 1 (100%)
Duplicate clusters 0
Inflation YES (24 test lines vs 5 production lines, 4.8:1 exceeds 2:1)
🚨 Violations 0
Test File Classification Issues
records zero-job startup failures as no_agent without charging unexplained, while ignoring pre-opt-in runs actions/setup/js/push_routing_history.test.cjs:436 design_test / behavioral_contract / high_value Inflation only
⚠️ Flagged Tests (1)

records zero-job startup failures as no_agent ... (actions/setup/js/push_routing_history.test.cjs:436): advisory only, not a failure. The 4.8:1 ratio is flagged because one scenario covers three behaviors: zero-job runs recorded as no_agent, runs compiled without a history job excluded, and already-recorded runs not re-queried. Splitting it would make each contract easier to diagnose. No change required.

Regression value: the test uses a real bare git remote and asserts on the persisted runs.jsonl and state.json. Only the GitHub REST client and signed push are faked. By tracing listRuns and applyRun, reverting the new jobs.length === 0 branch drops runs 52 and 53 from runs.jsonl, so the test would fail.

Execution note: vitest was not run. The sandbox denied dependency installation, so this review is based on static tracing of the test expectations against the production code.

Verdict

✅ passed. 0% implementation tests (threshold: 30%). No hard violations.

🧪 Test quality analysis by Test Quality Sentinel · copilot · routed: haiku55 xhigh · ~5 AIC · ⌖ ~2 AIC · ⊞ 7.4K · history
Comment /review to run again

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

✅ Test Quality Sentinel: 90/100. 0% implementation tests (threshold: 30%). No violations.

🧪 Test quality analysis by Test Quality Sentinel · copilot · routed: haiku55 xhigh · ~5 AIC · ⌖ ~2 AIC · ⊞ 7.4K
Comment /review to run again

This branch has not been deployed

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Record zero-job startup failures as no_agent in routing history recovery

2 participants