Skip to content

fix(bootstrap): send the secondmate re-read nudge fire-and-forget - #4717

Open
talktejas wants to merge 20 commits into
kunchenguid:mainfrom
talktejas:fm/fm-idle-mate-reply-noise
Open

talktejas wants to merge 20 commits into
kunchenguid:mainfrom
talktejas:fm/fm-idle-mate-reply-noise

Conversation

@talktejas

Copy link
Copy Markdown

Summary

  • The secondmate reread-AGENTS.md nudge (sent after firstmate self-updates) went through the ordinary marked fm-send.sh path, which always creates a durable pending-reply expectation.
  • That nudge has no reply protocol: a secondmate just re-reads AGENTS.md and keeps idling, so nothing ever writes a corr= line back. The expectation would recover once, escalate once, then stay open forever - re-announcing on every later session start for a perfectly healthy, idle secondmate. bin/fm-pending-reply-lib.sh's own contract says a merely-waiting request must keep re-announcing, but this request could never be answered in the first place; the fault was creating the expectation at all, not the re-announce logic itself.
  • Fixed by routing all three nudge send sites in bin/fm-bootstrap.sh (local, local-retry, remote) through fm-send.sh's --fire-and-forget plane with a deterministic delivery id - the same plane bin/fm-secondmate-reconcile.sh already uses for its own no-reply-expected nudge - so no pending-reply expectation is ever created for it.

DELIVERY NOTE

Ships direct-PR rather than through the no-mistakes pipeline: the pipeline's cached copy of this repository currently points at the project firstmate was originally forked from rather than at talktejas/firstmate, so it rebases any change onto months of unrelated history and fails. Fixing that needs the captain's permission to update a tool, which has not been given yet.

Test plan

  • tests/fm-secondmate-sync.test.sh (34 tests, full suite) - all pass, including new test_bootstrap_nudge_creates_no_pending_reply_expectation, which reproduces the bug against the real fm-send.sh/fm-bootstrap.sh path and asserts no state/pending-replies/ record is created for the nudge.
  • tests/fm-secondmate-harness.test.sh - all pass except one pre-existing flaky test (test_config_reread_serializes_concurrent_pushes), confirmed to fail identically on the unmodified base branch and unrelated to this change (it exercises fm-config-push.sh, not the nudge path).
  • bin/fm-lint.sh (shellcheck) clean on both changed files.

talktejas and others added 14 commits July 29, 2026 11:43
A freshly allocated pool worktree lands on the repository's default branch.
Both registered projects develop on `develop`, so a cold slot could start a
worker on a tree roughly a thousand commits behind current work, with no
warning anywhere; a reused slot already sits on the right branch, which is why
this stayed hidden. Task jt-style-number-column audited such a stale tree and
correctly reported that nothing described in its brief existed.

`data/projects.md` now records the intended base branch as a `base=<branch>`
token inside the existing bracket, alongside the delivery mode and `+yolo`.
`bin/fm-project-mode.sh` reads it with a new `--base` query; its default
two-word output and every pre-existing line shape parse exactly as before.

`bin/fm-spawn.sh` detaches the task worktree at that base before the harness
launches - the recorded branch, else the repository default branch as today -
and then asserts the result. A base it cannot confirm is refused, naming the
expected branch, the actual base, and the gap, instead of launching silently.
With no recorded base the primary checkout's own branch is independent
evidence: an assumed default base that is strictly behind it is the incident
above and is refused with the exact registry line to add.

An unregistered project, or a registry line without a base record, resolves its
base exactly as it does today.
…ilter

fm-fleet-snapshot.sh embedded the full backlog/tasks JSON as jq command-line
arguments in several places; a large held-for-captain backlog (long
multi-line hold reasons) blew past the kernel's argv limit and crashed the
snapshot with "Argument list too long", which was also silently failing the
home-summary publisher hundreds of times. Those blobs now go to jq on disk
via --rawfile instead.

The bearings board dealt Captain's Call cards one at a time with no way to
narrow the pile. Add a project/type filter bar (counts per choice, multiple
filters combinable, clear-all, graceful empty state) that also narrows
Underway/Landed/Charted by project, built entirely from the template's
existing design tokens.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01RgjFRC1K8jd9Hhn74cCP6N
…shot

Two review findings on the filter/argv-limit fix:

- The bearings board's Charted Next dispatch picker kept a checkbox's
  selection even after a filter hid its row, so ticking an item and then
  switching projects could dispatch work the captain could no longer see.
  Filtering a row out now clears any pick it was carrying.

- fm-fleet-snapshot.sh's snapshot_json_arg_file created SNAPSHOT_ARGS_DIR
  inside its own command-substitution subshell, so that assignment never
  reached the parent shell and the EXIT trap never removed it - every
  snapshot run leaked a private temp directory holding backlog/task JSON.
  Directory creation now happens via a separate function the caller must
  run as a plain statement (snapshot_ensure_args_dir), so the trap can see
  it. Also split the trap's two cleanups apart: secondmate_current_json
  already calls the collection cleanup explicitly mid-script, and coupling
  the args-dir cleanup to that same function deleted the backlog/tasks
  files before the final jq assembly could read them.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01RgjFRC1K8jd9Hhn74cCP6N
…of hiding them

Three faults on the decision board, all captain-reported.

**A typed answer read as refused.** The card's own submit handler already
treated a bare note as the whole answer, and it does: driven through a real
browser against a built board - including the captain's own 92-card payload,
with and without a project filter - typing with nothing selected queues that
text, survives the capture, and is accepted by the keyed-answer intake.

What actually bit him is next to that box. The board is embedded in a review
tool whose annotate mode is on by default, and clicking a card anywhere that
is not a control opens the tool's own annotation popup. Words typed there are
captured as a comment on the card, not an answer to it, and the answer intake
reads only choice rows - so the question stayed open. Ticking an option and
using the card's button worked. From the captain's seat those are one box that
needs an option first.

So the dealt card now takes the caret into its own answer box, which is where
typing should land, and an empty submit says what is missing instead of leaving
a dead button to be read as a refusal.

**A card carrying four questions, and a card too thin to answer.** Both are
real faults and neither may cost the captain the question: he cannot answer
what he is never shown. The board flags them on the card's face and deals them
anyway - `bundle` when a card asks more than one question or offers options
about how to work through it, `incomplete` when the composer names what it has
not established yet in the new optional `missing` field. Nothing in the build
path withholds, drops or defers a card; the composer instructions now carry the
one-question rule and the duty to find the specifics before composing.

The render harness grew a FormData shim, a prompt recorder and a form-submit
action, so the answer a captain queues is asserted through the shipped
template rather than inferred from it.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01FydWhqr8VdPVtc5bvTfFC2
main landed its own fix for the fleet snapshot's argv limit (kunchenguid#3677) while this
branch carried an independent fix for the same crash, so bin/fm-fleet-snapshot.sh
conflicted in seven places.

Resolved to main's implementation throughout. Both sides move the large
backlog/tasks JSON off the jq command line; main hands jq files through a
top-level JSON_TRANSPORT_DIR removed by cleanup_json_files on exit, this branch
used --rawfile with a lazily created SNAPSHOT_ARGS_DIR. Main's shape is also
structurally free of the two follow-up defects 36c52f1 had to patch here: its
transport directory is assigned as a plain statement rather than inside a
command substitution, so the EXIT trap can always see it, and its cleanup is
not coupled to snapshot_collection_cleanup, which secondmate_current_json calls
mid-script while those files are still being read. Nothing this branch changed
in that file survives except through main's equivalent, so no behaviour is lost.

This branch's own deliverables - the board filter bar, the dispatch-pick
clearing, and the decision-card answer fixes - live in the board template and
did not conflict.

Verified after resolution: fm-bearings-snapshot, fm-home-summary-refresh,
fm-bearings-board and fm-bearings-board-render all pass, shellcheck clean.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01FydWhqr8VdPVtc5bvTfFC2
A radio group cannot be cleared once anything is picked, so a captain who
picked an option and then decided none of them fit had no way back: his typed
words were recorded as an annotation on top of an answer he had rejected.

"Answer in my own words" is now the last radio in the same group. Picking it
deselects whatever was picked before and enables and focuses its box; picking
a listed option clears and disables that box, so a stale sentence can never
ride along with a choice the captain did not mean. An answer is therefore
always one thing - the typed words, or the option value - never a value with
a note appended. Typing with nothing picked selects the option itself, so a
bare typed answer is the normal path rather than a special case, and picking
it with nothing typed refuses and says so instead of queueing nothing.

Each card's prompt now carries the card key, so a captain who comes back and
answers differently replaces his earlier answer rather than queueing a second,
contradictory one.

The render harness gains event bubbling and radio-group exclusivity so these
paths are exercised the way a click actually drives them.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01VWGJmTXem6HSFvYUcf1gtq
# Conflicts:
#	.agents/skills/project-management/SKILL.md
#	bin/fm-project-mode.sh
#	bin/fm-spawn.sh
#	bin/fm-test-run.sh
#	docs/architecture.md
#	docs/scripts.md
The board's project/type filter bar, the badly-composed-card flags, the
argv-limit snapshot regressions and the card-keyed answer queue graft onto
current main. The branch's write-your-own-answer rework landed upstream in a
different form first, so main's option-row version and its versioned
fm-bearings-answer.v1 context stand; only the branch's ideas that main lacks -
the "say what is missing" empty-submit message and the per-card queue key -
were re-applied on top.
The base lookup read PROJ_NAME, which was only assigned on the ship path,
so a scout silently fell back to the repo default branch - the exact stale
base the recorded base= record exists to prevent.
…'s annotation form

Stat tiles become real <button> controls that scroll to and focus their
section. Charted Next rows become a native <details>/<summary> disclosure
so a click opens the full title, reason, repo, and an optional detail
body instead of being caught by Lavish's annotation editor, which treats
plain divs as annotatable but exempts native interactive controls.

Adds an optional detail string to Charted Next rows in the
fm-bearings-board.v1 validator, and tells the bearings composer to pull
the full untruncated title and task notes from tasks-axi show --full
rather than the chat digest's shortened snapshot title.
… armed

A task whose last status line is `done: PR ...` reached fm-watch.sh's
captain-relevant stale branch with nothing to bound it: its worker has
exited so the pane never moves on its own, yet the armed PR merge poll
is already watching that PR. Every new pane hash re-alarmed, costing a
full supervision turn per poll for as long as the PR stayed open.

Ports the smallest equivalent of upstream kunchenguid#4449:
merge_poll_stale_bound bounds the repetition on the shared
FM_PAUSE_RESURFACE_SECS cadence, only for a done verb whose merge poll
artifacts validate. The bound stays a cadence rather than absolute
silence because the poll speaks only on a merge, so a PR closed
unmerged still re-surfaces its finished task.
@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate:

First look on HEAD 4e7aca07b91dfa8e05b39461f9d34c1bb411ec0d.

Attestation: MISSING — no HEAD-bound Pipeline attestation (body notes direct-PR / no-mistakes cache issue).
Mergeability: CONFLICTING / DIRTY vs main (compare: ahead 16 / behind 70; 24 files).
Contract-class: cannot-tell — tip is polluted relative to the stated nudge fix: besides bin/fm-bootstrap.sh / secondmate nudge fire-and-forget, the tip carries bearings board filter UI, spawn base-branch changes, fleet snapshot / config-push / secondmate-restart / project-mode deltas, and related docs/tests. Cannot adjudicate tip vs main unconfigured path for the claimed single restore until the branch is rebased onto current main with only the nudge (or a clearly scoped) delta.
VISION: inconclusive on several rules until the tip is unpolluted — bearings/board and spawn default-path edits may be new-default or opt-in; not auto-mergeable as-is.
CI/NM: no tip CI queued; fork workflows not approved this pass (polluted tip / CONFLICTING — not a safe first-time approve). Please rebase onto current main, drop unrelated commits, attach no-mistakes attestation, and re-push.
Outcome: waiting-author. No Firstmate flag (not otherwise-ready; not a close/ban/withhold case).

@talktejas
talktejas force-pushed the fm/fm-idle-mate-reply-noise branch from 4e7aca0 to 410592d Compare September 17, 2026 16:49
…d CI line (#5)

* fix(tests): parenthesise the board filter fixture's jq concatenation

An object-construction value in jq is a restricted expression, so the list
concatenation building captains_call has to be parenthesised as a whole. jq
1.8 accepts it bare, which is why it passes locally, but the jq CI runs on
rejects the whole program with three compile errors and the suite fails with
"the board did not build".

Behavior portable serial 4 has failed this way on main since 2026-09-10, from
the same fm/fm-board-filter merge that left the snapshot test-count pin behind.
The fixture's data is unchanged; all 25 tests in the suite pass.

* fix(ci): unblock the shared line's own broken checks

Three checks on the shared line were red for reasons unrelated to
work landing on it:

- tests/fm-spawn-base-branch.test.sh: SC2034 (genuinely unused
  modeflags var, removed) and SC2046 (relied on unquoted word
  splitting to build spawn flags; build an array instead).
- .github/workflows/ci.yml: the stock-macOS-Bash job pinned a
  hardcoded snapshot test count of 18 while the suite now emits 20
  ok lines; derive the expected count from the test file's own
  invocation list instead of re-pinning a number that will drift
  again.
- tests/fm-bearings-board-render.test.sh: a real defect, not a
  stale assertion. The filter fixture built captains_call by
  concatenating lists as the bare value of an object-construction
  key, which is a restricted expression in jq's grammar. jq 1.8
  tolerates it unparenthesized; the CI runner's jq does not and
  rejected the whole program ("the board did not build"). Not
  reproducible locally for that reason. Parenthesizing the
  concatenation fixes it for both.

* no-mistakes(review): fix chart row display, pin snapshot count, trim harness fields

* no-mistakes(document): note away-posture absoluteness of merge-poll stale bound

* docs: record test-script growth since the 2026-08-20 isolation proof

* fix(bearings): restore charted-row disclosure lost in the main rebase

Rebasing this branch onto main auto-merged the charted-row renderer to
main's version, which had independently dropped the <details>/<summary>
disclosure (var chRows, var summary) while adding newest-filed-first
ordering, leaving chRows and summary referenced but undeclared - the
exact ReferenceError this branch's earlier review round had fixed.
Restore the disclosure structure on top of chartedOrder(), restore the
full checked/hidden/pickable harness extraction that the rebase also
lost, and give multi_repo_payload's underway fixtures a name so they
satisfy main's newer underway_item schema check.

* fix(bin): add measured hints for 27 unhinted portable serial scripts

Main had grown the portable serial lane to 176 scripts with 27 carrying
no duration hint, past the coverage guard's 15% unhinted ceiling and
failing the required test-coverage check on its own, independent of
this branch's three named findings. Measured each locally and added it
to portable_serial_weight_hints so the guard passes again.

* no-mistakes(review): restore deleted render tests, honest hint provenance, drop duplicate table

* no-mistakes(review): recompute growth ratios from the authoritative hint table
The reread-AGENTS.md nudge sent after firstmate self-updates went through
the ordinary marked fm-send path, which always creates a durable pending-
reply expectation. That nudge has no reply protocol: a secondmate just
re-reads and keeps idling, so nothing ever writes a corr= line back. The
expectation would recover once, escalate once, then stay open forever,
re-announcing on every later session start for a perfectly healthy, idle
home - unlike a genuine request, which is supposed to keep re-announcing
until answered.

Route it through fm-send's fire-and-forget plane instead, the same plane
bin/fm-secondmate-reconcile.sh already uses for its own no-reply-expected
nudge, so no pending-reply expectation is created for it in the first
place.
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