Repository navigation
feat(cli): read the run prompt from a file with --prompt-file - #1415
Conversation
Linux caps a single argv entry at MAX_ARG_STRLEN — 32 pages, 131072 bytes — independently of the much larger ARG_MAX total, and execve fails with E2BIG before the process starts. macOS has no equivalent per-argument cap. That combination is a trap for any caller that assembles a prompt rather than typing one: it works throughout local testing on a Mac and then cannot spawn at all on a Linux CI runner. Sentinel embeds the files it audits into the prompt and hit exactly this — every pack returned "spawnSync nanocoder E2BIG" on ubuntu-latest at 314 KiB and 218 KiB, after passing on macOS all the way through development. A file has no such ceiling. --prompt-file takes precedence over a positional prompt, since passing both is a caller bug and the file is the one asked for explicitly, and an unreadable path exits with a message rather than running against an empty prompt. Also brings the parsing test mirror back in step. cli.spec.ts duplicates the argv filter by hand and had fallen six flags behind it: --mode, --json, --output-format, --trust-directory and the alt-screen pair were stripped by the real parser and left in the prompt by the mirror, so those tests were passing against a parser that is not shipped. A test now asserts the two agree. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
nc-review: comments — 1 important, 2 nits@will-lamerton — a few things worth a look, none blocking. PR adds a useful 🟠 important · The three new tests for ⚪ nit ·
⚪ nit · The third new test ( 🔴 blocking · 🟠 a reviewer would ask for a change · ⚪ optional Automated code review — correctness, security, design, tests, plus duplicates and scope. A human still decides; this is not a substitute for review and is not exhaustive. The required status checks separately cover lint, formatting, types, unused dependencies, the test suite and the build. This bot never merges. Maintainers can rerun with |
The entire prompt — pack body plus every matched file — was passed as one command-line argument. Linux caps a single argv entry at MAX_ARG_STRLEN (32 pages, 131072 bytes) independently of the far larger ARG_MAX, and execve fails with E2BIG before the process starts. 128 KiB is about 3000 lines, so a pack scoped src/**/*.ts exceeds it on most real projects, and every production install runs on Linux. Sentinel could not audit a repository of ordinary size in the environment it ships for, and never had — the first scheduled run to get far enough to try returned "spawnSync nanocoder E2BIG" for both packs, at 314 KiB and 218 KiB. macOS has no equivalent per-argument cap, which is exactly why every local exercise passed and this reached production. The prompt goes through a temporary file now, written outside the audited repository — it contains that repository's source — and removed on the way out. That needs Nanocoder 1.31, which added --prompt-file (Nano-Collective/nanocoder#1415). The scaffolded workflow pins it, and the runner probes the capability from --help before spawning, because an older Nanocoder does not reject an unknown flag: it folds it into the prompt, and the model is left answering a question made of command-line flags while the run reports malformed output with no hint of why. E2BIG is handled explicitly as well. It should now be unreachable, but an errno is not an explanation. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
* fix(orchestrator): the prompt must not travel through argv The entire prompt — pack body plus every matched file — was passed as one command-line argument. Linux caps a single argv entry at MAX_ARG_STRLEN (32 pages, 131072 bytes) independently of the far larger ARG_MAX, and execve fails with E2BIG before the process starts. 128 KiB is about 3000 lines, so a pack scoped src/**/*.ts exceeds it on most real projects, and every production install runs on Linux. Sentinel could not audit a repository of ordinary size in the environment it ships for, and never had — the first scheduled run to get far enough to try returned "spawnSync nanocoder E2BIG" for both packs, at 314 KiB and 218 KiB. macOS has no equivalent per-argument cap, which is exactly why every local exercise passed and this reached production. The prompt goes through a temporary file now, written outside the audited repository — it contains that repository's source — and removed on the way out. That needs Nanocoder 1.31, which added --prompt-file (Nano-Collective/nanocoder#1415). The scaffolded workflow pins it, and the runner probes the capability from --help before spawning, because an older Nanocoder does not reject an unknown flag: it folds it into the prompt, and the model is left answering a question made of command-line flags while the run reports malformed output with no hint of why. E2BIG is handled explicitly as well. It should now be unreachable, but an errno is not an explanation. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> * fix(orchestrator): a missing nanocoder is "not on PATH", not "too old" The --prompt-file probe ran `nanocoder --help` and cached any failure as "no --prompt-file support", so with Nanocoder not installed every run reported "upgrade nanocoder" instead of the documented "not on PATH" error. A probe that cannot spawn Nanocoder is now no answer: the spawn reports the real error, and the next call probes again. Also drops an unrelated rewrite of an old run record from this branch, and notes in the dedup changeset that its fix already shipped in alpha.7 (it merged seconds before that release was cut, so only its entry was left). Verified on Linux (node:22, aarch64) with a 307 KiB prompt: alpha.7 fails with E2BIG; this branch reaches Nanocoder 1.32.0; no nanocoder gives "not on PATH"; Nanocoder 1.30.0 gives the upgrade message. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> --------- Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
Description
nanocoder run --prompt-file <path>reads the prompt from a file instead of the command line.Linux caps a single argv entry at
MAX_ARG_STRLEN— 32 pages, 131072 bytes — independently of the much largerARG_MAXtotal, andexecvefails withE2BIGbefore the process starts. macOS has no equivalent per-argument cap.That combination is a trap for any caller that assembles a prompt rather than typing one: it passes throughout local development on a Mac and then cannot spawn at all on a Linux CI runner.
Sentinel embeds the files it audits into the prompt and hit exactly this. Its first scheduled run on
ubuntu-latestreturned:at 314 KiB and 218 KiB, having passed on macOS all the way through development. Tracked as Nano-Collective/sentinel#59.
A file has no such ceiling.
--prompt-fileoutsiderunexits with a message.A second thing, found while adding the test
cli.spec.tsduplicates the argv filter by hand ("mimics the logic in cli.tsx") and had fallen six flags behind it:--mode,--json,--output-format,--trust-directoryand the alt-screen pair are stripped by the real parser and were left in the prompt by the mirror. Those tests were passing against a parser that is not shipped.The mirror is back in step, and a test now asserts the two agree — so the next divergence fails rather than going quiet.
Type of Change
Changeset
pnpm changeset) describing this change for the changelogTesting
Automated Tests
.spec.ts/tsxfilespnpm test:allcompletes successfully) — rancli.spec.ts(60 passing),test:types,test:lint,format:checkandbuildlocally; left the full suite to CI as it is long-runningManual Testing
Verified end to end with a 187055-byte prompt file — comfortably past the 131072-byte cap:
--helpdocuments the flag and says why it exists.