Skip to content

fix(ci): fail required checks when dependency locks fail - #3780

Open
Hughhhhcoder wants to merge 4 commits into
openai:mainfrom
Hughhhhcoder:codex/openai-python-ci-dependency-gate
Open

fix(ci): fail required checks when dependency locks fail#3780
Hughhhhcoder wants to merge 4 commits into
openai:mainfrom
Hughhhhcoder:codex/openai-python-ci-dependency-gate

Conversation

@Hughhhhcoder

@Hughhhhcoder Hughhhhcoder commented Sep 2, 2026

Copy link
Copy Markdown

Changes being requested

  • I understand that this repository is auto-generated and my pull request may not be merged

When the required lint, build, test, and test-httpx2 jobs depend on a failed dependency-locks job, GitHub Actions skips them. If those skipped jobs are branch-protection requirements, the pull request can appear to satisfy the required checks even though dependency validation failed.

Reproduction:

  1. Make dependency-locks fail on a push or fork pull request.
  2. Observe that each downstream required job is skipped rather than reported as failed.

Expected behavior: Required checks remain visible and fail when dependency-lock validation fails.

Actual behavior: The downstream required checks are skipped, which can let branch rules treat the workflow as successful.

Root cause: A failed job in needs implicitly skips dependent jobs unless their job-level condition includes a status function such as always().

This change keeps the existing event filter, makes the four required jobs run after dependency-lock failure, and adds an early guard step that exits with failure before installing dependencies or executing the regular job. A static regression test protects both the job guards and the failure steps.

Additional context & links

Fixes #3755

Validation:

  • ruby -e "require %q(yaml); YAML.load_file(%q(.github/workflows/ci.yml))": passed
  • .venv/bin/pytest tests/test_uv_workflows.py::test_required_ci_checks_fail_when_dependency_locks_fail -q: 1 passed
  • .venv/bin/ruff check tests/test_uv_workflows.py: passed
  • .venv/bin/ruff format --check tests/test_uv_workflows.py: passed
  • git diff --check origin/main...HEAD: passed
  • Full tests/test_uv_workflows.py: not claimed. The first unrelated local failure is test_editable_project_sync_requires_only_the_reviewed_root_build_exemption: the installed uv is 0.6.14, while CONTRIBUTING.md requires uv >=0.12.1; uv 0.6.14 rejects the test command combination --frozen --dry-run before the dependency assertion runs.

@Hughhhhcoder
Hughhhhcoder requested a review from a team as a code owner September 2, 2026 04:19
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 2, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-03T09:22:39.341424Z ae89f1d Manual request
🔒 Security Review Completed 2026-09-03T09:23:41.949753Z ae89f1d Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

fscfede-beep commented Sep 2, 2026

Copy link
Copy Markdown

One narrow hardening suggestion after comparing this with #3756 and reproducing the dependency-result behavior in GitHub Actions:

  1. Move the needs.dependency-locks.result != 'success' guard before actions/checkout, so a failed provenance/lock gate causes the required job to fail before any repository-controlled action or checkout step runs.
  2. Consider !cancelled() rather than always() for the job-level status function if you want to preserve normal workflow cancellation while still preventing implicit skip-on-failed-needs behavior.
  3. Make the regression test assert that the failure guard is the first executable step, so the fail-closed ordering cannot regress later.

The current patch still addresses the original skipped-required-check failure mode; these points are about tightening failure ordering and cancellation semantics.

@Hughhhhcoder

Copy link
Copy Markdown
Author

Thanks for the focused hardening suggestions. I applied them in commit cd93054:

  • required jobs now use !cancelled() so normal cancellation is preserved;
  • the dependency-lock failure gate is the first executable step, before actions/checkout or any repository-controlled action;
  • the regression test now asserts that ordering explicitly.

Validation:

  • .venv/bin/pytest tests/test_uv_workflows.py::test_required_ci_checks_fail_when_dependency_locks_fail -q — 1 passed
  • Ruff check and format check for tests/test_uv_workflows.py — passed
  • Ruby YAML parse of .github/workflows/ci.yml — passed
  • git diff --check — passed

The full tests/test_uv_workflows.py run was started, but its existing isolated security-update subprocess cases did not finish after eight minutes in this local environment, so I stopped that run without changing repository files.

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Security review completed. No security issues were found in this pull request.

Reviewed commit: cd930546fe

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: cd930546fe

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread .github/workflows/ci.yml Outdated
Comment on lines +77 to +78
!cancelled() &&
(github.event_name == 'push' || github.event_name == 'merge_group' || github.event.pull_request.head.repo.fork)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Propagate failures on non-fork pull requests

