Skip to content

fix(ci): fail-to-pass refuses the fix of a red main #5590

Closed

Description

@dan-petty

Problem

The Fail-to-Pass Check refuses the fix of a red main. When main is red, no fix pull request can get all its checks green, so the CI stays broken until a person accepts a failed check by hand.

On 2026-11-14 at 00:00 UTC, three entries of .trivyignore-mcp-server expired. No commit changed. Since then, tests/invariants/test_mcp_server_image.py::test_every_mcp_server_trivyignore_entry_has_a_reason_and_an_exp_date_that_is_not_past fails on main and on each pull request that CI tests after that time. On 2026-11-14 at 01:30 UTC, this one test made a Tests & Coverage shard fail on 8 open pull requests and on main (release pull request #5574, "Tests on Main").

PR #5584 (#5573) is the fix. It renews the entries and bumps helm. All required checks pass. But the replay of Fail-to-Pass Check finds 2 tests that fail on the base:

  • test_the_kubectl_and_helm_pins_hold_the_go_builds_that_fix_the_stdlib_findings: the fix changes this test. It proves the fix.
  • test_every_mcp_server_trivyignore_entry_has_a_reason_and_an_exp_date_that_is_not_past: the fix does not change this test function. The fix changes the file that the test reads.

The check stops with: A test that the fix does not change fails on base (...). A test that fails on base must be one that the fix adds or changes. (src/devops_cli/ci/fail_to_pass.py, _unsatisfied_reasons).

The rule cannot tell these two cases apart:

  1. A test fails on the base for a cause that the fix does not touch. The replay is not clean, and the refusal is correct.
  2. The base is red, and the fix makes the red test green. The fix repairs main, and the refusal blocks the repair.

devops pr ready refuses a draft with any failed check, required or not, unless an operator adds --force. So in case 2, an agent cannot mark the fix ready, and each other fix for main gets the same refusal. A fix of the check itself also gets the same refusal, and it fails the same red shard.

Expected behavior

A fix whose head makes a red base test pass does not get a refusal for that test. The check still refuses a fix when a test that the fix does not change fails on the base and also fails on the head.

Fix options (the plan decides)

  • Refuse for an unchanged test only when it fails on the base and on the head. A test that fails on the base and passes on the head is a repair, not a cause of an unclean replay. The fix must still add or change one test that fails on the base.
  • Or read the result of Tests & Coverage of main at the base commit (the Tests on Main check reads it already). If that run failed on the same test, report the test as "red on main, repaired by this fix" and do not refuse.
  • Test first: a replay where the base fails one changed test and one unchanged test, and the head passes both, satisfies the gate. A replay where the unchanged test fails on the base and on the head still gets the refusal.

Related

Evidence

Source: #5584

Proposed design

Problem statement

The Fail-to-Pass Check refuses a fix of a red main. It refuses each unchanged test that fails on the merge base, even when the fix makes that test pass on the head. So a fix that repairs a red main cannot satisfy the check, and an agent cannot mark it ready.

Acceptance criteria

Requirement: A repaired unchanged test does not refuse the replay

The fail-to-pass check SHALL not refuse a replay for an unchanged test that fails on the merge base and passes on the head.

Scenario: A red base test that the head repairs

  • WHEN An unchanged test fails on the base tree and passes on the head tree.
  • THEN The report holds no unchanged failure for the test. The replay is satisfied when a changed test fails on base.

Requirement: An unchanged test that fails on both trees refuses the replay

The fail-to-pass check SHALL refuse a replay when an unchanged test fails on the merge base and on the head.

Scenario: An unchanged test that still fails on the head

  • WHEN An unchanged test fails on the base tree and on the head tree.
  • THEN The report names the test in its unchanged failures. The replay is not satisfied.

Requirement: The head replay uses a worktree of a named head

The check SHALL replay the test files that hold an unchanged failure on a detached worktree of a named head.

Scenario: A named head ref

  • WHEN The check runs with a head ref other than HEAD, and the base run holds an unchanged failure.
  • THEN The head run uses a detached worktree of that ref.

Requirement: The head replay uses the working tree for HEAD

The check SHALL replay the test files that hold an unchanged failure on the working tree when the head is HEAD.

Scenario: The default head

  • WHEN The check runs with the default head HEAD, and the base run holds an unchanged failure.
  • THEN The head run uses the working tree and adds no worktree.

Requirement: The report names a repaired test

The report SHALL name each unchanged test that fails on base and passes on head as repaired on the head.

Scenario: A repaired test in the report

  • WHEN An unchanged test fails on base and passes on head.
  • THEN The formatted report holds a line that names the test and the head repair.

Requirement: A head run that cannot run refuses the replay

The check SHALL refuse the replay when the head run of the test files that hold an unchanged failure cannot run.

Scenario: A head run that writes no complete report

  • WHEN The head run of the test files that hold an unchanged failure writes no complete JUnit report.
  • THEN The report names the head run as could not run. The replay is not satisfied.

Requirement: The dry run lists the head test run

The dry run SHALL list the head run of the test files that hold an unchanged failure.

Scenario: A dry run of the check

  • WHEN devops ci fail-to-pass --dry-run runs for a fix that changes a test file.
  • THEN The planned requests hold the head pytest run, with its condition.

Existing Tool Considered

git worktree (open, maintained) gives the base and head trees. pytest (open, maintained) gives the JUnit outcomes. Neither classifies an unchanged failure as a repair. The change adds that classification to the in-repo check src/devops_cli/ci/fail_to_pass.py. Written cost: about 100,000 tokens to build, keep and fix the classification and its tests, over about 4 hours of elapsed time.

Key questions

  • Which fix option does the check take: compare the base and head outcomes, or read the Tests & Coverage run of main?: The check compares the base and head outcomes. (best practice) [sources: src/devops_cli/ci/fail_to_pass.py, CONTRIBUTING.md, tests/invariants/test_mcp_server_image.py:167]
    • Chosen: Compare the base and head outcomes. It needs no network, reuses the head tree, and classifies each test from its own run.
    • Rejected: Read the Tests & Coverage run of main. It adds a GitHub API read and must map a test to a run artifact, and the check reads no GitHub state today.
  • How does the head run get the head tree?: It uses the working tree for HEAD and a detached worktree of a named ref, as the gate row head run does. (best practice) [sources: src/devops_cli/ci/fail_to_pass.py]
    • Chosen: Reuse the gate row head tree pattern. It keeps one rule for the head tree and adds no worktree for the default HEAD.
    • Rejected: Always add a detached worktree. It copies the checkout and misses an uncommitted change of the working tree.
  • Does a repaired test alone satisfy the gate?: No. The repair removes the refusal for that test, and the gate still needs one changed test that fails on base or a proved gate case. (best practice) [sources: CONTRIBUTING.md, src/devops_cli/ci/fail_to_pass.py]
    • Chosen: Keep the changed-test rule. The check must still prove that the fix adds or changes a test that fails on base.
    • Rejected: Let a repair satisfy the gate alone. A fix could then pass with no changed test, and the check would prove nothing about the fix.
  • Which test files does the head run replay?: Only the test files that hold an unchanged failure, and only when the base run holds one. (best practice) [sources: src/devops_cli/ci/fail_to_pass.py]
    • Chosen: Replay only the files with an unchanged failure. It saves a second pytest run for each fix that has no unchanged failure.
    • Rejected: Replay every changed test file on the head. It doubles the replay cost for a result that no unchanged failure needs.
  • Should the report name a repaired test?: Yes. The report adds a line that names each repaired test, so the author sees why the replay passes. (best practice) [sources: src/devops_cli/ci/fail_to_pass.py, CONTRIBUTING.md]
    • Chosen: Name the repaired tests. The author can tell a repair from a pass and check the red main cause.
    • Rejected: Keep the report silent. A silent repair hides why an unchanged test no longer refuses the replay.
  • What does the check do when the head run cannot run?: It refuses the replay and names the head run as could not run, as it does for the base run. (best practice) [sources: src/devops_cli/ci/fail_to_pass.py]
    • Chosen: Refuse and name the head run. The check cannot prove the repair without a head outcome, and the author sees the cause.
    • Rejected: Treat the test as failing on head. The report would say the test fails on head when no run showed that.

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Activity

  1. added
    type/bug
    source/agent
    scope/ci
    status/new
    value/high
    effort/medium
    on Nov 14, 2026
  2. dan-petty commented on Nov 14, 2026

    @dan-petty
    OwnerAuthor
    • Priority: P1-High. Blocks the ability to land any fix for a broken main, so all other CI repairs are stalled. The failed run 43535866392 does not set P0: the author has no write access, and no caller attached it as evidence. A person can set P0 with the label priority/p0-critical.
    • Related: fix(roadmap): keep no tool versions in runner_tools.py #5585, which asks for a different change. Both target the Fail-to-Pass Check, but #5585 scopes when the check runs, while this item changes the refusal rule so a repair of a red main is accepted.
  3. added
    priority/p1-high
    on Nov 14, 2026
  4. added
    status/ready
    and removed
    status/new
    on Nov 14, 2026
  5. devops-cli-service commented on Nov 14, 2026

    @devops-cli-service
    Contributor

    Status set to Ready at 9de03b4 (see proposed design in issue body).

  6. added
    owner/service
    on Nov 14, 2026
  7. devops-cli-service commented on Nov 14, 2026

    @devops-cli-service
    Contributor

    Staged: branch fix/5590-fail-to-pass-refuses-the-fix, draft pull request #5596. The pull request plans the item and closes no issue.

    The task groups, with the tokens of the inputs of each step, for a budget of 64000 tokens:

    1. Replay the unchanged failures on the head tree and refuse only a test that does not pass there: 39422 tokens
    2. List the head replay in the dry run: 24937 tokens

    The runs of the planner and the review made 44 model request(s), and used 2569933 input tokens and 49163 output tokens. The tool calls, in order:

    1. list_files({"directory":"src/devops_cli/ci"})
    2. read_spec({"capability":"ci-fail-to-pass"})
    3. read_spec({"capability":"ci-fail-to-pass","requirement":"A failed test that the fix does not change refuses the replay"})
    4. read_spec({"capability":"ci-fail-to-pass","requirement":"The dry run lists the gate row runs"})
    5. read_file({"path":"src/devops_cli/ci/fail_to_pass.py","start_line":560,"end_line":960})
    6. read_file({"end_line":900,"path":"src/devops_cli/ci/fail_to_pass.py","start_line":706})
    7. read_file({"end_line":560,"path":"src/devops_cli/ci/fail_to_pass.py","start_line":460})
    8. search_code({"text":"unchanged_failed"})
    9. list_files({"directory":"tests/ci"})
    10. search_code({"text":"def test_"})
    11. file_symbols({"path":"tests/ci/test_fail_to_pass.py"})
    12. read_file({"path":"tests/ci/test_fail_to_pass.py","start_line":130,"end_line":330})
    13. read_file({"end_line":1060,"path":"tests/ci/test_fail_to_pass.py","start_line":779})
    14. read_file({"end_line":2330,"path":"src/devops_cli/lang/en/messages.py","start_line":2255})
    15. search_code({"text":"CONST_FAIL_TO_PASS"})
    16. callers({"symbol":"plan_fail_to_pass"})
    17. callers({"symbol":"run_fail_to_pass"})
    18. search_code({"text":"plan_fail_to_pass"})
    19. read_file({"end_line":2830,"path":"src/devops_cli/commands/ci.py","start_line":2740})
    20. read_file({"end_line":1060,"path":"tests/ci/test_fail_to_pass.py","start_line":951})
    21. read_file({"end_line":1345,"path":"tests/ci/test_fail_to_pass.py","start_line":1160})
    22. read_file({"end_line":1110,"path":"tests/ci/test_fail_to_pass.py","start_line":1061})
    23. read_spec({"capability":"ci-fail-to-pass","requirement":"The head run of a named head uses a worktree of that head"})
    24. read_spec({"capability":"ci-fail-to-pass","requirement":"A replay that cannot run names the next step"})
    25. read_file({"path":"src/devops_cli/dry_run/requests.py"})
    26. read_spec({"capability":"ci-fail-to-pass","requirement":"One new test that fails on base keeps the replay valid"})
    27. read_spec({"capability":"ci-fail-to-pass","requirement":"A host path guard failure refuses the replay"})
    28. search_code({"text":"REQUIREMENT_TEXT"})
    29. search_code({"text":"FailToPassReport("})
    30. search_code({"text":"fail_to_pass_unchanged_failed"})
    31. search_code({"text":"_replay_report("})
    32. search_code({"text":"fail-to-pass"})
    33. search_code({"text":"fails on base"})
    34. read_spec({"capability":"ci-fail-to-pass","requirement":"The replay reads no title, label or body"})
    35. search_code({"text":"does not change fails on base"})
    36. search_code({"text":"not change"})
    37. search_code({"text":"_run_pytest_on_base"})
    38. search_code({"text":"_run_gate_rows_on_head"})
    39. list_files({"directory":"tests/ci/__snapshots__"})
    40. search_code({"text":"test_fail_to_pass.ambr"})
    41. read_file({"path":"tests/ci/__snapshots__/test_fail_to_pass.ambr","start_line":1,"end_line":40})
    42. search_code({"text":"_run_gate_rows_on_head"})
    43. read_file({"path":"src/devops_cli/ci/fail_to_pass.py","start_line":560,"end_line":860})
    44. read_spec({"capability":"ci-fail-to-pass"})
    45. read_spec({"capability":"ci-fail-to-pass","requirement":"A failed test that the fix does not change refuses the replay"})
    46. search_code({"text":"def test_fail_to_pass_runs_the_processes_of_its_plan"})
    47. read_file({"path":"tests/ci/test_fail_to_pass.py","start_line":1000,"end_line":1075})
    48. read_file({"path":"src/devops_cli/ci/fail_to_pass.py","start_line":175,"end_line":330})
    49. read_file({"path":"src/devops_cli/ci/fail_to_pass.py","start_line":706,"end_line":1000})
    50. references({"name":"_run_pytest_on_base"})
    51. search_code({"text":"devops ci test tests/"})
    52. search_code({"text":"fail_to_pass_unchanged_failed"})
    53. read_spec({"capability":"ci-fail-to-pass","requirement":"The dry run lists the gate row runs"})

    Tool calls: callers=2 (empty=0), file_symbols=1 (empty=0), list_files=3 (empty=0), read_file=16 (empty=0), read_spec=11 (empty=0), references=1 (empty=0), search_code=19 (empty=0)

    The stage job read the open pull requests and their files in 1 GraphQL request(s).

  8. removed
    owner/service
    on Nov 14, 2026
  9. added 2 commits that reference this issue on Nov 14, 2026
  10. added
    status/planned
    and removed
    status/ready
    on Nov 14, 2026
  11. added
    status/in-progress
    and removed
    status/planned
    on Nov 14, 2026
  12. added a commit that references this issue on Nov 14, 2026
    cdae11a
  13. added
    status/in-review
    and removed
    status/in-progress
    on Nov 14, 2026
  14. removed
    status/in-review
    on Nov 14, 2026
  15. devops-cli-service commented on Nov 14, 2026

    @devops-cli-service
    Contributor
  16. devops-cli-service commented on Nov 14, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-14 21:08 UTC

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    effort/mediumpriority/p1-highscope/cisource/agenttype/bugvalue/high

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions