Skip to content

The spawnSync overflow test no longer fails about once an hour on CI (GSTA-712) - #4613

Merged
capy-ai[bot] merged 2 commits into
mainfrom
flaky-spawn-overflow-fixture-fits-send-buffer
Nov 21, 2026
Merged

capy-ai[bot] merged 2 commits into
mainfrom
flaky-spawn-overflow-fixture-fits-send-buffer

Conversation

@garrytan

@garrytan garrytan commented Nov 21, 2026 •

Copy link
Copy Markdown
Owner

The raw-Bun overflow test in test/spawn-sync.test.ts stops failing at random on CI: its child process now writes 32 KiB instead of 200,000 bytes.
Why: the old write sat 13 KB under Linux's 212,992-byte socket send buffer. When it didn't fit, the child hit a broken pipe and exited 1, so the test saw status 1 instead of 0. Trunk flagged it 22 times in one day, and every time it passed on retry.
Nothing to do: this changes tests only.

Evidence
  • Trunk test cba2aa0b (quick tier, bun-default variant): 21 failed runs from 2026-11-21 00:18Z to 11:04Z, 6 of them on main pushes. Each failed in 10 to 15 ms with Expected: 0, Received: 1 and passed on the serial retry (Free Tests 44842411894, 44886887009 and 19 more).
  • Local sweep on Bun 1.4.4 (one write, maxBuffer 1024): 200,000 and 210,000 bytes gave status 0 in 6 of 6 runs (about 320 ms each). 230,000 bytes gave status 1 in 4 of 6, the fast runs. 400,000 and 1,000,000 bytes gave status 1 in 6 of 6, in about 10 ms, with the child's EPIPE: broken pipe, write. That matches the CI failures.
  • strace: Bun's spawnSync reads one 66,560-byte chunk, sends SIGTERM (which the child ignores) and stops reading. The child's 200,000-byte sendto only succeeds when the whole write fits the send buffer.
  • After the change: 32 KiB gave status 0 with ENOBUFS in 600 of 600 runs (24 parallel processes). bun test test/spawn-sync.test.ts test/script-invocation.test.ts test/spawnsync-timeout-tripwire.test.ts: 47 pass, 0 fail, and 8 parallel copies of the first two files also passed.
  • test/script-invocation.test.ts used the same 200,000-byte child. Its wrapper test passed either way, but now the child really exits 0, which is the case that test is about.
What changed

The overflow test's child now writes 32 KiB, which fits the socket send buffer, so it exits 0 every time

The overflow test's child now writes 32 KiB, which fits the socket send buffer, so it exits 0 every time.

Before/after as text: The overflow test's child now writes 32 KiB, which fits the socket send buffer, so it exits 0 every time
--- Before · before.txt · captured output
+++ After · after.txt · captured output
+const OVERFLOW = "process.on('SIGTERM', () => {}); process.stdout.write('x'.repeat(32768)); setTimeout(() => {}, 300);";
-const OVERFLOW = "process.on('SIGTERM', () => {}); process.stdout.write('x'.repeat(200000)); setTimeout(() => {}, 300);";

The free test suite kept failing for no reason about once an hour. The spawnSync overflow check expected exit status 0 and sometimes got 1. Its child process now writes 32 KiB, which still runs far past the test's 1 KiB output limit but always fits the socket buffer, so the child really exits 0 and the check tests what it says. The same child in test/script-invocation.test.ts gets the same size.

Why

"Trunk flagged it 21 times on 2026-11-21": a red free suite on main and on pull requests that went green on retry. A 200,000-byte write only succeeds when the whole write fits the 212,992-byte send buffer, so the test passed or failed on timing. With 32 KiB the outcome no longer depends on timing.

Blast radius

Only two test files and a changelog fragment change; no product code, helper or assertion changes. The assertions still require status null with ENOBUFS from the wrappers, and both files passed 44 of 44 in five local runs on Bun 1.4.4 (script ran), with CI's free suite green at this head.

Pre-Landing Review

No issues found. A testing reviewer and a second-model review (GPT-6.1 Sol) each read the whole diff and returned no findings. The second-model review saw one timeout in the unchanged wtreeFingerprint fixture (test/script-invocation.test.ts:223) while it ran tests alongside other work; five local runs of both files passed 44 of 44 each, and CI's free suite passed at this head.

