Skip to content

fix: settle after fm-send text submits - #88

Merged
kunchenguid merged 2 commits into
mainfrom
fm/send-settle-p4
Jun 26, 2026
Merged

kunchenguid merged 2 commits into
mainfrom
fm/send-settle-p4

Conversation

@kunchenguid

Copy link
Copy Markdown
Owner

Intent

Add a tunable fixed pause to bin/fm-send.sh after a text message is successfully submitted, so the receiving crewmate's turn has time to visibly start before fm-send returns.

The bug: fm-send's success only proves the composer cleared - the Enter landed and the text was submitted - but the harness then takes a beat to spin up the turn before its busy footer appears. So an immediate peek after fm-send returns sees the stale 'before' (idle) pane, and firstmate has to peek a second time to catch the crewmate actually working. A small fixed pause after submit covers this in the common case.

The fix is deliberately a fixed pause, NOT a busy-poll. On the successful text-submit path only (after fm_tmux_submit_core returns and the verdict is NOT pending/send-failed), it runs: [ "${FM_SEND_SETTLE:-1}" = 0 ] || sleep "${FM_SEND_SETTLE:-1}". Default is 1 second; FM_SEND_SETTLE=0 disables the pause entirely (sleep is never invoked, so the disable is exact).

Deliberate scoping decisions (intentional, not oversights): the pause is confined to fm-send.sh's text-message submit path only. It is intentionally NOT added to the --key path, and intentionally NOT added to the shared fm_tmux_submit_core / bin/fm-tmux-lib.sh, because the away-mode daemon (fm-supervise-daemon.sh) sources that lib and only needs 'submitted' - it must not pay the pause. The change is purely additive: existing submit/verify logic and exit codes are unchanged.

FM_SEND_SETTLE is documented in the fm-send.sh header comment alongside FM_SEND_RETRIES/FM_SEND_SLEEP, with a one-line note on why it exists. A new hermetic test, tests/fm-send-settle.test.sh, stubs tmux and sleep (no real agent) to verify: a successful send pauses for the FM_SEND_SETTLE value (default 1), FM_SEND_SETTLE=0 produces no pause, the pause is tunable, and the --key path never pauses.

Hard constraint: the hardened supervision backbone (bin/fm-watch.sh, bin/fm-watch-arm.sh, bin/fm-wake-lib.sh, bin/fm-supervise-daemon.sh, bin/fm-tmux-lib.sh, and the afk skill) must remain untouched by this change.

What Changed

  • Captain, adds a configurable FM_SEND_SETTLE pause after successful fm-send text-message submits so immediate follow-up peeks can observe the receiving turn starting.
  • Keeps the pause out of --key sends and shared tmux submit helpers, preserving existing submit verdicts and exit behavior.
  • Documents the new setting and adds hermetic coverage for the default, disabled, tuned, and key-send paths.

Risk Assessment

✅ Low: Captain, the change is narrow, scoped to fm-send's successful text-submit path, leaves the shared tmux submit core untouched, and the added test coverage matches the intended behavior well enough for a low-risk merge.

Testing

No prior baseline command was provided; I inspected the two-file diff, ran the targeted settle test and the existing daemon/shared-submit regression test, generated a CLI transcript showing recorded sleep calls, and confirmed the worktree stayed clean. All exercised behavior passed; no UI screenshot was applicable because this is a shell CLI change.

Evidence: fm-send settle behavior transcript
fm-send settle behavior transcript
worktree: /Users/kunchen/.no-mistakes/worktrees/016d88035d58/01KW1003XGF0HPZWQS331XEGYD
changed files under test:
  bin/fm-send.sh
  tests/fm-send-settle.test.sh

case: default-text
command: /Users/kunchen/.no-mistakes/worktrees/016d88035d58/01KW1003XGF0HPZWQS331XEGYD/bin/fm-send.sh sess:win hello captain
exit: 0
recorded sleep calls:
  0.3
  0.4
  1

case: disabled-zero
command: env FM_SEND_SETTLE=0 /Users/kunchen/.no-mistakes/worktrees/016d88035d58/01KW1003XGF0HPZWQS331XEGYD/bin/fm-send.sh sess:win hello captain
exit: 0
recorded sleep calls:
  0.3
  0.4

case: tunable-two
command: env FM_SEND_SETTLE=2 /Users/kunchen/.no-mistakes/worktrees/016d88035d58/01KW1003XGF0HPZWQS331XEGYD/bin/fm-send.sh sess:win hello captain
exit: 0
recorded sleep calls:
  0.3
  0.4
  2

