Skip to content

ci(runner): read the host env file as text, and record the P620 slot count - #1868

Merged
devswha merged 3 commits into
mainfrom
ci/runner-env-file-text
Oct 24, 2026
Merged

devswha merged 3 commits into
mainfrom
ci/runner-env-file-text

Conversation

@devswha

@devswha devswha commented Oct 24, 2026

Copy link
Copy Markdown
Owner

What this does

A follow-up to #1839 with two commits that were not pushed before it merged.

  • run.sh reads the host env file with grep -a. With a NUL byte in the file, grep took it for binary and
    printed "binary file matches" without line numbers, so a refused line went unnamed. Worse, a valid line
    ending in a NUL (CHECK_HOST_MAX_RUNS=6\0) passed the check. Now that line is refused and named by its
    number. -e <pattern> -- "$ENV_FILE" also keeps a path that starts with - from being read as a grep option.
  • README: the P620 runs CHECK_HOST_MAX_RUNS=5 (live in its host.env since 12:37 UTC). It gives the memory
    this was sized from: under 17.2 GiB with four slot jobs and twelve runners busy, and about 4 GiB per slot
    job, so near 25 GiB at five.

Why

The NUL and leading-dash cases came from a Codex review (Sol 6.1 Fast, xhigh) of #1839's allowlist commits. It
probed grep with NUL bytes, CRLF, unicode whitespace and long lines, and the session ended before it wrote a
report. Its other probes (CR inside a comment, unicode space, CRLF) are already refused by the allowlist, or are
lines Docker ignores, so they cannot pass a variable.

Verification

  • New test refuses a NUL byte in the host env file and names its line. It fails without -a; all 14 runner
    tests pass.
  • A path -x.env now passes validation as a file.
  • The P620's live host.env passes the new check.
  • bun run check fast passes (6394 unit tests).

This changes the self-hosted runner launcher (what may reach PR job containers), so it needs the merge pass's
check like #1839.

mp added 2 commits October 24, 2026 22:07
A NUL byte made grep call the file binary: it then named no refused line, and
a valid line ending in a NUL passed. grep -a reads it as text, so that line is
refused by its number. -- keeps a path starting with - from being read as an
option.
@coderabbitai

coderabbitai Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 7 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 4 included reviews currently available.

Learn how review limits work.

Review configuration:

Run configuration
Commits

Reviewing files that changed from the base of the PR and between 427f5d3 and 90c146d.

Files selected for processing: 3
  • scripts/self-hosted-runner.test.ts
  • scripts/self-hosted-runner/README.md
  • scripts/self-hosted-runner/run.sh
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

…he five-slot memory estimate

GNU grep still reads stdin for the path - after --, so --env-file - checked the
launcher's stdin while docker read the file. A path starting with - now gets a
./ prefix for both. The README's five-slot estimate is about 21 GiB (17.2 GiB
measured at four, plus about 4 GiB), which holds one browser spike, not two.
@devswha

devswha commented Oct 24, 2026

Copy link
Copy Markdown
Owner Author

Review record (CodeRabbit hit its review limit on this PR, so per AGENTS.md a code-review agent's review stands in).

omo-native-code-reviewer on 5d20636..b626807: APPROVE, no HIGH or MEDIUM. It confirmed the -a change closes a real gap on main: without -a, grep took a NUL byte for the end of a line, so CHECK_HOST_TEST_SHARDS=6\0 passed the check. With -a the line is refused and named. It checked that -a/-e/-- change no other outcome (CRLF, invalid UTF-8, a NUL followed by a secret: refused as before; a NUL inside a comment: accepted, and docker skips it), and that no refused value can reach stderr.

Two LOW findings, both fixed in 90c146d:

  1. -- does not cover the path - itself: GNU grep still reads stdin for it, so --env-file - checked the launcher's stdin while docker read the file. Fixed: a path starting with - gets a ./ prefix for both the check and docker. New test: checks a host env file named - as that file, never the launcher's stdin (fails without the fix; it puts stub gh and docker on PATH so it can never reach real ones).
  2. The README's five-slot memory estimate didn't follow from its own numbers. Corrected: about 21 GiB (17.2 GiB measured at four slots, plus about 4 GiB), which holds one browser spike but not two.

All 15 runner tests pass; bun run check fast passes on 90c146d.

@devswha

devswha commented Oct 24, 2026

Copy link
Copy Markdown
Owner Author

Handing this PR to the pr-followups lane (lead's call): CI is green on 90c146d and the review record is above. The ci-p620-max lane is closing.

@devswha

devswha commented Oct 24, 2026

Copy link
Copy Markdown
Owner Author

Merge pass review-work report. Overall: PASSED. Under the maintainer's token rule, this follow-up to #1839's runner script merges on the code review, the merge pass's own check and CI, without the gate reviewer.

Lane Verdict
Code review (omo-native-code-reviewer, programming + remove-ai-slops) at 90c146d PASS (CLEAR)
Merge pass's own check 70 runner and check tests pass, the typecheck passes, bash -n passes, and git merge-tree is clean. run.sh was never run against Docker

What was checked

  • grep -a: a NUL byte no longer makes grep call the file binary and skip the line numbers. A valid line ending in NUL is refused and named by its number.
  • A file named -: 90c146d closes a real hole. With --, grep read - as stdin, which is /dev/null under systemd, so a - file holding GH_TOKEN passed the check, and Docker would then have loaded it. The path is now rewritten to ./- before both the check and Docker, so they always read the same file.
  • Other inputs: a NUL in the middle or at the end of a line, CRLF, invalid UTF-8, an empty file and a file with no trailing newline all behave correctly. The exit codes (0 refuse, 1 accept, 2 or more read error) are still handled.
  • Logging: only line numbers are ever printed, never values.
  • Tests: each new test fails when its fix is removed.
  • README: the numbers add up. 17.2 GiB plus about 4 GiB for a fifth job leaves about 9 GiB of headroom.

Follow-ups (LOW)

  • -- and -e are now redundant with the ./ rename.
  • The README's spike figure was measured at 6 browser workers, not 8.

All required checks are green, and no review thread is open.

CodeRabbit did not review this PR (rate-limited or skipped). The reviews above stand in for it.

@devswha
devswha merged commit b04e1be into main Oct 24, 2026
9 checks passed
@devswha
devswha deleted the ci/runner-env-file-text branch October 24, 2026 15:20
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