Documentation

Status: current. The test-only fix needs no doc changes.

Scope: the diff from 27e5db9 to 0e0925d (2 commits): test/spawn-sync.test.ts, test/script-invocation.test.ts and changelog.d/flaky-spawn-overflow-fixture-fits-send-buffer.md. Nothing was staged, unstaged or new. I searched tracked Markdown and templates for references to the overflow fixture.

Documentation health:

  • changelog.d/flaky-spawn-overflow-fixture-fits-send-buffer.md: current. It matches the diff and was reviewed only, not edited.
  • docs/, README.md, CONTRIBUTING.md, AGENTS.md: current. None of them references the fixture.

Coverage debt: none. No public surface changed.

Diagram drift: none.

Tests
  • bun test test/spawn-sync.test.ts test/script-invocation.test.ts: 44 pass, 0 fail (and 44 of 44 in each of five repeat runs)
  • bun run test, carried from CI Free Tests run 44914101831 at this tree: green, 1,731 test files
Agent notes

Daily flaky pass, GSTA-712. Ledger: captain drive handoffs/flaky-ledger.md. No thresholds, trial counts or case kinds changed, and no retries added.

Refs GSTA-712

Approvals

No approvals recorded for branch flaky-spawn-overflow-fixture-fits-send-buffer.
Plan: exempt: flaky
Plan check: exempt flaky

REVIEW_LOOP: passes=1 blocking_found=0 deferred=0 noted=0 fixed=0 scope=frozen dispatches=1
Gate edits: none detected (3 listed, 3 read; patterns: RH-1,RH-3,RH-4,RH-12,RH-13,RH-14,RH-15,RH-16; unlisted idioms: none)

{
  "schema_version": 1,
  "pr": 4613,
  "head": "0e0925db797def2a81c8670afbf65b605089d6f3",
  "version": "1.102.1.0",
  "base": "main",
  "gate": {
    "targeted": {
      "pass": 44,
      "fail": 0,
      "skip": 0
    },
    "test": {
      "pass": 1731,
      "fail": 0,
      "skip": 0
    }
  },
  "ci_carried": [
    {
      "lane": "test",
      "run": 44914101831,
      "attempt": 1,
      "tree": "8c044127e9d7149474ab29fd38ba8c374d7f6b9c"
    }
  ],
  "calls": 13,
  "session_kind": "unattended",
  "run": "gstack-ship-4613",
  "head_tree": "8c044127e9d7149474ab29fd38ba8c374d7f6b9c",
  "product_patch_id": "none",
  "gstack_version": "1.102.1.0",
  "review_depth": {
    "depth": "light",
    "class": "tests",
    "runtime_lines": 0,
    "rules": "85b3923b1a978e41",
    "base": "27e5db990208898cba69eba87c7fc6b43e51b224",
    "registry": "27e5db990208898cba69eba87c7fc6b43e51b224",
    "gate_scan": {
      "tagged": 0,
      "head": "0e0925db797def2a81c8670afbf65b605089d6f3"
    },
    "reasons": [
      "runtime=0"
    ],
    "risk": [],
    "mode": "panel"
  },
  "pregate": "requires-remote cleared @8c044127e9d7 (8 checks, current for 0e0925db797d)",
  "requires_remote": [
    "free-tests.yml/macos-named-regressions: https://github.com/garrytan/gstack/actions/runs/44914101831/attempts/1",
    "pregate.json/remote_gate: remote-gate tree=8c044127e9d7 tests=38682 skipped=67 runs=44914101831/1 profiles=ci-reuse/free-tests heads=0e0925db797d verified=2026-11-21T14:40:25.113Z"
  ],
  "issues": {
    "fixes": [],
    "refs": [],
    "flakes": []
  },
  "docs": {
    "status": "current",
    "scope": "README.md, docs/, CONTRIBUTING.md, CLAUDE.md, AGENTS.md and the changelog.d fragment"
  },
  "review_loop": {
    "passes": 1,
    "blocking_found": 0,
    "deferred": 0,
    "noted": 0,
    "fixed": 0,
    "scope": "frozen",
    "rounds": 1,
    "ledgers_read": 2,
    "unbound": 1,
    "dispatches": {
      "specialist": 1
    }
  },
  "gate_dispositions": []
}

Open in Capy

…et send buffer (GSTA-712)

A 200,000-byte write sat 13 KB under Linux's 212,992-byte Unix socket send
buffer. When it did not fit, the child hit EPIPE and exited 1, so the raw-Bun
case saw status 1 instead of 0 about once an hour on CI.

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

trunk-io Bot commented Nov 21, 2026 •

Copy link
Copy Markdown

😎 This pull request was merged.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
@capy-ai
capy-ai Bot merged commit 43c9c20 into main Nov 21, 2026
53 checks passed
@garrytan garrytan mentioned this pull request Nov 21, 2026
capy-ai Bot added a commit that referenced this pull request Nov 21, 2026
- Habits from nine teams, written into gstack. (#4585)
- Three more habits from teams that run evals. (#4602)
- The /ship conductor trial plan gives its real-problem judge one more attempt on fresh labels after it missed its agreement bar twice, and stops the trial incomplete if it misses again (GST-3003). (#4611)
- The /ship conductor trial plan now stops a trial only at the final remote-gate refusal, gives both arms the same note that the brief overrides team rules, and counts every report the no-gstack arm returns (GST-3003). (#4609)
- The /ship conductor trial plan now ends a trial at the remote gate when its case base isn't main, gives the no-gstack arm a test runner, and audits every trial for exposure to the plan (GST-3003). (#4605)
- The /ship conductor trial plan now runs an uncounted pilot in every arm before its counted trials and takes one planned look at half the cases (GST-3003). (#4587)
- gstack's own use on Capy can be counted, and is kept out of real-use numbers. (#4576)
- Free Tests shards finish closer together. (#4578)
- The weekly test-time recording can land again on its own. (#4581)
- The job-log tree.json step's recommended sleep is long enough for real runners. (#4589)
- Pull requests no longer wait on the Trunk flaky-test upload, and the quick tier's flaky passes now reach Trunk. (#4579)
- Windows Setup E2E finishes sooner on install changes. (#4575)
- Skills no longer stop on Codex when they clean up temp files. (#4612)
- /review on Codex with OpenAI models no longer holds back a review that ran its adversarial pass. (#4622)
- Crew threads on Capy now check in at 500M own tokens, standing threads rotate at 250M and any subagent past 50M gets a look, half the old lines, because Capy's token counts read about half what they did before 2026-11-15. (#4582)
- gstack no longer offers to add a `## Skill routing` section to your project's CLAUDE.md. (#4629)
- The README and docs no longer say gstack makes your agent fix more bugs. (#4598)
- `/eval-plan` now writes eval plans that waste less money. (#4591)
- /cso checks every folder above a source file before it looks at the file, so it never looks through a symlinked folder. (#4592)
- Plan reviews no longer read a /design-review audit summary as the branch's design doc. (#4623)
- Node's built-in test files now run with `node --test` in repos that use vitest or jest. (#4626)
- A quarantined test that the runner skipped now fails the run instead of passing it. (#4590)
- A flaky free test is fixed: the spawnSync overflow check no longer fails about once an hour on CI. (#4613)
- Free Tests runs its shards on 16-core runners. (#4600)
- /office-hours asks for ground truth first. (#4468)
- Every startup session ends with a dated test. (#4468)
- /plan-tune's dream cycle now logs each send of your typed answers to Anthropic. (#4621)
- Landing a ready PR no longer depends on a hand-copied gate decision, and the ready note, release PR and squash message say the right thing. (#4596)
- /ship no longer asks for a fresh review because of a stacked parent that main already had. (#4580)
- Results PRs with large captured agent sessions can be reviewed. (#4574)
- /ship no longer stalls on review notes a reviewer already cleared, counts review rounds the way the review policy reads them, and keeps security findings out of the PR body. (#4595)
- /ship's review readers are now told never to stop processes they didn't start. (#4607)
- /ship's review no longer stops when Capy's own drive sync database grows past 100 MB. (#4606)
- /ship's preflight now honors your repository's time limit for rerunning CI-skipped tests, and tells you when a fresh worktree needs its packages installed. (#4608)
- The slowest free test file is now six files. (#4588)
- Step 11.5 keeps a reviewed head current across base-only merges. (#4577)
- On a Capy install, only the owner's opt-in sends telemetry. (#4597)
- New page: working across agent systems. (#4583)

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