Repository navigation
Conversation
--contribution-input passed the full backlog and task documents through jq --argjson, so a fleet past ARG_MAX failed with Argument list too long during session start. Stage those payloads and read them with --slurpfile, the same transport --json already uses. tests/fm-fleet-snapshot-view.test.sh builds an input larger than getconf ARG_MAX. Watched that test fail on the old --argjson path with `/usr/bin/jq: Argument list too long` before this change.
04f5fc8 to
ac833a4
Compare
|
Speaking as a user's firstmate. I compared all four proposed fixes on Linux using the same frozen, complete real ownership input, with a structured work list in the 128-512 KiB range. The installed input producer reproduced This proposal is my preferred narrow fix. Its complete affected snapshot/view test file passed all 19 cases at the proposed head; its authored oversized-input regression passed there and failed against its original base. An injected final-assembly failure also returned a nonzero exit, and the change guards assembly in the full snapshot path as well. Another file-transport proposal still returned success after that injected failure. The other proposals' oversized-input regressions passed too, but two broader contribution test files did not pass cleanly on this system because their fixtures require a date executable at a location absent here; I am not claiming those suites are green. The endorsement is specifically for whole-document input transport and error propagation, not a universal removal of argument-size limits. Separate adversarial checks still found an individual-metadata-field argument limit and a total argument limit for an extremely large shared-owner list elsewhere in the same path. The real input used for this comparison stayed below those residual limits. No installed tooling or real operational records were changed, and this was a single-system comparison, not a cross-host compatibility claim. |
Intent
Fix the queued Firstmate item: fm-fleet-snapshot.sh fails at session start with jq Argument list too long.
Context: seen in the 2026-09-22 session-start digest bootstrap section: bin/fm-fleet-snapshot.sh (around line 1991 at the time) printed "/usr/bin/jq: Argument list too long". A jq invocation there passes data on the command line, most likely through --arg or --argjson, and this home's fleet state has grown past the kernel argument limit. The ask: feed the data through stdin or --rawfile/--slurpfile instead of the argument vector, and add a test that exercises the path with an oversized input so the failure is watched before the fix.
What Changed
bin/fm-fleet-snapshot.sh: the--contribution-inputpath used to hand the backlog and task JSON to jq with--argjson. On a large home, that payload goes over the kernel'sARG_MAXlimit and jq fails with "Argument list too long". The script now writes both documents to the temporary transport directory and reads them back withjq --slurpfile. To make those files available on this path, the transport-directory setup now runs before the contribution-input early exit.contribution input assembly failederror and exits non-zero. This applies to both the early-exit path and the full snapshot path.tests/fm-fleet-snapshot-view.test.sh: new testtest_contribution_input_handles_backlog_larger_than_arg_max. It creates a backlog row padded pastgetconf ARG_MAX, then checks four things: no "Argument list too long" error, exit status 0, valid JSON that still contains the oversize row, and output bigger thanARG_MAX.🤖 Generated with Claude Code
Risk Assessment
✅ Low: The change is small and well-bounded. The
--contribution-inputpath now reads the backlog and task JSON from temporary files with--slurpfileinstead of passing them to jq with--argjson, which matches the files-based path the full snapshot already uses. The existing EXIT trap still cleans up the temporary directory. A new test that feeds in a backlog larger than ARG_MAX checks the actual output, so it would have failed before the fix.Testing
I ran the real CLI on isolated, throwaway FM_HOME fixtures, once with the base commit (extracted with
git archive) and once with the target commit. With a backlog or task list larger than the kernel's argument limit (ARG_MAX, 2 MiB here), the base commit reproduced the reported "jq: Argument list too long" error at line 1994: the script exited 0 with no output, andfm-contributions.sh pollinherited that failure. The target commit produced complete, valid JSON for both oversized cases, and the poll ran without errors. Output for a normal-sized home was byte-identical between the two commits. Default snapshot mode was unaffected apart from the expected difference infm_root. No temp directories were left behind. The regression-test before/after check is recorded as untested because it was not a live run. Herdr was not needed because this is a Herdr-independent CLI/data path. Evidence transcripts are in the evidence directory.Evidence: Oversized backlog: base vs target (--contribution-input and default mode)
Source: Oversized backlog: base vs target (--contribution-input and default mode)
Evidence: Oversized aggregated task JSON: base vs target
Source: Oversized aggregated task JSON: base vs target
Evidence: fm-contributions.sh poll consumer on oversized home: base vs target
Source: fm-contributions.sh poll consumer on oversized home: base vs target
Evidence: Normal home --contribution-input byte parity
Source: Normal home --contribution-input byte parity
Evidence: New regression test: fails on base, passes on target
Source: New regression test: fails on base, passes on target
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
⏭️ **Rebase** - skipped
bin/fm-test-run.sh- merge conflict rebasing onto refs/remotes/no-mistakes-push/fm/fm-snapshot-jq-arglistdocs/verification/runtime-backends.md- merge conflict rebasing onto refs/remotes/no-mistakes-push/fm/fm-snapshot-jq-arglist✅ **Review** - passed
✅ No issues found.
✅ **Test** - passed
✅ No issues found.
FM_HOME=<home with 2.1MB backlog.md> bin/fm-fleet-snapshot.sh --contribution-inputon the base (31c47af) and target (ac833a4) commitsFM_HOME=<same home> bin/fm-fleet-snapshot.sh(default JSON mode) on base and targetFM_HOME=<same home> bin/fm-contributions.sh poll(the real consumer of --contribution-input) on base and targetFM_HOME=<home with 1900 task .meta files, ~2.6MB aggregate> bin/fm-fleet-snapshot.sh --contribution-inputon base and targetFM_HOME=<normal small home with a .meta task> bin/fm-fleet-snapshot.sh --contribution-inputbase vs target, compared withcmpbash tests/fm-fleet-snapshot-view.test.shagainst target bin, and the same test file against base bin to confirm the fail-before/pass-after behaviourChecked that the snapshot temp directory (TMPDIR) was empty after each run✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.