For any non-fork pull_request, this condition remains false even when needs.dependency-locks.result == 'failure', so the job never reaches the new failure step and GitHub reports the required lint/build/test job as skipped. This is especially consequential for the dependency job's PR-only Dependabot security-floor check: that check can fail while every required downstream context still satisfies branch protection. Include the dependency-failure case in the outer condition for all four jobs and cover a non-fork PR in the regression test.

AGENTS.md reference: AGENTS.md:L41-L45

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Addressed in commit 238b68e. The outer condition for all four required jobs (lint, build, test, and test-httpx2) now also includes needs.dependency-locks.result == 'failure'. This makes a same-repository pull request, where head.repo.fork is false, enter the job when dependency-lock validation fails; the first step then fails the required check before checkout. The workflow regression test now asserts this guard and the non-fork failure case. Validation passed: direct execution of test_required_ci_checks_fail_when_dependency_locks_fail, Ruff check/format, YAML parsing, and git diff --check. The full pytest command remains unavailable locally because the repository conftest.py requires the missing httpx2 module.

@Hughhhhcoder

Copy link
Copy Markdown
Author

Validation note correction for clarity:

I reran the workflow test suite and isolated the first failure. The failing test is unrelated to this patch: the local uv is 0.6.14, while CONTRIBUTING.md requires uv >=0.12.1, and uv 0.6.14 rejects the test command combination --frozen --dry-run before the dependency assertion runs. The xdist run had 170 tests passed before reporting that environment failure; I stopped the remaining workers. No repository files were changed by the test run.

The focused regression test still passes (1 passed), and the YAML parse, Ruff check, Ruff format check, and git diff --check validations pass. I updated the PR description to record this accurately.

@Hughhhhcoder

Copy link
Copy Markdown
Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Bravo.

Reviewed commit: 238b68e346

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@chatgpt-codex-connector

Copy link
Copy Markdown

Security review completed. No security issues were found in this pull request.

Reviewed commit: 238b68e346

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

Copy link
Copy Markdown

Follow-up hardening from the earlier review: the current head 238b68e aligns the early guard on needs.dependency-locks.result != 'success', but the job-level predicate still explicitly propagates only == 'failure'. That leaves a semantic asymmetry for non-success dependency states such as skipped (and potentially cancelled).

Proposed minimal alignment for each of lint, build, test, and test-httpx2:

if: >-
  !cancelled() &&
  (needs.dependency-locks.result != 'success' ||
   github.event_name == 'push' ||
   github.event_name == 'merge_group' ||
   github.event.pull_request.head.repo.fork)

The existing first executable guard can remain unchanged. This keeps !cancelled() as the workflow cancellation boundary while making the scheduler predicate and fail-closed guard use the same definition of green. I have a locally verified exact-4 transformation/regression model; this comment is a proposal only, not a claim that upstream has applied it.

@fscfede-beep fscfede-beep left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 remains on the current candidate: the job-level predicate for lint/build/test/test-httpx2 still excludes non-fork pull requests when dependency-locks fails. The early needs.dependency-locks.result != 'success' step cannot run if the job itself is skipped. Please include the dependency result in the job-level condition for all four required jobs, e.g. !cancelled() && (github.event_name == 'push' || github.event_name == 'merge_group' || github.event.pull_request.head.repo.fork || needs.dependency-locks.result != 'success'). Keep the early guard before checkout. This is required to actually close the same-repo failure path described by the P1 review.

@fscfede-beep fscfede-beep left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Correction to my previous CHANGES_REQUESTED review: I re-read the current head 238b68e346 and the same-repository dependency-locks == 'failure' path is already included in the job-level predicate for the four required jobs, so that P1 blocker was stale/incorrect. I withdraw it as a blocker.

The remaining != 'success' observation is only a non-blocking semantic-hardening suggestion for other non-success dependency states such as skipped; it is not required to close the reported failure path. Sorry for the noise.

@Hughhhhcoder

Copy link
Copy Markdown
Author

Addressed in commit ae89f1d. The four required jobs now use needs.dependency-locks.result != 'success' in their job-level predicate, while retaining !cancelled(); this covers skipped and failed dependency gates without overriding workflow cancellation. The first-step fail-closed guard remains in place. tests/test_uv_workflows.py::test_required_ci_checks_fail_when_dependency_locks_fail passes, and Ruff/format/diff checks pass.

@Hughhhhcoder

Copy link
Copy Markdown
Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. You're on a roll.

Reviewed commit: ae89f1d307

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@chatgpt-codex-connector

Copy link
Copy Markdown

Security review completed. No security issues were found in this pull request.

Reviewed commit: ae89f1d307

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

@Hughhhhcoder

Copy link
Copy Markdown
Author

Thanks for the correction. I rechecked the current head (ae89f1d): all four required jobs include the needs.dependency-locks.result != 'success' branch in their job-level conditions, so the same-repository failure path is covered without another code change.

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.

Required checks lint, build and test are satisfied by a skip when dependency-locks fails

2 participants