case: key-path
command: /Users/kunchen/.no-mistakes/worktrees/016d88035d58/01KW1003XGF0HPZWQS331XEGYD/bin/fm-send.sh sess:win --key Escape
exit: 0
recorded sleep calls:
  <none>

interpretation:
  default-text ends with sleep 1 after submit.
  disabled-zero records no sleep 0, so the disable path is exact.
  tunable-two ends with sleep 2 after submit.
  key-path records no sleep calls, so --key does not pay the settle pause.

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

✅ **Review** - passed

✅ No issues found.

✅ **Test** - passed

✅ No issues found.

  • git diff --name-only 10850ad9430ecf12d7b6b556867beda7007985e8..a7fcb1dfebc45538c148d9c73e9892f4016f16f3
  • bash tests/fm-send-settle.test.sh
  • bash tests/fm-daemon.test.sh
  • Manual hermetic CLI check with fake tmux and fake sleep: bin/fm-send.sh sess:win &#39;hello captain&#39;, FM_SEND_SETTLE=0 bin/fm-send.sh sess:win &#39;hello captain&#39;, FM_SEND_SETTLE=2 bin/fm-send.sh sess:win &#39;hello captain&#39;, and bin/fm-send.sh sess:win --key Escape, recorded in the evidence transcript.
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

A successful text send only proves the composer cleared - the Enter
landed and the text was submitted - but the harness needs a beat to spin
up the turn before its busy footer appears. An immediate peek after
fm-send returns would see the stale idle pane. Add a fixed FM_SEND_SETTLE
pause (default 1s, 0 disables) on the successful text-submit path only.

Scoped to fm-send's text path: not the --key path, and not the shared
fm_tmux_submit_core, so the away-mode daemon (which only needs
'submitted') never pays it. Purely additive; exit codes unchanged.
@kunchenguid
kunchenguid merged commit c8988bd into main Jun 26, 2026
4 checks passed
@kunchenguid
kunchenguid deleted the fm/send-settle-p4 branch June 26, 2026 04:02
leo1oel added a commit to leo1oel/nemo that referenced this pull request Jun 26, 2026
…unchenguid#83) (#6)

Port two functional upstream fixes, adapted to the herdr/Claude-only fork.

kunchenguid#88 fm-send settle: after a successful text submit, pause FM_SEND_SETTLE
seconds (default 1, 0 disables) before returning. A cleared composer only
proves the text was submitted; the harness needs a beat to spin up the turn
before its busy footer appears, so an immediate peek would otherwise see the
stale idle pane (the fm-send false-positive symptom). Scoped to the text path
only; the shared submit core the away-mode daemon uses never pays it.

kunchenguid#83 worktree-tangle guard: firstmate is a git repo of itself (secondmate homes
and self-on-self crewmate worktrees are linked herdr worktrees of FM_ROOT), so
a crewmate can branch/commit in the PRIMARY checkout instead of its isolated
worktree, stranding the primary on a feature branch.
- bin/fm-tangle-lib.sh: pure-git classifier (named non-default branch in the
  primary is the tangle; default branch and detached HEAD stay silent).
- fm-guard.sh: bordered ●-marked alarm on the next fleet action, checked first
  and independent of in-flight tasks.
- fm-spawn.sh: refuse to launch unless the opened worktree is a genuine isolated
  worktree root distinct from the primary checkout.
- fm-brief.sh: ship briefs open with a worktree-isolation assertion before the
  branch step.
- AGENTS.md sections 7/8/11 document both guards.
- tests/fm-tangle-guard.test.sh (new) covers lib classification, the guard
  banner, brief assertion ordering, and the spawn abort; fm-wake-queue guard
  tests pin FM_ROOT so the ambient feature-branch checkout cannot leak a banner.
@furqonarif669

Copy link
Copy Markdown

Closing as superseded by #89, which merged and shipped the same locale-flag behavior on main for English, Chinese, and Indonesian desktop and mobile controls.

#89 also preserves decorative aria-hidden handling and focused accessibility and routing coverage. This branch now conflicts across all six touched files; its unique remainder is documentation wording plus test-evidence generation, including a hard-coded /tmp output, rather than unique product behavior.

fritznoff pushed a commit to fritznoff/starship that referenced this pull request Nov 2, 2026
…oll (kunchenguid#88)

iOS Safari treats capture=environment as camera-only, hiding Photo Library.

Co-authored-by: Cursor <[email protected]>
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