Skip to content

Fix ARG_MAX overflow in stderr blob test on Linux CI - #3

Merged
yasyf merged 1 commit into
mainfrom
fix/argv-size-in-stderr-blob-test
Sep 2, 2026
Merged

yasyf merged 1 commit into
mainfrom
fix/argv-size-in-stderr-blob-test

Conversation

@yasyf

@yasyf yasyf commented Sep 2, 2026

Copy link
Copy Markdown
Owner

Summary

tests/test_proc.py::TestArunCli::test_stderr_newline_free_blob_past_64k built its child command by interpolating a 200,000-byte literal into argv through an f-string repr. On the Linux CI runners, argv plus the runner's large inherited environment exceeds the kernel's ARG_MAX, so execve fails before the child starts:

tests/test_proc.py:132: in test_stderr_newline_free_blob_past_64k
    await arun_cli(argv, stderr_tee=seen.append)
spawnllm/proc.py:226: in arun_cli
    proc = await asyncio.create_subprocess_exec(
E   OSError: [Errno 7] Argument list too long: '/home/runner/work/spawnllm/spawnllm/.venv/bin/python'
1 failed, 420 passed, 2 skipped in 8.07s

The child now generates the blob itself (sys.stderr.write('e' * 200_000)) instead of receiving it, so argv stays small. The test's subject is unchanged: it still asserts that a newline-free 200,000-byte stderr blob past the 64 KiB readline limit is captured whole rather than lost to a LimitOverrunError mid-drain, and still checks the exit code, exc.value.stderr, and the teed bytes.

This is a pre-existing break on main, not a regression from any open branch. The test arrived with #6 ("Fix stderr drain crashing on newline-free blobs past 64 KiB"), and every ci.yml run on main since has failed, blocking CI for every PR in the repo. It is not a flake: it fails deterministically on both the 3.13 and 3.14 jobs, so a rerun does not clear it. It passes on macOS, where argv has more headroom against a smaller inherited environment, which is why it went unnoticed locally.

Test plan

  • uv run --extra dev pytest tests/test_proc.py -k stderr passes locally.
  • The Linux CI run on this branch is the real proof, since the failure is environment-dependent.

https://claude.ai/code/session_014gKfZvjihGgFrEVCr3NJJb

A 200,000-byte literal in argv exceeds ARG_MAX on a Linux runner whose inherited
environment is already large, so execve fails E2BIG before the stderr drain under
test ever runs. The child generates the blob instead; the assertions are unchanged.

Claude-Session: https://claude.ai/code/session_014gKfZvjihGgFrEVCr3NJJb

Claude-Session-Id: 2eb2d69e-c564-4401-84fb-d22d217b5ff7
@yasyf
yasyf merged commit 482bf97 into main Sep 2, 2026
17 checks passed
@yasyf
yasyf deleted the fix/argv-size-in-stderr-blob-test branch September 2, 2026 21:45
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