Skip to content

fix(bin): keep unbounded fleet-snapshot payloads off exec argv - #4206

Closed
neilwashere wants to merge 7 commits into
kunchenguid:mainfrom
neilwashere:fm/fix-secondmate-home-summary-argv-overflow
Closed

neilwashere wants to merge 7 commits into
kunchenguid:mainfrom
neilwashere:fm/fix-secondmate-home-summary-argv-overflow

Conversation

@neilwashere

@neilwashere neilwashere commented Sep 11, 2026 •

Copy link
Copy Markdown

What Changed

  • bin/fm-fleet-snapshot.sh now routes every potentially unbounded snapshot payload through files instead of exec arguments: crew-state raw/detail lines, status-event raw/note, the per-task open-decision fold, and the secondmate aggregation's mirrored event line, activity scan, decision fold, and reconciliation now use jq --rawfile/--slurpfile rather than --arg/--argjson, so a single status line or accumulated fold above Linux's 128 KiB MAX_ARG_STRLEN no longer breaks the composing jq.
  • Per-task composition failures now degrade one row instead of dropping it or aborting: an unreadable current-state observation folds to state unknown, a failed status-event transport reports no last event while still reporting the contract path, an unreadable endpoint observation reports agent_alive=unknown with exists null, and a failed open-decision write falls back to argv only when the fold provably fits a new 16 KiB character bound, otherwise reporting no open decisions - each case emitting a named stderr diagnostic. Collection-stage write failures still fail the whole command loudly, and the header comment block documents this boundary.
  • tests/fm-home-summary-refresh.test.sh adds four cases: many long never-resolved decisions on one task, a single >128 KiB status line asserted back untruncated through both home-summary and --json modes, mirrored oversized lines through local and remote parent secondmate aggregation alongside an unrelated task that must survive, and a real ENAMETOOLONG open-decision write failure exercising both the small-fold argv fallback and the oversized-fold degradation (skipped where the filesystem name limit cannot isolate it).

Risk Assessment

✅ Low: The change is a well-bounded transport swap (argv to files) plus per-task degradation defaults in one script, matches the recorded user authorizations from earlier rounds, is disclosed in the file's own header contract, and is covered by new behavioral regression fixtures that would fail before the fix; only informational residuals remain (a missing // [] default, one narrow --arg pr argv path, one redundant per-task jq exec, and one vacuously-passable test assertion).

Testing

I reproduced the reported end-user symptom against the base snapshot script and then showed it gone at the target, using the real publisher and the real captain-facing renderers rather than unit assertions alone: with 60 still-open decisions on one task, the base writer exited 0 while jq reported "Argument list too long", the task vanished from the published state/home-summary.json, the summary went invalid with orphan_in_flight, and Bearings showed the home as "structured home state invalid ... has no child metadata" with zero of the 60 captain decisions; with the fix the same fixture publishes valid:true, both tasks present, 60 decisions counted, no reconcile row, and the parent aggregation reports captain_decision. A second scenario with one 186,155-byte mirrored status line went from "summary producer failed with exit 1" and no home-summary.json at all (Bearings: "structured home ledger is missing, unreadable, or invalid", empty in_flight) to a published valid summary carrying the open decision and the child's live work. On the automated side the branch's own suite fails at the first new case when run against the base snapshot script and passes fully against the target, and the two nearest consumer suites (fleet-snapshot view and bearings snapshot) pass, with the single unrelated bearings case that requires the absent tasks-axi CLI as the only failure. The change is CLI/JSON-surface only, so the reviewer-visible evidence is command transcripts and published JSON ledgers rather than screenshots; no rendered UI is involved.

Evidence: Evidence index: before/after comparison tables, reproduction instructions

Source: Evidence index: before/after comparison tables, reproduction instructions

# Evidence: secondmate home summary survives an argv-overflowing status payload

Branch `fm/fix-secondmate-home-summary-argv-overflow`
(base `2da3c5e` -> target `d46f31f`).

**Intent under test.** A task's status-derived payloads (the whole-status-log
open-decision fold, and a single unbounded status line with its note) rode jq
`--argjson`/`--arg`, i.e. ONE exec argument. Past Linux's 128 KiB
`MAX_ARG_STRLEN` the jq could not exec, the failure was swallowed by an
unchecked pipe, and the task vanished from the snapshot - so the published
`state/home-summary.json` went invalid (`orphan_in_flight`) and the home read as
orphaned/unreadable to Bearings. The fix moves those payloads onto files
(`--slurpfile`/`--rawfile`) and makes each per-task degradation keep the row.

Both scenarios below were run twice against the SAME fixture bytes: once with
`bin/fm-fleet-snapshot.sh` from the base commit (`sha1 f527fdb`) and once with
the fixed one (`sha1 8ca06ce`), through the real writer
(`bin/fm-home-summary-refresh.sh`), the real Bearings renderer
(`bin/fm-bearings-snapshot.sh`), and the real fleet view
(`bin/fm-fleet-view.sh`).

## Scenario A - 60 still-open captain decisions on one long-lived task

Only the accumulated fold crosses the per-argument limit (152,451 bytes).
Reproduce with `repro-silent-task-drop.sh <firstmate-root> <label>`.

| what the captain relies on | BEFORE (base) | AFTER (fix) |
| --- | --- | --- |
| writer exit | 0 (silent) | 0 |
| producer stderr | `jq: Argument list too long` | empty |
| published summary `valid` | `false` | `true` |
| published summary `invalidity` | `orphan_in_flight: ["migration-run"]` | `null` |
| tasks present in the summary | `["docs-pass"]` - the held task vanished | `["docs-pass","migration-run"]` |
| open captain decisions counted | `0` | `60` |
| Bearings secondmate row | `reason: structured home state invalid: in-flight backlog item has no child metadata: migration-run`, `secondmate_reconcile: orphan_in_flight ["migration-run"]` | `reason: "-"`, no reconcile row |
| parent aggregation of that home | `state: active_child_work`, `child_open_decisions: 0` | `state: captain_decision`, `child_open_decisions: 20` (summary's own disclosed 20-of-60 bound) |

Transcripts: `drop-transcript-before-base-2da3c5e.txt`,
`drop-transcript-after-fix-d46f31f.txt`.

## Scenario B - one oversized status line (186,155 bytes, mirrored note)

A single `needs-decision` line above the limit, as a directly appended or
remote-mirrored payload produces. Reproduce with
`repro-home-summary-argv-overflow.sh <firstmate-root> <label>`.

| what the captain relies on | BEFORE (base) | AFTER (fix) |
| --- | --- | --- |
| writer | `summary producer failed with exit 1: fm-fleet-snapshot: task observation failed`, exit 1 | exit 0 |
| `state/home-summary.json` | never written (`No such file or directory`) | published, `valid: true` |
| the held decision | absent | `release-gate / canary-rollout / needs-decision` |
| Bearings secondmate row | `unknown` - "structured home ledger is missing, unreadable, or invalid" | `active_child_work`, `provenance: structured-home, fresh` |
| Bearings `in_flight` | empty - no child work visible at all | the child's live task row |
| child's oversized bytes in the snapshot | n/a (no snapshot at all) | carried through: `tests/fm-home-summary-refresh.test.sh` asserts `current_state.detail` and `hints.open_decisions[0].summary` equal the full 200,000-character note, and `hints.last_event_text` is longer still |

Transcripts: `transcript-before-base-2da3c5e.txt`,
`transcript-after-fix-d46f31f.txt`.

## Automated regression proof

`tests/fm-home-summary-refresh.test.sh` (this branch's version) run against the
base snapshot script stops at the first new case with
`jq: Argument list too long`; against the target it passes every case.

- `regression-new-tests-fail-at-base.txt`
- `regression-new-tests-pass-at-target.txt`
Evidence: Scenario A diff - what the captain sees before vs after (60 open decisions, 152,451-byte fold)

Source: Scenario A diff - what the captain sees before vs after (60 open decisions, 152,451-byte fold)

# "<" = base 2da3c5e ">" = fix d46f31f < "valid": false, < "invalidity_kind": "orphan_in_flight", < "invalidity_ids": [ "migration-run" ], < "reason": "in-flight backlog item has no child metadata: migration-run", < "tasks_seen": [ "docs-pass" ], < "decisions_open_count": 0 > "valid": true, > "invalidity_kind": null, > "invalidity_ids": [], > "reason": null, > "tasks_seen": [ "docs-pass", "migration-run" ], > "decisions_open_count": 60 < producer stderr: .../bin/fm-fleet-snapshot.sh: line 833: /usr/bin/jq: Argument list too long > producer stderr: # Bearings secondmate row < portal-mate,...,"structured home state invalid: in-flight backlog item has no child metadata: migration-run" > portal-mate,...,"-" # Bearings secondmate_reconcile row < portal-mate,null,null,orphan_in_flight,"[&#34;migration-run&#34;]" > portal-mate,null,null,null,"[]" # parent aggregation of that home < "state": "active_child_work", "child_open_decisions": 0 > "state": "captain_decision", "child_open_decisions": 20

# diff of the two captain-facing runs (scenario A: 60 open decisions, 152,451-byte fold)
# "<" = base 2da3c5e   ">" = fix d46f31f
1,3c1,3
< === BEFORE (base 2da3c5e) ===
< firstmate root under test : /tmp/fm-base-root.udaUTM
< fm-fleet-snapshot.sh sha1 : f527fdbbe08d88fc925c152d935be2a7030ee49d
---
> === AFTER (fix d46f31f) ===
> firstmate root under test : ~/.no-mistakes/worktrees/8d4e8e2579c7/01M2K33QMXBE7W8RC6ZJSWY1P2
> fm-fleet-snapshot.sh sha1 : 8ca06ce35f61a6e1fb127afdd16119b1bd005253
10,16c10,14
<   "valid": false,
<   "invalidity_kind": "orphan_in_flight",
<   "invalidity_ids": [
<     "migration-run"
<   ],
<   "reason": "in-flight backlog item has no child metadata: migration-run",
<   "state": "active_child_work",
---
>   "valid": true,
>   "invalidity_kind": null,
>   "invalidity_ids": [],
>   "reason": null,
>   "state": "captain_decision",
18c16,17
<     "docs-pass"
---
>     "docs-pass",
>     "migration-run"
20c19
<   "decisions_open_count": 0
---
>   "decisions_open_count": 60
25c24
< producer stderr: /tmp/fm-base-root.udaUTM/bin/fm-fleet-snapshot.sh: line 833: /usr/bin/jq: Argument list too long
---
> producer stderr: 
27,28c26,27
<   "valid": false,
<   "invalidity_kind": "orphan_in_flight",
---
>   "valid": true,
>   "invalidity_kind": null,
30c29,30
<     "docs-pass"
---
>     "docs-pass",
>     "migration-run"
32c32
<   "decisions_open_count": 0
---
>   "decisions_open_count": 60
37c37
<   portal-mate,active_child_work,"docs-pass: drafting the release notes",structured-home,fresh,0,false,"structured home state invalid: in-flight backlog item has no child metadata: migration-run"
---
>   portal-mate,active_child_work,"docs-pass: drafting the release notes",structured-home,fresh,0,false,"-"
39c39
<   portal-mate,null,null,orphan_in_flight,"[\"migration-run\"]"
---
>   portal-mate,null,null,null,"[]"
46,47c46,47
<   "state": "active_child_work",
<   "reason": "structured home state invalid: in-flight backlog item has no child metadata: migration-run",
---
>   "state": "captain_decision",
>   "reason": null,
49c49
<   "child_open_decisions": 0
---
>   "child_open_decisions": 20
Evidence: Scenario A transcript - BEFORE (base 2da3c5e): writer exits 0, task silently dropped, summary invalid

Source: Scenario A transcript - BEFORE (base 2da3c5e): writer exits 0, task silently dropped, summary invalid

=== BEFORE (base 2da3c5e) ===
firstmate root under test : /tmp/fm-base-root.udaUTM
fm-fleet-snapshot.sh sha1 : f527fdbbe08d88fc925c152d935be2a7030ee49d
status log bytes          : 152451 across 60 open decisions (MAX_ARG_STRLEN is 131072)

--- 1. the secondmate publishes its own home summary -----------------
writer exit: 0

{
  "valid": false,
  "invalidity_kind": "orphan_in_flight",
  "invalidity_ids": [
    "migration-run"
  ],
  "reason": "in-flight backlog item has no child metadata: migration-run",
  "state": "active_child_work",
  "tasks_seen": [
    "docs-pass"
  ],
  "decisions_open_count": 0
}

--- 2. the same read straight from the producer (stderr shown) --------
producer exit: 0
producer stderr: /tmp/fm-base-root.udaUTM/bin/fm-fleet-snapshot.sh: line 833: /usr/bin/jq: Argument list too long
{
  "valid": false,
  "invalidity_kind": "orphan_in_flight",
  "tasks_seen": [
    "docs-pass"
  ],
  "decisions_open_count": 0
}

--- 3. what the captain sees in Bearings -----------------------------
secondmates[1]{id,state,doing,provenance,freshness,age_seconds,contradiction,reason}:
  portal-mate,active_child_work,"docs-pass: drafting the release notes",structured-home,fresh,0,false,"structured home state invalid: in-flight backlog item has no child metadata: migration-run"
secondmate_reconcile[1]{id,spawn_gen,host,kind,ids}:
  portal-mate,null,null,orphan_in_flight,"[\"migration-run\"]"
decisions_open: []
landed: []

--- 4. the child home as the parent aggregation reports it ------------
{
  "id": "portal-mate",
  "state": "active_child_work",
  "reason": "structured home state invalid: in-flight backlog item has no child metadata: migration-run",
  "child_tasks": [],
  "child_open_decisions": 0
}
Evidence: Scenario A transcript - AFTER (fix d46f31f): summary valid, both tasks present, 60 decisions surfaced

Source: Scenario A transcript - AFTER (fix d46f31f): summary valid, both tasks present, 60 decisions surfaced

=== AFTER (fix d46f31f) ===
firstmate root under test : ~/.no-mistakes/worktrees/8d4e8e2579c7/01M2K33QMXBE7W8RC6ZJSWY1P2
fm-fleet-snapshot.sh sha1 : 8ca06ce35f61a6e1fb127afdd16119b1bd005253
status log bytes          : 152451 across 60 open decisions (MAX_ARG_STRLEN is 131072)

--- 1. the secondmate publishes its own home summary -----------------
writer exit: 0

{
  "valid": true,
  "invalidity_kind": null,
  "invalidity_ids": [],
  "reason": null,
  "state": "captain_decision",
  "tasks_seen": [
    "docs-pass",
    "migration-run"
  ],
  "decisions_open_count": 60
}

--- 2. the same read straight from the producer (stderr shown) --------
producer exit: 0
producer stderr: 
{
  "valid": true,
  "invalidity_kind": null,
  "tasks_seen": [
    "docs-pass",
    "migration-run"
  ],
  "decisions_open_count": 60
}

--- 3. what the captain sees in Bearings -----------------------------
secondmates[1]{id,state,doing,provenance,freshness,age_seconds,contradiction,reason}:
  portal-mate,active_child_work,"docs-pass: drafting the release notes",structured-home,fresh,0,false,"-"
secondmate_reconcile[1]{id,spawn_gen,host,kind,ids}:
  portal-mate,null,null,null,"[]"
decisions_open: []
landed: []

--- 4. the child home as the parent aggregation reports it ------------
{
  "id": "portal-mate",
  "state": "captain_decision",
  "reason": null,
  "child_tasks": [],
  "child_open_decisions": 20
}
Evidence: Scenario B transcript - BEFORE (base): one 186,155-byte status line, no home-summary.json published, Bearings blind

Source: Scenario B transcript - BEFORE (base): one 186,155-byte status line, no home-summary.json published, Bearings blind

=== BEFORE (base 2da3c5e) ===
firstmate root under test : /tmp/fm-base-root.udaUTM
fm-fleet-snapshot.sh sha1 : f527fdbbe08d88fc925c152d935be2a7030ee49d
one status line, bytes    : 186155 (MAX_ARG_STRLEN is 131072)

--- 1. the secondmate publishes its own home summary -----------------
fm-home-summary-refresh: summary producer failed with exit 1: fm-fleet-snapshot: task observation failed 
writer exit: 1

published /tmp/fm-argv-repro.dAHXIa/portal-mate-home/state/home-summary.json:
jq: error: Could not open file /tmp/fm-argv-repro.dAHXIa/portal-mate-home/state/home-summary.json: No such file or directory
summary unreadable

--- 2. what the captain sees in Bearings -----------------------------
schema: fm-bearings.v1
home: fm-argv-repro.dAHXIa/captain-home
generated: "2026-09-15T18:09:34Z"
prs: "not_requested (run: /bearings include PRs)"
in_flight: []
secondmates[1]{id,state,doing,provenance,freshness,age_seconds,contradiction,reason}:
  portal-mate,unknown,"structured home ledger is missing, unreadable, or invalid",unknown,unknown,null,false,"structured home ledger is missing, unreadable, or invalid"
secondmate_reconcile: []
decisions_open: []
landed: []
gates: []
reports: []
recorded_prs: []
unhealthy_endpoints[1]{id,backend,target,exists,agent}:
  portal-mate,tmux,"fmtest:fm-portal-mate",true,dead
omitted[7]{surface,reveal}:
  backlog item bodies,"--fields bodies"
  task paths,"--fields paths"
  watch/steer actions,"--fields actions"
  healthy endpoint detail,"--fields endpoints"
  full scout-report inventory,"--all-reports"
  "secondmate home(s) with unreadable structured state: 1",inspect the listed secondmate home ledgers
  live PR discovery + checks,"--include-prs"

--- 3. what the captain sees in the fleet view -----------------------
# Fleet View

Schema: fm-fleet-snapshot.v1
Home: /tmp/fm-argv-repro.dAHXIa/captain-home

## Under Way
| ID | Current | Kind | Repo/Project | Backend | Endpoint | Artifact | Path | Watch / return channel |
| --- | --- | --- | --- | --- | --- | --- | --- | --- |
| portal-mate | unknown / none | secondmate | /tmp/fm-argv-repro.dAHXIa/portal-mate-home | tmux | present / dead | - | /tmp/fm-argv-repro.dAHXIa/portal-mate-home | bin/fm-send.sh fm-portal-mate '<request>' - read status/doc return channel; do not routinely fm-peek a secondmate for answers |

## Queued
No queued backlog records found.

## Done
No done backlog records found.

## Secondmates
For kind=secondmate, bearings selects validated structured state from that registered home; parent events and bounded terminal evidence are fallback-only supplements and never current-state authority.

--- 4. the child home rows inside the parent snapshot ----------------
{
  "id": "portal-mate",
  "state": "unknown",
  "reason": "structured home ledger is missing, unreadable, or invalid",
  "invalidity_kind": null,
  "children": [],
  "open_decisions": []
}
Evidence: Scenario B transcript - AFTER (fix): summary published valid, decision and child work visible in Bearings and fleet view

Source: Scenario B transcript - AFTER (fix): summary published valid, decision and child work visible in Bearings and fleet view

=== AFTER (fix d46f31f) ===
firstmate root under test : ~/.no-mistakes/worktrees/8d4e8e2579c7/01M2K33QMXBE7W8RC6ZJSWY1P2
fm-fleet-snapshot.sh sha1 : 8ca06ce35f61a6e1fb127afdd16119b1bd005253
one status line, bytes    : 186155 (MAX_ARG_STRLEN is 131072)

--- 1. the secondmate publishes its own home summary -----------------
writer exit: 0

published /tmp/fm-argv-repro.SALVEH/portal-mate-home/state/home-summary.json:
{
  "schema": "fm-secondmate-home-summary.v1",
  "valid": true,
  "invalidity_kind": null,
  "orphan_in_flight": [],
  "endpoint_ids": [
    "docs-pass",
    "release-gate"
  ],
  "decisions_open": [
    {
      "id": "release-gate",
      "key": "canary-rollout",
      "verb": "needs-decision",
      "note_bytes": 161
    }
  ]
}

--- 2. what the captain sees in Bearings -----------------------------
schema: fm-bearings.v1
home: fm-argv-repro.SALVEH/captain-home
generated: "2026-09-15T18:10:34Z"
prs: "not_requested (run: /bearings include PRs)"
in_flight[1]{id,kind,state,repo,name,doing}:
  portal-mate/docs-pass,ship,working,portal,Ordinary follow-up task,drafting the release notes
secondmates[1]{id,state,doing,provenance,freshness,age_seconds,contradiction,reason}:
  portal-mate,active_child_work,"docs-pass: drafting the release notes",structured-home,fresh,0,false,"-"
secondmate_reconcile[1]{id,spawn_gen,host,kind,ids}:
  portal-mate,null,null,null,"[]"
decisions_open: []
landed: []
gates: []
reports: []
recorded_prs: []
unhealthy_endpoints[1]{id,backend,target,exists,agent}:
  portal-mate,tmux,"fmtest:fm-portal-mate",true,dead
omitted[6]{surface,reveal}:
  backlog item bodies,"--fields bodies"
  task paths,"--fields paths"
  watch/steer actions,"--fields actions"
  healthy endpoint detail,"--fields endpoints"
  full scout-report inventory,"--all-reports"
  live PR discovery + checks,"--include-prs"

--- 3. what the captain sees in the fleet view -----------------------
# Fleet View

Schema: fm-fleet-snapshot.v1
Home: /tmp/fm-argv-repro.SALVEH/captain-home

## Under Way
| ID | Current | Kind | Repo/Project | Backend | Endpoint | Artifact | Path | Watch / return channel |
| --- | --- | --- | --- | --- | --- | --- | --- | --- |
| portal-mate | unknown / none | secondmate | /tmp/fm-argv-repro.SALVEH/portal-mate-home | tmux | present / dead | - | /tmp/fm-argv-repro.SALVEH/portal-mate-home | bin/fm-send.sh fm-portal-mate '<request>' - read status/doc return channel; do not routinely fm-peek a secondmate for answers |

## Queued
No queued backlog records found.

## Done
No done backlog records found.

## Secondmates
For kind=secondmate, bearings selects validated structured state from that registered home; parent events and bounded terminal evidence are fallback-only supplements and never current-state authority.

--- 4. the child home rows inside the parent snapshot ----------------
{
  "id": "portal-mate",
  "state": "captain_decision",
  "reason": null,
  "invalidity_kind": null,
  "children": [],
  "open_decisions": []
}
Evidence: Regression proof - branch tests fail at the base snapshot script

Source: Regression proof - branch tests fail at the base snapshot script

$ bash tests/fm-home-summary-refresh.test.sh # bin/fm-fleet-snapshot.sh from BASE 2da3c5e ok - large backlog snapshots and home-summary publication stay within exec limits ok - parent snapshot consumes large child ledgers without argument transport not ok - secondmate home-summary mode reported an error for many long held decisions: bin/fm-fleet-snapshot.sh: line 833: /usr/bin/jq: Argument list too long exit=1

$ bash tests/fm-home-summary-refresh.test.sh   # run with bin/fm-fleet-snapshot.sh from BASE 2da3c5e
ok - watcher-carried status append publishes the real home summary
ok - large backlog snapshots and home-summary publication stay within exec limits
ok - fleet snapshot transport does not require or mutate operational state
ok - parent snapshot consumes large child ledgers without argument transport
not ok - secondmate home-summary mode reported an error for many long held decisions: /tmp/fm-base-root.udaUTM/bin/fm-fleet-snapshot.sh: line 833: /usr/bin/jq: Argument list too long
exit=1
Evidence: Regression proof - the same suite passes at the target commit

Source: Regression proof - the same suite passes at the target commit

ok - many long held decisions on one task publish without exec argument transport ok - one oversized status line publishes a readable home summary untruncated ok - mirrored oversized status lines survive the parent secondmate aggregation ok - a failed open-decision write keeps every task row and never hands an oversized fold to exec exit=0

$ bash tests/fm-home-summary-refresh.test.sh   # target d46f31f
ok - watcher-carried status append publishes the real home summary
ok - large backlog snapshots and home-summary publication stay within exec limits
ok - fleet snapshot transport does not require or mutate operational state
ok - parent snapshot consumes large child ledgers without argument transport
ok - many long held decisions on one task publish without exec argument transport
ok - one oversized status line publishes a readable home summary untruncated
ok - mirrored oversized status lines survive the parent secondmate aggregation
ok - a failed open-decision write keeps every task row and never hands an oversized fold to exec
ok - live watcher cadence bounds publication staleness without signals
ok - fleet snapshot consumes the published local ledger by default
ok - writer kill and replacement preserve an atomic JSON ledger
ok - best-effort publication logs and continues
Terminated
Terminated
ok - best-effort refresh bounds publication lock acquisition
Terminated
ok - best-effort refresh bounds validation and publication
ok - best-effort refresh bounds state initialization
ok - best-effort refresh logs worker termination
ok - best-effort refresh bounds failure reporting fallback
ok - valid publication ignores an unavailable failure record
ok - publication completes on a home carrying accumulated status history
ok - producer skips remote per-task state probes
ok - a stalled publication does not delay the watcher liveness beacon
ok - publication remains single-flight across watcher restart
ok - bootstrap scopes retained failures to the current publication
Terminated
ok - failure records preserve refresh attempt ordering
ok - repeated publication failure is reported at session start until it clears
exit=0
Evidence: Reproduction script - scenario A (folded open decisions, silent task drop)

Source: Reproduction script - scenario A (folded open decisions, silent task drop)

#!/usr/bin/env bash
# End-user reproduction for the SILENT task-drop variant of the same overflow.
#
# usage: repro-silent-task-drop.sh <firstmate-root> <label>
#
# One long-lived task accumulates many still-open needs-decision notes. The
# folded open-decision set (not any single line) crosses Linux's 128 KiB
# MAX_ARG_STRLEN, so the per-task jq that carried it on argv could not exec. The
# failure was swallowed by an unchecked pipe, so the task disappeared from the
# snapshot and the published home summary went invalid (orphan_in_flight),
# which is what made the home read as unreadable/orphaned to Bearings.
set -u

ROOT_UNDER_TEST=$1
LABEL=$2

# shellcheck source=/dev/null
. "$ROOT_UNDER_TEST/tests/lib.sh"

TMP_ROOT=$(fm_test_tmproot fm-argv-drop)
FAKEBIN=$(fm_fakebin "$TMP_ROOT")
cat > "$FAKEBIN/tmux" <<'SH'
#!/usr/bin/env bash
case "${1:-}" in
  display-message) printf '%%1\n' ;;
  capture-pane) printf 'fixture pane\n> \n' ;;
esac
exit 0
SH
chmod +x "$FAKEBIN/tmux"

NOW=2026-08-29T09:00:00Z
EPOCH=1787130000
HOME_DIR="$TMP_ROOT/portal-mate-home"
PARENT="$TMP_ROOT/captain-home"

mkdir -p "$HOME_DIR/state" "$HOME_DIR/data" "$HOME_DIR/config" \
  "$HOME_DIR/projects/portal" "$HOME_DIR/bin"
printf '# Seeded Firstmate home\n' > "$HOME_DIR/AGENTS.md"
printf 'portal-mate\n' > "$HOME_DIR/.fm-secondmate-home"
fm_git_init_commit "$HOME_DIR/projects/portal" >/dev/null 2>&1
cat > "$HOME_DIR/data/backlog.md" <<'EOF'
## In flight
- [ ] migration-run - Long-lived migration holding many captain decisions (repo: portal) (kind: ship) (since 2026-08-20)
- [ ] docs-pass - Ordinary follow-up task (repo: portal) (kind: ship) (since 2026-08-28)

## Queued

## Done
EOF
for task_id in migration-run docs-pass; do
  fm_write_meta "$HOME_DIR/state/$task_id.meta" \
    "window=fmtest:fm-$task_id" \
    "worktree=$HOME_DIR/projects/portal" \
    "project=portal" \
    "harness=claude" \
    "kind=ship" \
    "mode=no-mistakes" \
    "spawn_gen=fm.$task_id.123456"
done

# 60 still-open decisions, each note long but individually well under the
# per-argument limit: only the accumulated fold crosses it.
note=$(printf 'x%.0s' $(seq 1 2500))
i=1
while [ "$i" -le 60 ]; do
  printf 'needs-decision [key=migration-step-%s]: %s\n' "$i" "$note"
  i=$((i + 1))
done > "$HOME_DIR/state/migration-run.status"
printf 'working: drafting the release notes\n' > "$HOME_DIR/state/docs-pass.status"
for task_id in migration-run docs-pass; do
  gen=$("$ROOT_UNDER_TEST/bin/fm-busy-event.sh" arm "$HOME_DIR/state" "$task_id")
  "$ROOT_UNDER_TEST/bin/fm-busy-event.sh" apply "$HOME_DIR/state" "$task_id" idle \
    --gen "$gen" --source claude-hook --event stop
done

mkdir -p "$PARENT/state" "$PARENT/data" "$PARENT/config" "$PARENT/projects/portal"
printf '# Seeded Firstmate home\n' > "$PARENT/AGENTS.md"
fm_git_init_commit "$PARENT/projects/portal" >/dev/null 2>&1
printf '%s\n' '## In flight' '' '## Queued' '' '## Done' > "$PARENT/data/backlog.md"
printf -- '- portal-mate - portal domain (home: %s; scope: portal work; projects: portal; added 2026-08-28)\n' \
  "$HOME_DIR" > "$PARENT/data/secondmates.md"
