Skip to content

Keep Free Tests planning under its job cap when the duration seed goes stale (GST-2193) - #4245

Merged
capy-ai[bot] merged 3 commits into
mainfrom
capy/free-seed-unseeded-cap
Nov 9, 2026
Merged

capy-ai[bot] merged 3 commits into
mainfrom
capy/free-seed-unseeded-cap

Conversation

@garrytan

@garrytan garrytan commented Nov 9, 2026 •

Copy link
Copy Markdown
Owner

What changed

Free Tests no longer fails to plan when the test-duration seed falls behind, and the seed is current again.

  • Fresh seed. scripts/free-test-durations.json is re-recorded from run 42691699570 on main: 1,661 files, 0 failed while recording. The old seed (2026-10-31) was missing 196 files, and every Free Tests shard job carried a 77-minute timeout. With the fresh seed the planner prints no unseeded warning and the shard timeout is 48 minutes. That is the real figure, not the ~38 the audit estimated, because the 196 new files take 1,510 s together. The 1,465 files both seeds share moved from 5,154 s to 5,769 s, with a per-file median ratio of 1.008, so the recording is consistent with the last one.
  • Unseeded files can't push a plan over the cap. Files missing from the seed are still packed at the seed's 99th percentile. When that estimate would push a shard's job past the 90-minute cap, --ci-plan --job-setup-seconds now cuts that shard's prediction back to the cap, instead of throwing FREE_JOB_TIMEOUT_OVER_CAP for every PR and main. The runner wall and the GitHub job timeout both read the capped prediction from the plan, so GitHub still never kills a job before the runner can name a hung file. Recorded durations are never cut: a shard whose seeded files alone need more than 90 minutes still fails the plan. Plans under the cap are byte-for-byte unchanged.
  • Closed seed PRs raise a blocker. When the weekly recorder's seed PR (bot/free-duration-seeds) is closed without merging, free-durations-record.yml opens (or comments on) a GitHub issue titled "Blocker: free-suite duration seed PR closed unmerged" and turns that run red. A seed PR that merges closes the issue. The trigger is pull_request: closed filtered to PRs touching the two seed files, and the recording jobs skip that event.
  • Eight new slow files admitted. The fresh seed records eight files over the 60 s ceiling. Each becomes an annotated exception in scripts/free-test-seed-allowlist.json (todo: "split or speed up; post-11-21 slow-test pass"), as the ratchet's shrink-only rule requires.

Why

The audit (GSTA-461, item 1) measured new test files arriving at about 22 a day. About 60 more unseeded files would have made the planner throw on every PR and on main, roughly 3 days from 11-09. The last two weekly seed PRs were closed unmerged (#3452, #3835), and the 11-09 scheduled recording opened none.

Blast radius

Free Tests planning (scripts/test-free-shards.ts createFreeCiPlan / --ci-plan), the duration seed and its allowlist, and the weekly recorder workflow. The Windows lane plans without --job-setup-seconds and is unchanged. No merge-check, pregate, ship-queue or receipt code changed.

Tests

Written first on f75ce6f and failing there:

  • test/test-free-shards.test.ts: a shard over the cap only because of unseeded files now plans at 90 min, and the real --ci-plan CLI with a stale seed exits 0 with every timeout ≤ 90.
  • test/free-durations-record-workflow.test.ts: the blocker step, run against a stub gh: it creates the issue, comments on an existing one, closes it on merge, and stays quiet on a merge with no open issue.

Hold tests that pass before and after: a plan under the cap is identical with or without the cap, and recorded durations over the cap still throw. test/free-tests-workflow-wiring.test.ts now plans the same way the CLI does.

Documentation

Documentation exception: accepted by GStack Minder (GSTA-36) 2026-11-09 via Captain ruling relayed by lane GSTA-464 on the /ship cap raise: docs/TESTING_INTERNALS.md is outside this lane: record the two corrections as a follow-up and do not edit that file

Status: blocked. The read-only audit found two factual corrections needed in docs/TESTING_INTERNALS.md; no files were edited.

Scope: committed diff f75ce6f..465e846 on capy/free-seed-unseeded-cap (3 commits, 8 files: free-durations-record.yml, test-free-shards.ts, the duration seed, the seed allowlist, a changelog fragment and 3 tests). Nothing staged, unstaged or untracked.

Documentation health:

  • docs/TESTING_INTERNALS.md: needs update. The CI job-timeout paragraph overstates FREE_JOB_TIMEOUT_OVER_CAP: the plan now caps unseeded overestimates and fails only when recorded durations exceed 90 minutes. The duration-seed section lacks the closed-unmerged seed PR blocker issue.
  • changelog.d/free-seed-unseeded-cap.md: current (matches the code).
  • .github/workflows/free-durations-record.yml header comment: current.
  • scripts/free-test-seed-allowlist.json annotations: current.
  • README.md, CONTRIBUTING.md, AGENTS.md: current (they don't cover this behavior).

Coverage debt: maxPredictedMsUnderJobCap and the capped-prediction behavior of --ci-plan --job-setup-seconds have reference coverage only in code comments and the changelog fragment until TESTING_INTERNALS is corrected. The seed-PR blocker issue has no reference docs outside the workflow comment. Eight new allowlist exceptions carry a 'post-11-21 slow-test pass' todo, so that is tracked debt.

Diagram drift: none; no diagrams reference the shard planner or the seed recorder.

Agent notes
  • Review note 1 (below the floor, not fixed): if the bot seed PR is closed because the seed landed some other way, such as a hand-recorded seed PR or a wave merge, the new job still raises the blocker issue and a red run. The issue body says to close it by hand in that case.

  • Review note 2 (below the floor, not fixed): GitHub may hold the closed-event run on a PR the workflow token opened, so the blocker job could fail to run. No run has shown this. The pull_request_target alternative was declined as a security trade-off.

  • Docs follow-up 1: docs/TESTING_INTERNALS.md (around lines 215-217) still says any shard over 90 minutes fails the plan with FREE_JOB_TIMEOUT_OVER_CAP. With --job-setup-seconds, the plan now cuts the unseeded estimate back to the cap and fails only when recorded durations alone pass it.

  • Docs follow-up 2: the "Free suite duration seed" section of docs/TESTING_INTERNALS.md (around lines 1583-1632) doesn't mention the new pull_request: closed trigger or the blocker issue it opens and closes. Both docs fixes are outside this lane; the documentation exception was accepted by GStack Minder (GSTA-36).

  • Plan: exempt: bug fix (kind fix), failing-first test shown on f75ce6f

  • Likely regression, not just slow files: test/review-pass.test.ts went from 24 s (2026-10-31 seed) to 221 s (about 9x), and test/review-exclude.test.ts (new to the seed) records 126 s. Not investigated here; flagged for the post-11-21 slow-test pass.

  • The 11-09 scheduled recorder run (42560745759) proposed nothing because its Windows recording was cancelled at the 30-minute job timeout and propose needs both artifacts. Not changed here.

  • Recorder run 42691699570 was dispatched for this lane on main; its Linux artifact is the committed seed. The Windows seed is not part of this PR.

  • Thread GSTA-464, issue GST-2193, source audit reports/GSTA-461.md item 1.

Open in Capy

Agent notes
{
  "schema_version": 1,
  "pr": 4245,
  "head": "465e8467fad7ce88d2ae54b50b3fdc3525020f50",
  "version": "1.98.0.0",
  "base": "main",
  "gate": {
    "focused": {
      "pass": 111,
      "fail": 0,
      "skip": 0
    },
    "seed-ratchet": {
      "pass": 12,
      "fail": 0,
      "skip": 0
    },
    "module-size": {
      "pass": 6,
      "fail": 0,
      "skip": 0
    }
  },
  "session_kind": "unattended",
  "head_tree": "39d4426fa78e10463a589442ca2ac4b70380b634",
  "product_patch_id": "bae4318f4283446db6c5bf7c6b97f746cf58009f",
  "gstack_version": "1.98.0.0",
  "review_depth": {
    "depth": "full",
    "class": "gate",
    "runtime_lines": 3160,
    "rules": "66e5174161eecc2c",
    "base": "f75ce6fdcc14e6398b00645c1608e834d766a922",
    "registry": "f75ce6fdcc14e6398b00645c1608e834d766a922",
    "gate_scan": {
      "tagged": 2,
      "head": "465e8467fad7ce88d2ae54b50b3fdc3525020f50"
    },
    "reasons": [
      "gate-class",
      "risk:secret",
      "runtime=3160"
    ],
    "risk": [
      "secret"
    ],
    "mode": "panel"
  },
  "pregate": "requires-remote cleared @39d4426fa78e (8 checks, current for 465e8467fad7)",
  "requires_remote": [
    "free-tests.yml/macos-named-regressions: https://github.com/garrytan/gstack/actions/runs/42694821144/attempts/1",
    "pregate.json/remote_gate: remote-gate tree=39d4426fa78e tests=36883 skipped=68 runs=42694821144/1 profiles=ci-reuse/free-tests heads=465e8467fad7 verified=2026-11-09T21:39:50.179Z"
  ],
  "issues": {
    "fixes": [],
    "refs": [],
    "flakes": []
  },
  "docs": {
    "status": "blocked",
    "scope": "docs/, README.md, CONTRIBUTING.md (read-only audit docs-4245-a1)",
    "exception": {
      "accepted_by": "GStack Minder (GSTA-36)",
      "date": "2026-11-09",
      "via": "Captain ruling relayed by lane GSTA-464 on the /ship cap raise",
      "reason": "docs/TESTING_INTERNALS.md is outside this lane: record the two corrections as a follow-up and do not edit that file"
    }
  },
  "review_loop": {
    "passes": 1,
    "blocking_found": 0,
    "deferred": 0,
    "noted": 0,
    "fixed": 0,
    "scope": "frozen",
    "rounds": 1,
    "dispatches": {
      "specialist": 3,
      "red-team": 1
    }
  },
  "review_targeted": {
    "classes": [
      "gate",
      "secret"
    ],
    "rules": "8811fd300bf305f0",
    "brief_sha": "7f92a0d0a8319c3c0e076fb3b1a4689c45120b2be2c14dfc7d4cb03aafa9d6a5",
    "product_patch_id": "bae4318f4283446db6c5bf7c6b97f746cf58009f",
    "status": "done",
    "findings": 0,
    "raised_by": "targeted"
  }
}

garrytan and others added 3 commits November 9, 2026 20:25
…stale (GST-2193)

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…annotated exceptions (GST-2193)

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
@trunk-io

trunk-io Bot commented Nov 9, 2026 •

Copy link
Copy Markdown

😎 This pull request was merged.

@capy-ai
capy-ai Bot merged commit 72cbb49 into main Nov 9, 2026
53 checks passed
capy-ai Bot added a commit that referenced this pull request Nov 10, 2026
… (GST-2242) (#4254)

* Make ship-queue ready refuse when its READY note doesn't reach origin (GST-2242)

ready exited 0 and printed "notes pushed" even when the READY note never reached origin, so land refused the pin with QUEUE_NOT_READY (#4245). The notes writer now reads origin's ref back after each push, and train ready refuses with QUEUE_READY_NOTE_UNPUSHED when origin still lacks the note after three tries.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>

* Name the changelog fragment for the branch (GST-2242)

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>

* Regenerate the doctor component list for the new ready result code (GST-2242)

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>

* Say that ready's notes check covers train policies, and how to rerun it with its gate flags (GST-2242)

Review-Finding: p1/red-team#2 reader=red-team
Review-Finding: p1/red-team#1 reader=red-team
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>

* Skip the ready notes-push test on Windows, where the gh shim can't run (GST-2242)

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>

---------

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.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