fix: prevent fleet snapshot argv overflows - #1884
Open
Vladykart wants to merge 3 commits into
Open
Conversation
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Intent
Repair Firstmate's fleet snapshot and operator-facing bearings path so large real fleets cannot fail with
/usr/bin/jq: Argument list too long, preserving the supplied evidence/root/kun-agent-workspace/bin/fm-fleet-snapshot.sh: line 608: /usr/bin/jq: Argument list too longfollowed byfm-fleet-snapshot: main inventory summary failed. Establish the earliest failing public path against a proven small fleet and add a deterministic end-to-end reproduction independent of private backlog, clones, or live worker records that separates source input size, shell expansion, the jq exec boundary, and the visible interface result. Make the smallest shared data-transport correction by streaming or file-binding unbounded JSON aggregates into jq rather than argv, while retaining bounded scalar options and reusing one owner for main-home and second-mate summaries. Preserve canonical schema, sorting, null behavior, all required records, existing diagnostics, read-only semantics, per-home isolation, remote second-mate boundaries, no terminal/chat scraping, and bounded output fields; never solve the failure by truncating required records. Safely reject empty, malformed, multi-value, missing, or failed producer output, handle interruption and cleanup without unsafe temporary state, and use private collision-safe non-symlink-following temporary state only if stdin or owned files cannot avoid it. Add executable public-interface regressions for empty/small semantic equivalence, oversized fleet snapshot and bearings output beyond practical argv capacity, and malformed/failed input controls, asserting semantic JSON equivalence and absence of argv failure rather than implementation bytes. Run focused snapshot and bearings tests, the full applicable test runner, the repository lint owner, and documentation audience checks where applicable; safely rerun the formerly failing path with bounded non-private evidence. Preserve and report verified pre-existing suite failures. Do not stop, restart, or update watcher/daemon processes, change backlog semantics, contact project hardware/services, install or update tools, or read project-private data beyond existing snapshot authorization. Validate committed head 90b8311 through every synchronous no-mistakes gate, push and open a PR with current green checks, do not merge, and stop only for a genuine decision or blocker.What Changed
jqthrough validated stdin framing instead of command-line arguments, preventing oversized fleets from exceeding argv limits.Risk Assessment
✅ Low: The change is well-bounded and consistently replaces unbounded jq argv bindings with validated stdin transport while preserving schemas, diagnostics, ordering, bounds, and public snapshot/bearings behavior.
Testing
Validated the committed head through focused snapshot and bearings checks, the changed-test runner, and the complete 130-script test runner; direct CLI evidence confirms semantic equivalence, safe producer rejection, and oversized snapshot/bearings success without argv failure, while the full suite preserved 22 unrelated existing/environment-sensitive failures and 16 expected gate skips.
Evidence: Oversized fleet public-interface evidence
Evidence: Focused bearings transcript
Evidence: Changed-test runner transcript
Evidence: Full test-suite transcript
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
✅ **Review** - passed
✅ No issues found.
tests/fm-bearings-snapshot.test.sh- The focused bearings suite's unreadable-home fixture fails under root because chmod cannot make the fixture unreadable. The changed end-to-end regression independently exercised oversized bearings successfully and preserved all generated records.Inspectedgit diff 70aeba855527f7693082f6dd1bc731e334d0269f..90b83111d48e43858014f0019adbb74e891b6dba/bin/bash tests/fm-fleet-snapshot-view.test.sh/bin/bash tests/fm-bearings-snapshot.test.shbin/fm-test-run.sh --changed --base 70aeba855527f7693082f6dd1bc731e334d0269fbin/fm-test-run.sh --allgit status --short✅ **Document** - passed
✅ No issues found.
🔧 **Lint** - 1 issue found → auto-fixed ✅
🔧 Fix: Captain, fix fleet snapshot ShellCheck findings
✅ Re-checked - no issues remain.
✅ **Push** - passed
✅ No issues found.