fm_write_secondmate_meta "$PARENT/state/portal-mate.meta" \
  "$HOME_DIR" "fmtest:fm-portal-mate" portal claude

printf '=== %s ===\n' "$LABEL"
printf 'firstmate root under test : %s\n' "$ROOT_UNDER_TEST"
printf 'fm-fleet-snapshot.sh sha1 : %s\n' \
  "$(sha1sum "$ROOT_UNDER_TEST/bin/fm-fleet-snapshot.sh" | cut -d' ' -f1)"
printf 'status log bytes          : %s across 60 open decisions (MAX_ARG_STRLEN is 131072)\n\n' \
  "$(wc -c < "$HOME_DIR/state/migration-run.status")"

printf -- '--- 1. the secondmate publishes its own home summary -----------------\n'
PATH="$FAKEBIN:$PATH" FM_ROOT_OVERRIDE="$ROOT_UNDER_TEST" FM_HOME="$HOME_DIR" \
  FM_SNAPSHOT_NOW="$NOW" FM_SNAPSHOT_NOW_EPOCH="$EPOCH" \
  "$ROOT_UNDER_TEST/bin/fm-home-summary-refresh.sh" 2>&1
printf 'writer exit: %s\n\n' "$?"
jq '{valid, invalidity_kind: .invalidity.kind, invalidity_ids: .invalidity.ids,
     reason: .reason,
     state: .state,
     tasks_seen: [.endpoints[].id],
     decisions_open_count: .counts.decisions_open}' \
  "$HOME_DIR/state/home-summary.json" 2>&1 || printf 'summary unreadable\n'

printf -- '\n--- 2. the same read straight from the producer (stderr shown) --------\n'
PATH="$FAKEBIN:$PATH" FM_ROOT_OVERRIDE="$ROOT_UNDER_TEST" FM_HOME="$HOME_DIR" \
  FM_SNAPSHOT_NOW="$NOW" FM_SNAPSHOT_NOW_EPOCH="$EPOCH" \
  "$ROOT_UNDER_TEST/bin/fm-fleet-snapshot.sh" --secondmate-home-summary \
  > "$TMP_ROOT/direct.json" 2> "$TMP_ROOT/direct.err"
printf 'producer exit: %s\n' "$?"
printf 'producer stderr: %s\n' "$(cat "$TMP_ROOT/direct.err")"
jq '{valid, invalidity_kind: .invalidity.kind, tasks_seen: [.endpoints[].id],
     decisions_open_count: .counts.decisions_open}' "$TMP_ROOT/direct.json" 2>&1

printf -- '\n--- 3. what the captain sees in Bearings -----------------------------\n'
PATH="$FAKEBIN:$PATH" FM_ROOT_OVERRIDE="$ROOT_UNDER_TEST" FM_HOME="$PARENT" \
  FM_SNAPSHOT_NOW="$NOW" FM_SNAPSHOT_NOW_EPOCH="$EPOCH" \
  "$ROOT_UNDER_TEST/bin/fm-bearings-snapshot.sh" 2>&1 \
  | sed -n '/^secondmates/,/^landed/p'

printf -- '\n--- 4. the child home as the parent aggregation reports it ------------\n'
PATH="$FAKEBIN:$PATH" FM_ROOT_OVERRIDE="$ROOT_UNDER_TEST" FM_HOME="$PARENT" \
  FM_SNAPSHOT_NOW="$NOW" FM_SNAPSHOT_NOW_EPOCH="$EPOCH" \
  "$ROOT_UNDER_TEST/bin/fm-fleet-snapshot.sh" --json 2>/dev/null \
  | jq '.secondmate_current.records[] | {id, state: .current.state,
      reason: .current.reason,
      child_tasks: [.children[]? | .id],
      child_open_decisions: [.decisions_open[]? | .key] | length}' 2>&1

printf '\n'
Evidence: Reproduction script - scenario B (one oversized mirrored status line)

Source: Reproduction script - scenario B (one oversized mirrored status line)

#!/usr/bin/env bash
# End-user reproduction for the secondmate home-summary argv overflow.
#
# usage: repro-home-summary-argv-overflow.sh <firstmate-root> <label>
#
# Seeds a realistic secondmate home whose in-flight task holds ONE oversized
# status line (a mirrored needs-decision note above Linux's 128 KiB
# MAX_ARG_STRLEN), publishes that home's summary with the real writer, and then
# renders the captain-facing parent surfaces (Bearings + fleet view) that read
# it. Run it against the base root and the fixed root to compare what a captain
# actually sees.
set -u

ROOT_UNDER_TEST=$1
LABEL=$2

# shellcheck source=/dev/null
. "$ROOT_UNDER_TEST/tests/lib.sh"

TMP_ROOT=$(fm_test_tmproot fm-argv-repro)
FAKEBIN=$(fm_fakebin "$TMP_ROOT")
cat > "$FAKEBIN/tmux" <<'SH'
#!/usr/bin/env bash
case "${1:-}" in
  display-message) printf '%%1\n' ;;
  capture-pane) printf 'fixture pane\n> \n' ;;
esac
exit 0
SH
chmod +x "$FAKEBIN/tmux"

NOW=2026-08-29T09:00:00Z
EPOCH=1787130000

CHILD="$TMP_ROOT/portal-mate-home"
PARENT="$TMP_ROOT/captain-home"

# --- the child secondmate home ---------------------------------------------
mkdir -p "$CHILD/state" "$CHILD/data" "$CHILD/config" "$CHILD/projects/portal" "$CHILD/bin"
printf '# Seeded Firstmate home\n' > "$CHILD/AGENTS.md"
printf 'portal-mate\n' > "$CHILD/.fm-secondmate-home"
fm_git_init_commit "$CHILD/projects/portal" >/dev/null 2>&1
cat > "$CHILD/data/backlog.md" <<'EOF'
## In flight
- [ ] release-gate - Ship the canary rollout gate (repo: portal) (kind: ship) (since 2026-08-28)
- [ ] docs-pass - Ordinary follow-up task (repo: portal) (kind: ship) (since 2026-08-28)

## Queued

## Done
EOF
fm_write_meta "$CHILD/state/release-gate.meta" \
  "window=fmtest:fm-release-gate" \
  "worktree=$CHILD/projects/portal" \
  "project=portal" \
  "harness=claude" \
  "kind=ship" \
  "mode=no-mistakes" \
  "spawn_gen=fm.release123456"
fm_write_meta "$CHILD/state/docs-pass.meta" \
  "window=fmtest:fm-docs-pass" \
  "worktree=$CHILD/projects/portal" \
  "project=portal" \
  "harness=claude" \
  "kind=ship" \
  "mode=no-mistakes" \
  "spawn_gen=fm.docs123456"

# One status line, no size bound: a mirrored remote reply payload appended whole.
long_detail=''
i=1
while [ "$i" -le 1600 ]; do
  long_detail="$long_detail canary step $i verified: latency 41ms, error budget intact, awaiting captain sign-off before widening the rollout."
  i=$((i + 1))
done
printf 'needs-decision [key=canary-rollout]: widen the canary to 50%%?%s\n' "$long_detail" \
  > "$CHILD/state/release-gate.status"
printf 'working: drafting the release notes\n' > "$CHILD/state/docs-pass.status"

# Both panes are idle (the agents stopped at their gates), so current state comes
# from the durable status log rather than a live pane read.
for task_id in release-gate docs-pass; do
  gen=$("$ROOT_UNDER_TEST/bin/fm-busy-event.sh" arm "$CHILD/state" "$task_id")
  "$ROOT_UNDER_TEST/bin/fm-busy-event.sh" apply "$CHILD/state" "$task_id" idle \
    --gen "$gen" --source claude-hook --event stop
done

STATUS_BYTES=$(wc -c < "$CHILD/state/release-gate.status")

# --- the captain's parent home, with that child registered ------------------
mkdir -p "$PARENT/state" "$PARENT/data" "$PARENT/config" "$PARENT/projects/portal"
printf '# Seeded Firstmate home\n' > "$PARENT/AGENTS.md"
fm_git_init_commit "$PARENT/projects/portal" >/dev/null 2>&1
printf '%s\n' '## In flight' '' '## Queued' '' '## Done' > "$PARENT/data/backlog.md"
printf -- '- portal-mate - portal domain (home: %s; scope: portal work; projects: portal; added 2026-08-28)\n' \
  "$CHILD" > "$PARENT/data/secondmates.md"
fm_write_secondmate_meta "$PARENT/state/portal-mate.meta" \
  "$CHILD" "fmtest:fm-portal-mate" portal claude

printf '=== %s ===\n' "$LABEL"
printf 'firstmate root under test : %s\n' "$ROOT_UNDER_TEST"
printf 'fm-fleet-snapshot.sh sha1 : %s\n' \
  "$(sha1sum "$ROOT_UNDER_TEST/bin/fm-fleet-snapshot.sh" | cut -d' ' -f1)"
printf 'one status line, bytes    : %s (MAX_ARG_STRLEN is 131072)\n\n' "$STATUS_BYTES"

printf -- '--- 1. the secondmate publishes its own home summary -----------------\n'
PATH="$FAKEBIN:$PATH" FM_ROOT_OVERRIDE="$ROOT_UNDER_TEST" FM_HOME="$CHILD" \
  FM_SNAPSHOT_NOW="$NOW" FM_SNAPSHOT_NOW_EPOCH="$EPOCH" \
  "$ROOT_UNDER_TEST/bin/fm-home-summary-refresh.sh" 2>&1
printf 'writer exit: %s\n' "$?"
printf '\npublished %s:\n' "$CHILD/state/home-summary.json"
jq '{schema, valid, invalidity_kind: .invalidity.kind,
     orphan_in_flight: (.invalidity.orphan_in_flight // []),
     endpoint_ids: [.endpoints[].id],
     decisions_open: [.decisions_open[] | {id, key, verb, note_bytes: (.summary | length)}]}' \
  "$CHILD/state/home-summary.json" 2>&1 || printf 'summary unreadable\n'

printf -- '\n--- 2. what the captain sees in Bearings -----------------------------\n'
PATH="$FAKEBIN:$PATH" FM_ROOT_OVERRIDE="$ROOT_UNDER_TEST" FM_HOME="$PARENT" \
  FM_SNAPSHOT_NOW="$NOW" FM_SNAPSHOT_NOW_EPOCH="$EPOCH" \
  "$ROOT_UNDER_TEST/bin/fm-bearings-snapshot.sh" 2>&1 \
  | sed -n '1,60p'

printf -- '\n--- 3. what the captain sees in the fleet view -----------------------\n'
PATH="$FAKEBIN:$PATH" FM_ROOT_OVERRIDE="$ROOT_UNDER_TEST" FM_HOME="$PARENT" \
  FM_SNAPSHOT_NOW="$NOW" FM_SNAPSHOT_NOW_EPOCH="$EPOCH" \
  "$ROOT_UNDER_TEST/bin/fm-fleet-view.sh" 2>&1 | sed -n '1,40p'

printf -- '\n--- 4. the child home rows inside the parent snapshot ----------------\n'
PATH="$FAKEBIN:$PATH" FM_ROOT_OVERRIDE="$ROOT_UNDER_TEST" FM_HOME="$PARENT" \
  FM_SNAPSHOT_NOW="$NOW" FM_SNAPSHOT_NOW_EPOCH="$EPOCH" \
  "$ROOT_UNDER_TEST/bin/fm-fleet-snapshot.sh" --json 2>/dev/null \
  | jq '.secondmate_current.records[] | {id, state: .current.state, reason: .current.reason,
      invalidity_kind: .invalidity.kind,
      children: [.children[]? | {id, state}],
      open_decisions: [.parent_event.open_decisions[]? | .key]}' 2>&1

printf '\n'
- Outcome: ⚠️ 2 infos across 1 run (16m18s)

Pipeline

Updates from git push no-mistakes

⏭️ **intent** - skipped

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

⚠️ **Review** - 4 infos
  • ℹ️ bin/fm-fleet-snapshot.sh:946 - ($open_decisions_file[0]) as $open_decisions is the only one of the three new transport reads in this composing jq without a // fallback: its siblings at lines 944-945 both supply a bounded default object. Verified with jq 1.7 that --slurpfile on an empty or whitespace-only file yields [], so [0] is null and the row publishes hints.open_decisions: null instead of an array. Two writers can produce that shape: the success path at line 869 writes printf &#39;%s\n&#39; &#34;$open_decisions_json&#34;, which is a bare newline when open_decisions_json is empty, and the argv fallback at line 878 becomes --argjson open_decisions_file &#34;[]&#34; in the same case. Reaching an empty open_decisions_json requires the producing jq -R -s at line 855 to emit nothing, so this is defensive rather than routine, and both current consumers (bin/fm-fleet-snapshot.sh:1120 and :1849) read it as .hints.open_decisions // [], so nothing downstream breaks today. It still contradicts the contract sentence added at line 59 ("hints.open_decisions can be empty" - empty, not null). Remedy is the one-token // [] to match the siblings; no new state, schema, or failure policy.
  • ℹ️ bin/fm-fleet-snapshot.sh:927 - After this change --arg pr &#34;$pr&#34; is the last status-log-derived value in the per-task composing jq that still rides an exec argument, so the invariant this commit documents at line 63 ("The row itself is never dropped") has one remaining source-verifiable hole. pr comes from first_pr_url_in_file &#34;$status_log&#34; (line 389), which is grep -Eo &#39;https?://[^[:space:])&#34;]+/pull/[0-9]+&#39; | head -1; the character class is greedy and excludes only whitespace, ) and &#34;, so on one line the match spans from the first https:// to the LAST /pull/&lt;digits&gt;. Nothing bounds one status line: bin/fm-procevent-remote-reply.sh verifies payload_bytes against its digest (lines 336-354) but never caps it, and appends each normalized payload line straight into the status stream (line 402). A mirrored payload line above MAX_ARG_STRLEN whose bytes contain no whitespace, ) or &#34; between a URL prefix and a trailing /pull/N (for example a comma-joined PR/URL list) makes --arg pr exceed the 128 KiB per-argument limit; the composing jq then fails to exec, and because the loop body is the left side of done | jq -s at line 981 with no pipefail, TASKS_JSON=$(task_json_lines) || ... at line 2062 never fires and the task row silently vanishes - the exact symptom this branch exists to remove. The shape requirement makes this much narrower than the raw/note/detail/fold paths already fixed, hence info rather than a blocker. Earliest correction at the shared boundary is mechanical and local: bound the extractor's output in first_pr_url_in_file (a real PR URL has a practical length limit) so no status-derived value can reach exec, rather than adding a fourth per-payload transport later.
  • ℹ️ bin/fm-fleet-snapshot.sh:811 - The new readability gate runs jq -e &#39;type == &#34;object&#34;&#39; &#34;$current_file&#34; and then, on success, a second jq -r &#39;[.state // &#34;&#34;, .source // &#34;&#34;] | @tsv&#39; &#34;$current_file&#34; (line 813) over the same file, where the base revision used one $(&lt;&#34;$current_file&#34;) plus one jq. That is one extra process per task in the sequential task_json_lines loop, and the || printf &#39;\t\n&#39; guard on line 813 is now dead because the gate already proved the file parses. Both the gate and the read collapse into a single invocation whose exit status carries the verdict, e.g. if state_tsv=$(jq -er &#39;select(type == &#34;object&#34;) | [.state // &#34;&#34;, .source // &#34;&#34;] | @tsv&#39; &#34;$current_file&#34; 2&gt;/dev/null); then read -r current_state current_source &lt;&lt;&lt;&#34;$state_tsv&#34;; else &lt;degrade&gt;; fi - same degradation semantics, one fewer exec per task, and no dead fallback. Non-functional; no user-visible output changes.
  • ℹ️ tests/fm-home-summary-refresh.test.sh:506 - The write-failure test isolates the failing write purely by filename length: it probes that &lt;236-char-id&gt;.crew-state-detail (254 bytes) fits and &lt;id&gt;.open-decisions.json (256 bytes) does not. Those suffixes are internal transport names, not a declared contract, and the small-fold case that follows (line 528) asserts only open_decisions | length == 1 and open_decisions[0].key == &#34;transport&#34; - which holds identically when the write SUCCEEDS. So if a future rename or a different NAME_MAX changes which write fails, that case passes vacuously and the newly added argv-fallback branch at line 878 loses its only coverage without any failure (the else branch just prints skip). The oversized sibling at line 541 is non-vacuous (length == 0 would fail if the write succeeded), so the mechanism is not uncovered today. Mechanical tightening that stays behavioral: the snapshot's degradation line on stderr is an explicitly documented output surface (header line 56: "reports the degradation on stderr"), so assert that $TMP_ROOT/write-fail-small.err contains the open-decision transport write failed; passing the fold on argv line, which proves the intended write actually failed instead of inferring it from a filesystem probe.
⚠️ **Test** - 2 infos
  • ℹ️ tests/fm-bearings-snapshot.test.sh:1623 - Unrelated to this change: the final case in tests/fm-bearings-snapshot.test.sh ("landed accepts only kind-owned delivery artifacts") fails immediately on this host because its guard [ -n &#34;$TASKS_AXI_BIN&#34; ] finds no tasks-axi binary on PATH (TASKS_AXI_BIN is a plain command -v tasks-axi lookup at line 17). It is a host prerequisite, not a product failure, and installing system packages is outside this run's allowed boundary. Every other case in that file passes against the target commit. Remote CI, which owns broad regression, needs the tasks-axi CLI available for that case to run at all.
  • ℹ️ bin/fm-fleet-snapshot.sh:810 - Coverage disclosure for this test phase: the open-decision write-failure degradation is genuinely exercised (the suite injects a real ENAMETOOLONG write failure with a 236-character task id and proves both the small-fold argv path and the oversized-fold degradation keep every row), but the two sibling degradations added in the same round - unreadable per-task current-state observation (line ~810) and failed status-event transport (line ~828) - cannot be triggered through any public interface. Their transport filenames are shorter than the crew-state files written earlier in the same loop (&lt;id&gt;.json +5 and &lt;id&gt;.event-raw +10 versus &lt;id&gt;.crew-state-raw +16), so any filesystem-name or write failure that would reach them aborts the snapshot earlier by the accepted crew-state policy, and the observation directory is private to the process. They remain untested defensive fallbacks; no test was added rather than one that could only assert on source text.
  • bash tests/fm-home-summary-refresh.test.sh (target d46f31f) - all cases pass, including the four new argv-transport cases (60 long held decisions, one 200,000-char status line, mirrored parent aggregation, and a real ENAMETOOLONG open-decision write failure)
  • bash tests/fm-home-summary-refresh.test.sh run against a root whose bin/fm-fleet-snapshot.sh is the BASE 2da3c5e file - fails at the first new case with jq: Argument list too long (regression reproduced before the fix)
  • bash tests/fm-fleet-snapshot-view.test.sh - snapshot/fleet-view contract consumers of the changed composition, all pass
  • bash tests/fm-bearings-snapshot.test.sh - heaviest consumer of the changed secondmate aggregation; all cases pass except the tasks-axi-gated landed case (host prerequisite missing)
  • Manual end-to-end, scenario A (silent task drop): bash repro-silent-task-drop.sh &lt;root&gt; &lt;label&gt; run against base and target - seeds a real secondmate home whose long-lived task holds 60 still-open needs-decision notes (152,451-byte fold), publishes with bin/fm-home-summary-refresh.sh, then renders bin/fm-bearings-snapshot.sh and the parent bin/fm-fleet-snapshot.sh --json aggregation from a captain home that registers it
  • Manual end-to-end, scenario B (one oversized line): bash repro-home-summary-argv-overflow.sh &lt;root&gt; &lt;label&gt; run against base and target - one 186,155-byte mirrored needs-decision status line, same writer plus bin/fm-bearings-snapshot.sh and bin/fm-fleet-view.sh captain surfaces
  • Confirmed the worktree is clean (git status --porcelain empty) and removed the throwaway base-root used for the before/after comparison
⚠️ **Document** - 1 info
  • ℹ️ bin/fm-fleet-snapshot.sh:244 - Judgment call, deliberately not changed: the new per-task degradation behavior (a snapshot that reports an unreadable observation on stderr and still exits 0 with a degraded row) is stated only in the script header, which is the output contract's single owner. The --help text was left alone rather than carrying a second copy: it already restates bounds facts the header owns, and adding the degradation contract there would create a second full copy that drifts, against the repo's one-owner rule and the mechanics tier in .agents/skills/firstmate-coding-guidelines/SKILL.md. If maintainers prefer --help to disclose the exit-zero-with-degradation case, the smallest safe form is a one-line pointer to the header rather than a restatement.
✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

@neilwashere
neilwashere force-pushed the fm/fix-secondmate-home-summary-argv-overflow branch from 2a3c06c to 57e41f5 Compare September 13, 2026 20:11
@neilwashere neilwashere changed the title fix(bin): file-back unbounded per-task snapshot payloads fix(bin): keep oversized status payloads off exec argv in fleet snapshot Sep 13, 2026
@neilwashere
neilwashere force-pushed the fm/fix-secondmate-home-summary-argv-overflow branch from 57e41f5 to 3cb2730 Compare September 15, 2026 13:23
@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate:

First look on HEAD 3cb2730d80f3d1e82d052282f5cd1fd737a0adde vs main 8b10b61e3feace8f275c6d0b3e490cdf7ab1f67d. MERGEABLE / UNSTABLE. Author neilwashere not blocked. Last push ~2026-09-13 — not 14-day stale.

Contract-class: restore. Fleet snapshot already owed readable Bearings/home summaries; oversized status/open-decision payloads on exec argv hit Linux MAX_ARG_STRLEN and made summaries invalid. Diff file-backs unbounded payloads (jq --rawfile/--slurpfile) and degrades a single task row instead of aborting the snapshot.

VISION.md per-rule (inspected bin/fm-fleet-snapshot.sh + tests/fm-home-summary-refresh.test.sh):

  • One captain, one interface — aligns (Bearings/home summary readable again).
  • Authority explicit — n/a / aligns (no new autonomy).
  • Scripts own mechanics — aligns (deterministic transport + size gate).
  • Restart non-event — aligns (durable status folds still projected).
  • Delegation with spine — aligns (per-task degradation rather than silent vanish when transport works as designed).
  • Fleet outlives vendor — aligns.
  • Scope — aligns (command-layer projection fix).

Attestation: MISMATCH — body marker 57e41f546664ad7edc641600919327224fd79193 ≠ tip 3cb2730d…. Require no-mistakes 34974703081 FAILURE for that reason. Approved first-time fork CI 34974702790 + NM after safe review (snapshot/tests only). CI running; merge gate remains attestation refresh.

waiting-author: please re-run git push no-mistakes so the PR body attestation binds to 3cb2730d….

Non-blocking review notes already in the PR body (fallback write / remaining --arg pr argv edge) — FYI only, not a captain card while attestation is missing.

A task's whole-status-log open-decision fold (status_open_decisions) has
no size bound: it keeps every still-open needs-decision/blocked note,
however long, until resolved. task_json_lines() embedded that fold
through jq's --argjson, a single exec argument, so a task with many
long-held decisions could exceed Linux's 128 KiB MAX_ARG_STRLEN and fail
with "Argument list too long". The failure was swallowed by the
unchecked "done | jq -s" pipe, so the affected task silently vanished
from the snapshot instead of loudly failing, turning its home summary
invalid (orphan_in_flight) and making it unreadable to Bearings.

The originally suspected cause - the whole backlog JSON riding
--argjson - was already fixed for both fleet-snapshot assembly points in
kunchenguid#3677; this is a second, narrower survivor of the same argv-limit class
that kunchenguid#3677's large-backlog fixtures never exercised, because they carry
no task metadata and so never reach task_json_lines()'s per-task fold.

File-back the fold the same way kunchenguid#3677 file-backed the larger payloads,
via a private per-task temp file and --slurpfile.
@neilwashere
neilwashere force-pushed the fm/fix-secondmate-home-summary-argv-overflow branch from 3cb2730 to 0b30058 Compare September 15, 2026 18:35
@neilwashere neilwashere changed the title fix(bin): keep oversized status payloads off exec argv in fleet snapshot fix(bin): keep unbounded fleet-snapshot payloads off exec argv Sep 15, 2026
@neilwashere

Copy link
Copy Markdown
Author

Closing in favor of a fresh PR from the same branch rebased onto current main; no code change.

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.

2 participants