Skip to content

Main's CI goes red on flaky tests, and the CI-red Ticket loop stalls on them #1561

Closed

Description

@JacobStephens2

What happened

Main's push CI failed 5 times in about 40 runs on Oct 27–28. Every failure was a flaky test, not a regression:

Run Job Test Cause
40763918664 macOS shard 4 a_timeout_is_failed_even_after_repository_changes_and_its_descendants_end, code_graders::check_timeout_cleans_descendants_before_packet_and_remains_failed --timeout 1 also bounds the model Grader and code checks
40552542970 macOS shard 1 timed_out_trials_keep_partial_usage_and_exportable_session_ancestry (#1458) --timeout 1 cut the agent off before its usage line
40507532942 macOS shard 4 a_baseline_built_before_this_change_pauses_at_its_live_warning timing ("the warned Trial kept working")
40734161876 Linux test stop_and_resume_preserve_finished_trials_and_refuse_a_changed_bar died before recording an outcome instead of interrupted: a race between Stop and the Trial's own end
40627267443 console-test Command details opens with the Inbox subject and full title above its actions (inbox.test.cjs:202) layout measured before render (height: 0)

#1560 fixes the first two rows. The other three are still open.

Why PRs don't catch these

  • On a PR, the macOS job runs only the macos-gate subset of tests. The full suite runs on macOS only after a push to main, so a macOS-only flake shows up first on main.
  • A test that fails 1 time in N passes on most PR runs.

Why the existing loop doesn't repair main

Pickup files a CI red on main bug Ticket (#1342), but only when no CI-red Ticket is open. #1458 was filed for row 2. Its Ticket run could not reproduce a macOS timing failure on Linux, so it ended with needs-info. That open needs-info issue then stopped Pickup from filing a Ticket for row 1. Main stayed red, and no Ticket was filed or run for it.

Options, as I'd rank them

  1. Make the CI-red Ticket loop handle flakes. Before filing, Pickup re-runs main's failed jobs once (gh run rerun --failed), as a Check re-run does for a Ticket run (ADR-0010). If the re-run passes, main is green again with no session. The failure is then filed as a flaky Ticket that names the test and both runs, and its Ticket run fixes the timing dependence instead of needing a deterministic repro. A CI-red Ticket in needs-info should not stop Pickup from filing a new report. When an open CI-red Ticket covers a different commit or test, Pickup comments on it instead of staying silent.

  2. A coding standard for deadlines in tests. Integration tests should not use deadlines of a second or so, because they share runners with everything else. A test that needs something to time out makes that thing hang, and gives everything else several seconds. Add this to CODING_STANDARDS.md so the Standards review checks it.

  3. Find flakes before they reach main. Two choices, each with a cost:

    • a scheduled workflow that runs the full macOS suite on main a few times each night;
    • running the full macOS suite on PRs that touch tests/experiments* or src/evals/.

    nextest retries would make main green but hide the flake, so I'd only use it together with option 1's reporting.

A separate thirdshift command to check and repair main would mostly repeat what Pickup already does every 2 minutes. The gap is in what happens after Pickup files the Ticket, not in noticing that main is red.

Activity

  1. added
    enhancement
    needs-triage
    on Oct 28, 2026
  2. JacobStephens2 commented on Oct 29, 2026

    @JacobStephens2
    OwnerAuthor

    This was generated by AI during triage.

    The maintainer chose options 1 and 2 on 2026-10-29. Option 2, a coding standard for deadlines in tests, is being done separately; this issue is option 1 only. Option 3 is not being done.

    Agent Brief

    Category: enhancement
    Summary: Pickup re-runs a failed Base branch push CI run once before filing a CI-red Ticket. It files a flaky-test Ticket when the re-run passes, and a CI-red Ticket in needs-info no longer blocks a new report.

    Current behavior:
    Each Pickup pass reads the Base branch's latest push workflow run. If that run failed more than 30 minutes ago, Pickup files one CI red on <base>: <jobs> Ticket. It labels the Ticket bug and ready-for-agent, and includes the failing commit, the run URL and the recognizable failing-test log lines. Pickup does nothing while any open issue has a title starting CI red on , whatever its labels.

    That is a problem for flaky tests. The Ticket run follows the bug path, cannot reproduce a timing failure on demand, and ends with needs-info. The Ticket stays open, so it blocks every later report while main stays red. #1458 did exactly this on 2026-10-27/28.

    Desired behavior:

    1. Re-run before filing. The Base branch's latest push run can complete as failure on its first attempt. Pickup then asks GitHub to re-run its failed jobs once (gh run rerun <id> --failed), right away, with no 30-minute grace. It says so on stderr, naming the run and the failed jobs, and files nothing on that pass. A run whose failed jobs can't be re-run, or a refused re-run request, goes straight on to filing as today. A run on a later attempt is never re-run again by Pickup.

    2. Red again. If the re-run attempt fails too, Pickup files the ordinary CI red on <base> Ticket. The 30-minute grace still applies, timed from the re-run attempt's completion. The body names both attempts.

    3. Green on re-run means flaky. If the re-run attempt succeeds, the Base branch is green again. Pickup files one flaky-test Ticket, with a title that is distinct from CI red on and recognizable, such as Flaky CI on <base>: <jobs>. Its body has:

      • the commit;
      • the URLs of both attempts;
      • the failing jobs, and the recognizable failing-test lines from the failed attempt;
      • a statement that the same commit passed on re-run.

      Pickup files only one per failed attempt, and doesn't file one while an open flaky-test Ticket already names the same test.

    4. No reproduction for a flaky Ticket. A flaky-test Ticket's run does not end with needs-info for failing to reproduce the failure on demand. The recorded failure is the evidence. The fix is to remove the test's dependence on timing or scheduling, or the race it exposes. Choose the mechanism, such as its labels or session prompt, so the existing bug Ticket path is unchanged for every other bug.

    5. needs-info no longer blocks. An open CI-red Ticket labelled needs-info doesn't stop Pickup filing a new CI-red Ticket.

    6. New failures get noticed. Suppose an open CI-red Ticket, not in needs-info, names a different failing commit than the current failure. Pickup then comments the new failure's evidence on that Ticket instead of filing nothing. The comment has the commit, the run URL and the failing-test lines, and is posted at most once per failing commit.

    7. Unchanged: read failures still warn and let Pickup continue; red Base branch CI still doesn't hold Self-merges; Base fixes are unaffected; and the cross-host CI filing reservation still covers filing, commenting and re-running.

    Key interfaces:

    • The Base branch CI evidence reader (base_ci_failure today) reads the run's attempt number, plus the previous attempt's outcome and jobs when there is one.
    • The CI-red filing step in Pickup (file_ci_red_ticket today) gains these outcomes: re-run requested, ordinary Ticket filed, flaky Ticket filed, comment posted, nothing to do.
    • Pickup's documentation in docs/guide.md describes the new behaviour, and so do the hand-written site pages that mention the CI-red Ticket (search for "30 minutes ago" in site/how-it-works/ and site/architecture/). Record the decision in an ADR next to ADR-0010 and ADR-0020, the Check re-run and Abandoned-job re-run ADRs.

    Acceptance criteria (the first six are Pickup tests driven by the fake gh):

    • A first-attempt failed push run makes Pickup request one re-run of its failed jobs and file nothing.
    • A second-attempt failure older than 30 minutes files CI red on <base> with both attempts' evidence. A second-attempt failure is never re-run.
    • A second attempt that succeeded after a failed first files one flaky-test Ticket with the failed attempt's test lines. A later pass files no duplicate.
    • An open CI red on Ticket labelled needs-info doesn't block filing for a new failure.
    • An open CI red on Ticket for a different commit gets one comment for the new failing commit, and only one, across repeated passes.
    • A refused or impossible re-run warns and falls back to today's filing.
    • A Ticket run on a flaky-test Ticket goes through the implementation path without the bug-reproduction ending, and the existing bug Ticket tests still pass.

    Out of scope:

    • Re-running failed checks on Issue branches or Spec PRs. The Check re-run and Abandoned-job re-run already cover those.
    • Holding Self-merges on red Base branch CI.
    • Nightly or extra macOS CI runs, test retries in nextest, and any ci.yml change.
    • Fixing any particular flaky test.
  3. added
    ready-for-agent
    in-progress
    and removed
    needs-triage
    ready-for-agent
    on Oct 29, 2026
  4. removed
    in-progress
    on Oct 29, 2026
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

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions