Skip to content

fix(scheduler): verify pre-job startup failures - #1859

Merged
seonghobae merged 1 commit into
mainfrom
codex/classify-prejob-startup-failure
Sep 4, 2026
Merged

fix(scheduler): verify pre-job startup failures#1859
seonghobae merged 1 commit into
mainfrom
codex/classify-prejob-startup-failure

Conversation

@seonghobae

Copy link
Copy Markdown
Contributor

Summary

  • require a startup_failure workflow run to have zero jobs before same-tree recovery restamps a PR head
  • inspect every run attempt through the Actions jobs API
  • keep fail-closed behavior when GitHub job evidence cannot be read

Live evidence

  • OriginWeave Fix R coverage package library path #166 run 33782503464 reports startup_failure, but both jobs have cancelled conclusions and annotations say The run was canceled forcefully by @seonghobae.
  • ContextualWisdomLab.github.io Fix OpenCode prompt template shell expansion #194 run 32985475037 reports startup_failure, but all four OpenCode jobs completed successfully with no failure annotations.
  • Genuine pre-job examples, including wardnet CodeQL run 33710871620 and github.io scheduler run 32985582127, have zero jobs and no job logs or annotations.

The workflow-level conclusion alone therefore cannot distinguish a pre-job startup failure from a force-cancelled or internally inconsistent aggregate. The jobs list is the smallest authoritative discriminator already exposed by GitHub.

Verification

  • python -m pytest -q tests/test_pr_review_merge_scheduler.py -k 'startup_failure or actions_run_has_no_jobs' - 9 passed
  • python -m pytest -q tests/test_required_workflow_queue_contract.py tests/test_codeql_pr_workflow_contract.py tests/test_codeql_scan_dispatch_workflow_contract.py - 87 passed
  • python -m py_compile scripts/ci/pr_review_merge_scheduler_core.py tests/test_pr_review_merge_scheduler.py
  • git diff --check

No product or scanner policy behavior is weakened. The change only prevents false recovery mutations when jobs exist.

Signed-off-by: Seongho Bae <me@seonghobae.me>
@coderabbitai

coderabbitai Bot commented Sep 4, 2026

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 38 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Team

Run ID: cde95127-cfce-4362-9014-55aa5b00cc63

📥 Commits

Reviewing files that changed from the base of the PR and between 7696915 and a6cfdc6.

📒 Files selected for processing (2)
  • scripts/ci/pr_review_merge_scheduler_core.py
  • tests/test_pr_review_merge_scheduler.py

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@seonghobae
seonghobae enabled auto-merge (squash) September 4, 2026 16:34
@seonghobae
seonghobae merged commit f871694 into main Sep 4, 2026
7 of 19 checks passed
@seonghobae
seonghobae deleted the codex/classify-prejob-startup-failure branch September 4, 2026 16:37
seonghobae added a commit that referenced this pull request Sep 5, 2026
#1883)

The admission-controller feature burst (#1859-#1869) shipped
review_admission_controller.py, pr_review_merge_scheduler_core.py's
SchedulerAdmissionGate, and (separately, pre-existing) a coverage gap
in audit_codeql_default_setup_rollout.py without full test coverage
or docstrings, breaking the required 100% coverage/docstring gate for
every PR in this repository regardless of that PR's own diff.

The original fix for this landed on .github#1871, which was later
closed in favor of narrower successors (#1877 for the stale schedule
oracles, #1879 for HTTP error response bodies) -- but the coverage and
docstring portion of #1871's delta was dropped in that narrowing and
never reached main. This PR recovers exactly that portion from
#1871's still-present branch (fix/hourly-review-repair-callers-cron-
format-drift) and completes it:

- review_admission_controller.py: 85% -> 100% coverage (new
  tests/test_review_admission_controller.py), 14 missing docstrings
  added across its WorkerBoundary/AdmissionRequest/RequestRecord/
  DispatchLease/ControllerState/DispatchPlan dataclasses and methods.
- audit_codeql_default_setup_rollout.py: 79% -> 100% coverage (new
  tests/test_codeql_default_setup_rollout.py), 2 missing docstrings
  added (parse_args, main).
- pr_review_merge_scheduler_core.py's SchedulerAdmissionGate: 3
  missing docstrings added (__init__ and its two nested closures,
  lease/reconcile_state).

Additionally closed pr_review_merge_scheduler_core.py's own separate,
longer-standing coverage gap (98% -> 100%, unrelated to the
admission-controller work) discovered while verifying this fix would
actually bring main to a green gate rather than a differently-shaped
99%: the durable admission gate's own bounded-budget/stale-head
branches across every dispatch call site (9 "admission_deferred"
checks across post_update_branch_followup/dispatch_draft_review_only/
inspect_pr, plus dispatch_strix_evidence's own two "admission_deferred"/
"stale_head" pairs), reconcile()'s live-head-moved and still-running
branches, rotating_pr_window's/dispatch_draft_review_only's/the
workflow-run classifier's/the empty-PR-close path's/main()'s own
--admission-state-path wiring's remaining gaps, and two untestable
package-import fallback lines marked `# pragma: no cover - package
import path` matching this file's established convention for that
exact pattern.

Full local triad: 2875 passed, 1 skipped; coverage 100%; interrogate
100%.

Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant