Skip to content

Nightly Windows tests stop timing out: shards pack by Windows test times (GST-3440) - #4661

Merged
capy-ai[bot] merged 3 commits into
mainfrom
windows-shards-pack-by-windows-time
Nov 22, 2026
Merged

capy-ai[bot] merged 3 commits into
mainfrom
windows-shards-pack-by-windows-time

Conversation

@garrytan

@garrytan garrytan commented Nov 22, 2026 •

Copy link
Copy Markdown
Owner

The nightly Windows test run no longer cancels a shard at its 15-minute limit: files without a Windows time use their Linux time instead of a 161 s guess, and the plan adds shards past eight until no shard holds more than 12 minutes.
Why: one shard on #4646's tree held 946 s of Windows work against a 900 s job and was cancelled twice (run 44971202453); any PR adding test files could trip it.
Nothing to do: the Windows run is nightly-only and this changes no test selection, timeout or retry.

What changed

The nightly Windows run kept losing a shard to its 15-minute job limit. Files that the Windows timing record didn't list were packed as if each took 161 s, so packing balanced made-up load and some shards ended up with more real work than the job allows. Now a file missing from the Windows record uses its Linux time, and the Windows plan adds shards beyond eight (up to sixteen) until no shard is predicted past 720 s. If even sixteen shards can't fit, the plan fails and says to refresh the Windows timing record.

  • scripts/test-free-shards.ts: --windows-only --ci-plan reads free-test-durations-windows.json over free-test-durations.json per file. The new --shard-budget-seconds flag, passed only by windows-free-tests.yml with 720 (80% of the job), makes createWindowsCiPlan grow the shard count from --shards up to twice that. The scoped Windows check's single-shard listing plan takes no budget and is unchanged.
  • windows-free-tests.yml: the plan step drops its GSTACK_FREE_TEST_DURATIONS override, since the planner now reads the Windows record itself.
  • scripts/test-pr-profile.ts: an edit to scripts/free-test-durations-windows.json no longer selects paid test cases, because only the free Windows plan reads it (harness pin updated, non-behavioral).

On the committed timing records, main 7abc194 plans 8 shards with shards 1 and 7 at 835 s and 832 s; this branch plans 10 shards, the heaviest at 650 s. Replayed on #4646's tree b6d4150: the old plan's shard 3 held 946 s; the new plan has 9 shards, the heaviest at 670 s.

Evidence
  • The old plan already read the Windows seed (run 44971202453's plan log names 27 unseeded files, the Windows seed's count). The defect was the 161 s Windows 99th-percentile estimate for those files: packing balanced that phantom load, so shards with fewer unseeded files carried more real work.
  • New test in test/windows-native-workflows.test.ts runs the workflow's own plan step on the real seeds and fails if any shard's recorded Windows time (Linux fallback) or prediction passes 720 s. On main 7abc194 it fails with shards 1 and 7 at 835 s and 832 s; with the fix it passes (10 shards, heaviest 650 s).
  • Replayed on Repos can prove copied open-source files match their upstream byte for byte (GST-3298) #4646's tree b6d4150: old plan shard 3 at 946 s; new plan 9 shards, heaviest 670 s.
Why

"One shard on #4646's tree held 946 s of Windows work against a 900 s job and was cancelled twice (run 44971202453)." The nightly Windows result now completes instead of losing a shard whenever a PR adds test files.

Blast radius

Only plans built with --windows-only --ci-plan read the Windows record, and only the nightly workflow passes the budget, so the Linux plan, the scoped Windows check (--shards 1) and every PR check are unchanged. Script ran: the scoped listing plan still gives one shard, and a budget on a non-Windows plan is rejected. The aggregate and verify steps follow the plan's shard count, not a fixed eight (file read).

Test Coverage
CODE PATHS (scripts/test-free-shards.ts + windows-free-tests.yml)
├── parseCliOptions --shard-budget-seconds: [★★★ TESTED] valid/absent/invalid/wrong-mode — test/windows-native-workflows.test.ts:110-114
├── createWindowsCiPlan(): [★★★ TESTED] grow-to-fit :117; [★★★ TESTED] throw past 2x :118
├── loadWindowsFreeTestDurations(): [★★ TESTED] Linux fallback via real plan step :85-107; [GAP] Windows-over-Linux precedence; [GAP] corrupt/missing seed degrades to {}
├── main() Windows plan routing + summary line: [★★★ TESTED] :85-107
└── workflow env removed + budget flag: [★★ TESTED] :37-38
COVERAGE: 7/9 (78%) | value-weighted 7/9 (78%) | GAPS: 2

Tests: unchanged by the audit (+0 new). Coverage: 78% value-weighted (78% including 0 weakly covered paths). Test value: 0 tests written, 0 rejected by the authoring gate, 0 existing tests extended, 0 paths weakly covered.

Proposed tests for the two gaps, not written (the audit ran audit-only):

  1. Windows time wins over Linux time when both records hold a file. Value: protects=Windows-recorded time wins per file; fails_when=the merge order is swapped; why_new=the integration test sums with the same fallback order; seam=none; no_claim=record freshness.
  2. A corrupt Windows record falls back to Linux times instead of failing the plan. Value: protects=a corrupt record never breaks the plan; fails_when=it throws or returns {}; why_new=no test covers this path; seam=none; no_claim=warning wording.

Tests ran: free 1739

Pre-Landing Review

No issues found by the batched specialist (testing, security, state machines), the red team or the second-model review. The adversarial reviewer raised four notes below the blocking floor; none would fail a test, break production or lose data, so none was fixed here. Full output stays with the run.

Review notes

Below the blocking floor (advisory, informational, test-gap or wording items); recorded here and not fixed in this PR.

  • INFORMATIONAL scripts/test-free-shards.ts:396 completeness: a file missing from the Windows record packs at its Linux time, which can be near zero for a Windows-only test, and the unseeded-file warning no longer names it. Only the nightly Windows run can overrun.
  • INFORMATIONAL scripts/test-free-shards.ts:456 completeness: on a Windows plan the unseeded-file warning prints the Linux refresh command (code this PR did not change).
  • INFORMATIONAL scripts/test-free-shards.ts:521 api-contract: --job-setup-seconds is ignored in planning when --shard-budget-seconds is set; no workflow passes both.
  • INFORMATIONAL scripts/test-free-shards.ts:396 completeness: a missing Windows record falls back to Linux times without a warning, and the Windows loader ignores GSTACK_FREE_TEST_DURATIONS.
Exploratory QA

Functional (CLI scripts/test-free-shards.ts), 4 probes in a 300 s smoke budget, report-only. Verdict: pass.

  • 001 pass: --windows-only --ci-plan --shards 8 --shard-budget-seconds 720 exits 0 with 10 shards, heaviest 650 s.
  • 002 pass (checkpoint 002): a 60 s budget exits 1 with "No Windows plan of 8 to 16 shards keeps every shard within 60 s. Refresh scripts/free-test-durations-windows.json with a record_durations dispatch of windows-free-tests.yml."
  • 003 pass (checkpoint 003): --windows-only --ci-plan --shards 1 with no budget exits 0 with one shard.
  • 004 pass (checkpoint 004): --ci-plan --shards 8 --shard-budget-seconds 720 without --windows-only exits 1 ("applies only to --windows-only --ci-plan").

Not observed here: in-shard wall time on a Windows runner (Windows Free Tests run 44977432351 at e44735b passed all 10 shards and the aggregate).

Verification Results

No plan file (bug fix): 0 plan checks. The failing-first test in test/windows-native-workflows.test.ts fails on main 7abc194 (shards 1 and 7 at 835 s and 832 s) and passes here.

Scope Drift

Scope Check: CLEAN. Intent: stop the nightly Windows run losing a shard to its job limit. Delivered: Windows plans pack by Windows time with a Linux fallback and grow shards under a 720 s budget, plus the paid-selection exclusion for the Windows record.

Issues

Refs #4646

TODOS

No TODO items completed in this PR.

Documentation

Scope: I reviewed the full diff against 7abc194 (seven files) at tree 84d828421f89494dfec26755922e6c0b46c71a93. I scoped the audit by hand from the diff and from searches of docs, README, CONTRIBUTING, CLAUDE.md and AGENTS.md. I did not use the skill's audit-scope discovery helper. No staged, unstaged or new files sit outside the diff. gstack-skill-start, run with the launch env sourced, printed SESSION_KIND: spawned (SPAWNED_OVERRIDE: env (GSTACK_SESSION_KIND)).

Result: The docs are current and I changed no files. docs/TESTING_INTERNALS.md describes the Linux-time fallback and says --shard-budget-seconds 720 makes --shards 8 a floor. The workflow comment matches the new planner behavior. The changelog fragment describes the user-visible change. The searches found no stale mention of the shard count, the removed GSTACK_FREE_TEST_DURATIONS setting or the 161 s fallback.

Debt: None found. docs/TESTING_INTERNALS.md line 1848 shows the plan command without the budget flag, but line 1854 explains the flag right after it, so no edit was needed.

Tests
  • Free Tests (workflow dispatch run 44978984237 at d566c3e): green, 1739 files.
  • PR checks at d566c3e: 35 passed, 0 failed.
  • Windows Free Tests run 44977432351 at e44735b: all 10 shards and the aggregate green.
Agent notes

GSTA-674's diagnosis that the Windows seed wasn't read was wrong; the named fix (Linux fallback per file, plus headroom) still applies. Windows Free Tests run 44977432351 ran at e44735b (44977158062 at 172dccb was cancelled when the second commit landed; that head's always-on budget broke windows-scope).

Refs GST-3440

Approvals

No approvals recorded for branch windows-shards-pack-by-windows-time.
Plan: exempt: bug fix with a failing-first test; bug fixes need no plan review
Plan check: exempt bug fix

REVIEW_LOOP: passes=1 blocking_found=0 deferred=0 noted=4 fixed=0 scope=frozen ledgers_read=2 dispatches=4
Gate edits: 6 listed, 5 read, 0 findings — 0 kept, 0 restored, 0 open
Outside review: openai/gpt-6.1-sol (host subagent) completed, verdict CLEAN.

{
  "schema_version": 1,
  "pr": 4661,
  "head": "d566c3e3341675b7d53393f543ec195594819b55",
  "version": "1.102.2.0",
  "base": "main",
  "gate": {
    "free": {
      "pass": 1739,
      "fail": 0,
      "skip": 0
    }
  },
  "ci_carried": [
    {
      "lane": "free",
      "run": 44978984237,
      "attempt": 1,
      "tree": "84d828421f89494dfec26755922e6c0b46c71a93"
    }
  ],
  "calls": 15,
  "session_kind": "unattended",
  "run": "ship-4661",
  "head_tree": "84d828421f89494dfec26755922e6c0b46c71a93",
  "product_patch_id": "e3a29fbf1454b9cf093b05e2eb0299e7eba5a277",
  "gstack_version": "1.102.2.0",
  "review_depth": {
    "depth": "full",
    "class": "gate",
    "runtime_lines": 77,
    "rules": "630fd3101899e28e",
    "base": "69ad1031a19c0989da27cefd73884a31a1ea1f9a",
    "registry": "69ad1031a19c0989da27cefd73884a31a1ea1f9a",
    "gate_scan": {
      "tagged": 0,
      "head": "d566c3e3341675b7d53393f543ec195594819b55"
    },
    "reasons": [
      "gate-class",
      "runtime=77"
    ],
    "risk": [],
    "mode": "panel"
  },
  "pregate": "requires-remote cleared @84d828421f89 (8 checks, current for d566c3e33416)",
  "requires_remote": [
    "free-tests.yml/macos-named-regressions: https://github.com/garrytan/gstack/actions/runs/44978984237/attempts/1",
    "windows-smoke.yml/windows-smoke: https://github.com/garrytan/gstack/actions/runs/44977843960/attempts/1",
    "pregate.json/remote_gate: remote-gate tree=84d828421f89 tests=38759 skipped=67 runs=44978984237/1 profiles=ci-reuse/free-tests heads=d566c3e33416 verified=2026-11-22T03:10:20.390Z"
  ],
  "issues": {
    "fixes": [],
    "refs": [
      4646
    ],
    "flakes": []
  },
  "docs": {
    "status": "current",
    "scope": "docs/, README.md, CONTRIBUTING.md, AGENTS.md, CLAUDE.md, ARCHITECTURE.md against the 7-file diff"
  },
  "review_loop": {
    "passes": 1,
    "blocking_found": 0,
    "deferred": 0,
    "noted": 4,
    "fixed": 0,
    "scope": "frozen",
    "rounds": 1,
    "ledgers_read": 2,
    "dispatches": {
      "specialist": 3,
      "red-team": 1
    }
  },
  "gate_dispositions": []
}

… 12 minutes (GST-3440)

The Windows plan already read free-test-durations-windows.json, but a file missing from it was packed at the Windows 99th percentile (161 s). 27 such files made the packing balance phantom load, so one shard on #4646's tree held 946 s of real Windows time against a 900 s job and was cancelled twice (run 44971202453). A missing Windows time now falls back to the file's Linux time, and the plan adds shards from 8 until every shard predicts at most 720 s (80% of the job). Main's seeds now plan 10 shards, heaviest 650 s.

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

trunk-io Bot commented Nov 22, 2026 •

Copy link
Copy Markdown

😎 This pull request was merged.

garrytan and others added 2 commits November 22, 2026 02:43
…Windows check still lists its files (GST-3440)

windows-scoped-tests plans with --windows-only --ci-plan --shards 1 only to list the curated files, and the always-on 720 s budget made that plan fail. The budget is now opt-in through --shard-budget-seconds, which windows-free-tests.yml passes.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
The Windows plan now reads scripts/free-test-durations-windows.json from scripts/test-free-shards.ts, so PR selection derived 250 paid cases from a seed edit (test/free-fixtures.test.ts, Free Tests 44977434508). The seed is free-only data, like the Linux seed beside it; the harness pin records the change as non-behavioral.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
@capy-ai
capy-ai Bot merged commit 6484fd5 into main Nov 22, 2026
77 checks passed
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