Skip to content

feat(calm): add selectable spaceship working presentation - #8769

Merged
kunchenguid merged 19 commits into
kunchenguid:mainfrom
101space:feat/upstream-calm-spaceship
Nov 28, 2026
Merged

kunchenguid merged 19 commits into
kunchenguid:mainfrom
101space:feat/upstream-calm-spaceship

Conversation

@101space

@101space 101space commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Intent

The developer is porting their local Calm "working presentation" addition onto current upstream firstmate main and offering it as one clean contribution: alongside the existing Calm ship animation, a selectable spaceship presentation chosen by a local config file (home-relative and FM_CONFIG_OVERRIDE-aware, with the ship as default when the file is absent), carrying the new spaceship module, the selection wiring in the Pi Calm extension, a doc section for the config file, and tests covering selection and the rendering contract. Constraints are to re-fit the wiring to today's upstream code rather than replaying a diff, not weaken or retune existing Calm behavior, keep all upstream tests, and describe in the PR body that an earlier attempt (kunchenguid/firstmate PR #5567) was closed unmerged on 2026-10-18 so this is a fresh port, without fleet, home, or operator references. The most recent instruction is narrower: the calm extension test fails the stock macOS Bash 3.2 parse sweep with an unexpected EOF reported at line 5518 inside a heredoc opened at line 5455, so the developer must find the 3.2-hostile construct and fix it minimally without behavior change (moving the JS body to an external fixture is acceptable), push on the same feat/upstream-calm-spaceship branch, get the macOS job green, and report the new head SHA plus what the offending construct was.

What Changed

  • Adds a Pi-only config/calm-ship preference (resolved from the effective Firstmate home with the same FM_CONFIG_OVERRIDE rules as config/calm, re-read on session_start) that selects the Calm working presentation: spaceship installs the saucer, any other value or an absent file keeps the existing boat. .pi/extensions/fm-calm.ts now owns one shared working-row slot and one animation lifecycle across both variants, clearing the previous presentation before a variant switch or session shutdown.
  • Adds .pi/extensions/lib/fm-calm-working-spaceship.ts, an ambient two-row saucer banner with marquee idle drift and streaming starfield, a single-row warp sprite driven by the same agent-run signal, a bounded settle ease back into the drift, freeze/resume and resize clamping, and narrow-width fallbacks to a sprite-free row.
  • Documents the new file and presentation in docs/calm.md, docs/configuration.md, docs/calm-mode-feasibility.md, README.md, and the operational-home-layout skill, and extends the Calm Pi suite with selection, lifecycle, and rendering-contract coverage plus test-runner family and fixture wiring. The spaceship harness avoids a heredoc nested in a command substitution, which stock macOS Bash 3.2 misparses.

Risk Assessment

✅ Low: The change is an opt-in (absent config file keeps the boat) additive presentation variant whose default boat path is unchanged and still covered, with docs, module tests, extension wiring tests, and the Bash 3.2 harness fix all internally consistent; the only note is an informational API-parity method with no production caller.

Testing

Drove the real Pi 1.6.1 TUI through a pseudo-terminal in throwaway Firstmate homes: with config/calm-ship=spaceship the ambient two-row saucer rendered while idle, switched to the single-row warp sprite during a real model run, and returned to the two-row drift after settle; with the file absent the run-scoped boat rendered only during the run; a live /calm off cleared the banner for the whole off window and /calm on restored it; SPACESHIP did not select the variant while FM_CONFIG_OVERRIDE did; and with a synthetic peer extension owning the shared slot only one animation rendered during the run, with the spaceship returning after /calm off/on exactly as the narrowed docs now state. Separately, a real GNU bash 3.2.57 -n sweep parsed all 616 canonical shell files, and the pre-fix test file reproduced the reported line 5518 unexpected-EOF failure; the focused Calm suite passed 13 with 0 failures and 4 tmux/standalone-environment skips. All disposables were torn down and the worktree is clean. The macOS stock-bash CI job remains the authoritative check for that specific interpreter, but the same 3.2 lexer failure was reproduced and fixed here.

  • Live validation: ✅ go - 7 of 7 scenarios driven live against the product
Scenario Result Live Evidence
Spaceship variant: a real Pi TUI with config/calm-ship=spaceship shows the ambient two-row saucer over hull while idle, the single-row warp saucer during an agent run, and the two-row drift again afte… ✅ pass live Live Pi TUI validation (rendered HTML) + S1 spaceship ambient/warp/settle pty transcript
Default selection: with no config/calm-ship file the real Pi TUI shows no ambient banner while idle, renders the run-scoped boat during a run, and removes it after settle ✅ pass live S2 default boat pty transcript
Calm toggle: live /calm off clears the selected spaceship banner and live /calm on restores it ✅ pass live S3 Calm toggle pty transcript
Adversarial value: config/calm-ship=SPACESHIP does not select the variant, so the ambient spaceship never appears ✅ pass live S4 adversarial variant and config override transcripts
FM_CONFIG_OVERRIDE: a spaceship selection in the override config directory is honored by the real Pi TUI ✅ pass live S4 adversarial variant and config override transcripts
Dual install: a synthetic standalone boat extension claiming the shared working-row slot renders one animation during a run, the spaceship steps aside, and it returns after /calm off then on ✅ pass live S7 dual-install shared-slot pty transcript + Live Pi TUI validation (rendered HTML)
GNU bash 3.2.57 parse sweep accepts the branch test file while the pre-fix copy still fails with the reported line 5518 EOF ✅ pass live Bash 3.2.57 parse sweep and pre-fix reproduction
Evidence: Live Pi TUI validation summary (rendered HTML)

Source: Live Pi TUI validation summary (rendered HTML)

Rendered HTML summary of the captured real-Pi terminal frames and the per-segment sprite counts for the spaceship, default-boat, Calm-toggle, and dual-install checks.

<!doctype html><meta charset='utf-8'><style>body{font-family:system-ui;margin:2rem;max-width:1100px}pre.term{background:#111;color:#e6e6e6;padding:12px;overflow:auto;font-size:12px;line-height:1.35;white-space:pre}table{border-collapse:collapse;margin:1rem 0}td,th{border:1px solid #bbb;padding:4px 10px;font-size:14px}h3{margin-bottom:.3rem}</style><h1>Calm spaceship variant - live Pi TUI evidence</h1>
<p>Captured from a real <code>pi</code> 1.6.1 TUI driven through a pty (120x40) in a throwaway FM_HOME, with <code>.pi/extensions/fm-calm.ts</code> loaded. Sprite fragments are exactly what the terminal received.</p>
<h2>Captured terminal frames</h2>
<h3>spaceship variant, idle: two-row saucer over hull, drifting</h3><pre class='term'>~/.no-mistakes/worktrees/f82d8fd6ce1f/01M8FQVAV38BSC3NHD2CSGTB2M (detached)
0.0%/272k (auto)                                                                deepseek/deepseek-v4.1-flash-1017 • high(|).  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .
|^|.*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .</pre>
<h3>spaceship variant, agent run under way: single-row warp saucer</h3><pre class='term'> -.- -.=( * )-.- -.- -.- -.- -.- -.- -.- -.- -.- -.- -.- -.- -.- -.- -.- -.- -.- -.- -.- -.- -.- -.- -.- -.- -.- -.- -.-</pre>
<h3>spaceship variant, after settle: back to the ambient two-row drift</h3><pre class='term'> .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*.|^|. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*..*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. |^| .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  (|).  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .
.*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .|^|.*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. *. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*|^|*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. ..  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .(|)  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .
*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*.|^|. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. |^| .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*</pre>
<h3>default (no config/calm-ship), agent run under way: the boat</h3><pre class='term'>
 ◿│◣
╲▁▁▁╱▁▁▁▁▁▂▂▃▃▃▄▄▄▄▄▃▃▃▂▂▁▁▁▁▁▁▂▂▂▃▃▃▄▄▄▄▄▄▄▃▃▃▂▂▁▁▁▁▁▁▂▂▂▃▃▃▄▄▄▄▄▃▃▃▂▂▂▁▁▁▁▁▁▂▂▃▃▃▄▄▄▄▄▄▃▃▂▂▁▁▁▁▁▁▂▂▃▃▃▄▄▄▄▄▄▄▃▃▃▂▂▁▁▁▁</pre>
<h2>Calm toggle with config/calm-ship=spaceship</h2><table><tr><th>segment</th><th>saucer (|)</th><th>hull |^|</th><th>warp =( * )</th></tr>
<tr><td>before /calm off</td><td>5</td><td>9</td><td>0</td><td>0</td></tr>
<tr><td>between /calm off and on</td><td>0</td><td>0</td><td>0</td><td>0</td></tr>
<tr><td>after /calm on</td><td>7</td><td>12</td><td>0</td><td>0</td></tr>
</table>
<h2>Dual install: synthetic standalone boat claims the shared slot</h2><table><tr><th>segment</th><th>saucer (|)</th><th>hull |^|</th><th>warp =( * )</th><th>STANDALONE-BOAT-ACTIVE</th></tr>
<tr><td>idle before prompt</td><td>5</td><td>9</td><td>0</td><td>0</td></tr>
<tr><td>run (standalone peer owns slot)</td><td>0</td><td>0</td><td>0</td><td>4</td></tr>
<tr><td>between /calm off and on</td><td>0</td><td>0</td><td>0</td><td>0</td></tr>
<tr><td>after /calm on</td><td>14</td><td>26</td><td>0</td><td>0</td></tr>
</table>
<h2>Other live checks</h2><ul><li>Absent <code>config/calm-ship</code>: 0 saucer frames while idle, 25 boat sail frames during the run, none after settle (s2-default-boat.raw).</li><li><code>config/calm-ship=SPACESHIP</code>: 0 saucer frames (s4a-garbage-variant.raw).</li><li><code>FM_CONFIG_OVERRIDE</code> pointing at a dir with calm-ship=spaceship: 8 saucer frames (s4b-config-override.raw).</li><li>GNU bash 3.2.57 <code>-n</code>: 0 failures over 616 canonical files; the pre-fix test file fails at line 5518 (s5-bash32-full-sweep.log).</li><li>Focused Calm suite: 13 ok, 0 not ok, 4 environment skips (s6-calm-pi-extension-suite.log).</li></ul>
<p>Raw pty transcripts: s1-spaceship-toggle-run.raw, s2-default-boat.raw, s3-calm-toggle.raw, s4a-garbage-variant.raw, s4b-config-override.raw, s7-dual-install-toggle.raw.</p>
Evidence: S1 spaceship ambient/warp/settle pty transcript

Source: S1 spaceship ambient/warp/settle pty transcript

Real pi 1.6.1 TUI (pty 120x40, isolated FM_HOME, config/calm=on, config/calm-ship=spaceship): 45 saucer and 86 hull frames while idle, 47 warp =( * ) frames during the run, then 35 saucer frames after the last warp, i.e. the ambient banner settles back to the two-row drift.



────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

                                                                                                                        

────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

~/.no-mistakes/worktrees/f82d8fd6ce1f/01M8FQVAV38BSC3NHD2CSGTB2M (detached)

0.0%/272k (auto)                                                                deepseek/deepseek-v4.1-flash-1017 • high
(|).  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  

|^|.*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .

────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

                                                                                                                        

────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

~/.no-mistakes/worktrees/f82d8fd6ce1f/01M8FQVAV38BSC3NHD2CSGTB2M (detached)

0.0%/272k (auto)                                                                deepseek/deepseek-v4.1-flash-1017 • high
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

 Update Available                                                                                                       

 New version 1.7.0 is available. Run pi update                                                                          

 Changelog: https://pi.dev/changelog                                                                                    

────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────



(|).  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  

|^|.*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .

────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

                                                                                                                        

────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

~/.no-mistakes/worktrees/f82d8fd6ce1f/01M8FQVAV38BSC3NHD2CSGTB2M (detached)

0.0%/272k (auto)                                                                deepseek/deepseek-v4.1-flash-1017 • 

... [153562 bytes truncated] ...

34m  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  

*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*.|^|. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .
. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. |^| .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*
.  .  .  .  .  .  .  .  .  .  .  .  .  .  .(|)  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  

. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .|^|.*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*
 .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*|^|*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*.
.  .  .  .  .  .  .  .  .  .  .  .  .  .  . (|) .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  

 .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*.|^|. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*.
.*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. |^| .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. 
.  .  .  .  .  .  .  .  .  .  .  .  .  .  .  (|).  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  

.*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .|^|.*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. 
*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*|^|*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .
.  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .(|)  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  

*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*.|^|. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .
. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. |^| .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*
Evidence: S2 default boat pty transcript

Source: S2 default boat pty transcript

Real pi TUI with no config/calm-ship: 0 saucer/0 hull frames while idle, 25 sail (◿) and 31 hull (╲▁▁▁╱) frames only during the model run; no boat frames in the post-settle tail.



────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

                                                                                                                        

────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

~/.no-mistakes/worktrees/f82d8fd6ce1f/01M8FQVAV38BSC3NHD2CSGTB2M (detached)

0.0%/272k (auto)                                                                deepseek/deepseek-v4.1-flash-1017 • high
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

 Update Available                                                                                                       

 New version 1.7.0 is available. Run pi update                                                                          

 Changelog: https://pi.dev/changelog                                                                                    

────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────



────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

                                                                                                                        

────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

~/.no-mistakes/worktrees/f82d8fd6ce1f/01M8FQVAV38BSC3NHD2CSGTB2M (detached)

0.0%/272k (auto)                                                                deepseek/deepseek-v4.1-flash-1017 • high
                                                                                                                        

 Count from 1 to 250, one number per line, no commentary.                                                               

                                                                                                                        



 ◿│◣

╲▁▁▁╱▁▁▁▁▁▂▂▃▃▃▄▄▄▄▄▃▃▃▂▂▁▁▁▁▁▁▂▂▂▃▃▃▄▄▄▄▄▄▄▃▃▃▂▂▁▁▁▁▁▁▂▂▂▃▃▃▄▄▄▄▄▃▃▃▂▂▂▁▁▁▁▁▁▂▂▃▃▃▄▄▄▄▄▄▃▃▂▂▁▁▁▁▁▁▂▂▃▃▃▄▄▄▄▄▄▄▃▃▃▂▂▁▁▁▁

────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

                                                                                                                        

────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

~/.no-mistakes/worktrees/f82d8fd6ce1f/01M8FQVAV38BSC3NHD2CSGTB2M (detached)

0.7%/272k (auto)                                                                deepseek/deepseek-v4.1-flash-1017 • high
╲▁▁▁╱▁▁▁▁▁▂▂▂▃▃▄▄▄▄▄▃▃▃▂▂▁▁▁▁▁▁▂▂▂▃▃▃▄▄▄▄▄▄▄▃▃▃▂▂▂▁▁▁▁▁▁▂▂▃▃▃▄▄▄▄▄▄▃▃

... [101408 bytes truncated] ...

                         

 233                                                                                                                    

 234                                                                                                                    

 235                                                                                                                    

 236                                                                                                                    

 237                                                                                                                    

 238                                                                                                                    



  ◿│◣

▁╲▁▁▁╱▁▁▁▁▁▁▂▂▃▃▃▄▄▄▄▄▃▃▂▂▂▁▁▁▁▁▁▂▂▂▃▃▃▄▄▄▄▄▄▃▃▃▂▂▂▁▁▁▁▁▁▂▂▂▃▃▄▄▄▄▄▄▃▃▃▂▂▁▁▁▁▁▁▂▂▂▃▃▃▄▄▄▄▄▄▃▃▂▂▁▁▁▁▁▂▂▂▃▃▃▄▄▄▄▄▄▃▃▃▂▂▂▁▁

────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

                                                                                                                        

────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

~/.no-mistakes/worktrees/f82d8fd6ce1f/01M8FQVAV38BSC3NHD2CSGTB2M (detached)

0.7%/272k (auto)                                                                deepseek/deepseek-v4.1-flash-1017 • high
   ◿│◣

▁▁╲▁▁▁╱▁▁▁▁▁▂▂▃▃▃▄▄▄▄▄▃▃▃▂▂▁▁▁▁▁▁▂▂▂▃▃▃▄▄▄▄▄▄▄▃▃▃▂▂▁▁▁▁▁▁▂▂▂▃▃▃▄▄▄▄▄▃▃▃▂▂▂▁▁▁▁▁▁▂▂▃▃▃▄▄▄▄▄▄▃▃▂▂▁▁▁▁▁▁▂▂▃▃▃▄▄▄▄▄▄▄▃▃▃▂▂▁▁
 239                                                                                                                    

 240                                                                                                                    

 241                                                                                                                    

 242                                                                                                                    

 243                                                                                                                    

 244                                                                                                                    

 245                                                                                                                    

 246                                                                                                                    

 247                                                                                                                    

 248                                                                                                                    

 249                                                                                                                    

 250                                                                                                                    



────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

                                                                                                                        

────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

~/.no-mistakes/worktrees/f82d8fd6ce1f/01M8FQVAV38BSC3NHD2CSGTB2M (detached)

↑2.0k ↓547 R256 CH11.6% $0.001 1.0%/272k (auto)                                 deepseek/deepseek-v4.1-flash-1017 • high
Evidence: S3 Calm toggle pty transcript

Source: S3 Calm toggle pty transcript

Segment counts around the live /calm toggles: before off 5 saucer/9 hull frames; between off and on 0 saucer/0 hull frames over five seconds; after on 7 saucer/12 hull frames. config/calm persisted as on.



────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

                                                                                                                        

────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

~/.no-mistakes/worktrees/f82d8fd6ce1f/01M8FQVAV38BSC3NHD2CSGTB2M (detached)

0.0%/272k (auto)                                                                deepseek/deepseek-v4.1-flash-1017 • high
(|).  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  

|^|.*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .

────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

                                                                                                                        

────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

~/.no-mistakes/worktrees/f82d8fd6ce1f/01M8FQVAV38BSC3NHD2CSGTB2M (detached)

0.0%/272k (auto)                                                                deepseek/deepseek-v4.1-flash-1017 • high
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

 Update Available                                                                                                       

 New version 1.7.0 is available. Run pi update                                                                          

 Changelog: https://pi.dev/changelog                                                                                    

────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────



(|).  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  

|^|.*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .

────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

                                                                                                                        

────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

~/.no-mistakes/worktrees/f82d8fd6ce1f/01M8FQVAV38BSC3NHD2CSGTB2M (detached)

0.0%/272k (auto)                                                                deepseek/deepseek-v4.1-flash-1017 • 

... [10879 bytes truncated] ...

4m .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  

. .*.|^|. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*
 .*. |^| .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*.
.  .  (|).  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  

.*. .*|^|*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. 
*. .*.|^|. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .
.  .  .(|)  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  

*. .*. |^| .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .
. .*. .|^|.*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*
.  .  . (|) .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  

. .*. .*|^|*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*
 .*. .*.|^|. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*.
.  .  .  (|).  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  

 .*. .*. |^| .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*. .*.
Evidence: S4 adversarial variant and config override transcripts

Source: S4 adversarial variant and config override transcripts

S4a config/calm-ship=SPACESHIP: 0 saucer frames (boat remains default). S4b FM_CONFIG_OVERRIDE dir with calm-ship=spaceship: 8 saucer/14 hull frames.



────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

                                                                                                                        

────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

~/.no-mistakes/worktrees/f82d8fd6ce1f/01M8FQVAV38BSC3NHD2CSGTB2M (detached)

0.0%/272k (auto)                                                                deepseek/deepseek-v4.1-flash-1017 • high
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

 Update Available                                                                                                       

 New version 1.7.0 is available. Run pi update                                                                          

 Changelog: https://pi.dev/changelog                                                                                    

────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────



────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

                                                                                                                        

────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

~/.no-mistakes/worktrees/f82d8fd6ce1f/01M8FQVAV38BSC3NHD2CSGTB2M (detached)

0.0%/272k (auto)                                                                deepseek/deepseek-v4.1-flash-1017 • high
Evidence: S7 dual-install shared-slot pty transcript

Source: S7 dual-install shared-slot pty transcript

Dual install with a synthetic standalone-peer extension claiming `calm-working-ship`: idle 5 saucer/9 hull frames; during the run 0 saucer, 4 `STANDALONE-BOAT-ACTIVE` frames (one animation, spaceship stepped aside); between /calm off and on 0; after /calm on 14 saucer/26 hull frames.
Evidence: Bash 3.2.57 parse sweep and pre-fix reproduction

Source: Bash 3.2.57 parse sweep and pre-fix reproduction

GNU bash 3.2.57 -n sweep over all 616 canonical bin/.sh bin/backends/.sh tests/*.sh files: failures=0. The pre-fix 42b4927e copy of tests/fm-calm-pi-extension.test.sh fails under the same interpreter with line 5518: unexpected EOF while looking for matching backtick and line 5962: syntax error: unexpected end of file.

GNU bash 3.2.57 -n parse sweep over full canonical set (616 files)
failures=0

Current head tests/fm-calm-pi-extension.test.sh:
  parse OK (rc=0)
Pre-fix 42b4927e copy:
  /tmp/prefix-calm-test.sh: line 5518: unexpected EOF while looking for matching ``'
  /tmp/prefix-calm-test.sh: line 5962: syntax error: unexpected end of file
  rc=2
Evidence: Focused tests/fm-calm-pi-extension.test.sh output

Source: Focused tests/fm-calm-pi-extension.test.sh output

Focused Calm extension suite: rc=0, 13 ok, 0 not ok, 4 environment skips (tmux absent). Includes the spaceship variant selection, ambient banner, and new dual-install Calm off/on toggle checks.
  • Outcome: 🔧 2 issues found → no changes applied ✅ across 2 runs (18m26s)

Pipeline

Updates from git push no-mistakes

✅ **Intent** - passed

✅ No issues found.

⚠️ **Rebase** - 1 warning
  • ⚠️ docs/configuration.md - merge conflict rebasing onto origin/main
⚠️ **Review** - 1 info
  • ⚠️ docs/calm.md:80 - The dual-Calm exception documented and tested here does not hold on the /calm toggle path. docs/calm.md:80 states "The standalone boat takes the row during an agent run, so a selected spaceship returns at the next session start rather than mid-session", and the new test pins that non-reclaim invariant for agent_start/agent_settled (tests/fm-calm-pi-extension.test.sh:4734-4751). Concrete reachable sequence with both Calm extensions loaded and config/calm-ship=spaceship: agent_start -> the standalone Pi Calm installs its boat under calm-working-ship, Pi disposes Firstmate's banner so workingWidgetDisposed=true while workingShown stays true; /calm off sees showWorking=false, only flips workingShown and skips both the clear and setWorkingVisible(true) (.pi/extensions/fm-calm.ts:230-232); /calm on then evaluates showWorking=true !== workingShown=false (.pi/extensions/fm-calm.ts:216-219) and reinstalls the saucer in the shared slot (.pi/extensions/fm-calm.ts:220-228), disposing the standalone boat and hiding Pi's stock row mid-session - exactly the mid-session reclaim the doc and test deny. The new test never toggles Calm while the slot is held by the standalone extension, so it cannot catch this. Same invariant sites: docs/calm.md:79 ("slot belongs to whichever extension is active"), docs/calm.md:80 (next-session-only claim), docs/calm.md:81 ("banner is absent from that run's settle" becomes inconsistent once the banner was reclaimed), .pi/extensions/fm-calm.ts:577 (/calm handler re-applying the presentation), tests/fm-calm-pi-extension.test.sh:4734. Remedy is a product decision - either suppress the reinstall while the ambient banner has stepped aside (needs an explicit stepped-aside flag, new state) or narrow docs/calm.md:80 to "at the next session start, or when Calm is turned back on" and cover the toggle in the dual-install test - so it is not a mechanical fix.
  • ℹ️ .pi/extensions/lib/fm-calm-working-ship.ts:51 - This rewritten comment now lists three owners of the shared slot (the boat, the spaceship presentation, and the standalone Pi Calm extension) but still ends "Rename the slot in both implementations together". A reader following that instruction while renaming calm-working-ship would miss one of the three and reintroduce duplicate working widgets. Say "every implementation" (or name all three) instead of "both".

🔧 Fix applied.
1 info still open:

  • ℹ️ .pi/extensions/lib/fm-calm-working-spaceship.ts:234 - clampToWidth is part of the new module's API and its docstring (:109) says it is "Used when a terminal resize lands while the working presentation is hidden", but no production caller exists. The extension removes the ambient banner (rather than hiding it) when Calm is off (fm-calm.ts:192-196 clearWorkingPresentation), and the first resumed frame clamps inside render via applyWidth (:270-277), so the hidden-resize path is already covered. Only the module test calls it (tests/fm-calm-pi-extension.test.sh:4490, :4506). This is not a behavior defect - the method is harmless and mirrors the boat sprite's matching clampToWidth (:74 there), so it reads as deliberate API parity for the two presentation modules. Recorded as a tradeoff only; if the author ever wants the narrower API surface, dropping the method and switching those two test calls to render(...) (which clamps identically) would be the minimal change, but no action is required for this contribution.
🔧 **Test** - 2 issues found → no changes applied ✅
  • ⚠️ tests/fm-calm-pi-extension.test.sh:3978 - The step could not demonstrate the change's intent because neither required surface could be stood up in this environment: (1) stock macOS Bash 3.2 is not obtainable in-workspace (not on PATH; absent from nixpkgs current and 20.09; building bash-3.2.57 from source fails in mkbuiltins under the available gcc), and local bash 5.3 parses both the pre-fix and post-fix file, so it cannot exercise the reported lexing bug; (2) the Calm Pi suite needs the installed @earendil-works/pi-coding-agent package and tmux, and the machine's global npm install points at a dangling releases/1.3.0 symlink while tmux is absent, so every rendering test (including test_working_spaceship_modes_and_selection) skipped. To validate: provide a host/container with /bin/bash 3.2.57 (or run the macos-stock-bash CI job) and an environment with the pi-coding-agent package plus tmux installed so bash bin/fm-test-tap-verify.sh tests/fm-calm-pi-extension.test.sh runs its node/tmux harnesses instead of skipping.
  • ⚠️ live validation verdict: inconclusive (0 of 3 scenarios were driven live against the product); untested: Stock macOS Bash 3.2 parse sweep accepts tests/fm-calm-pi-extension.test.sh after the heredoc-in-command-substitution rewrite (and rejected the pre-fix file), Calm extension suite still passes end to end after the heredoc restructure, including test_working_spaceship_modes_and_selection, Adversarial: with both Calm extensions loaded and config/calm-ship=spaceship, the standalone boat owns the shared working-row slot during a run and a Calm off/on toggle is the only mid-session way the spaceship returns (no doubled widget)
  • Live validation: ⚠️ inconclusive - 0 of 3 scenarios driven live against the product
Scenario Result Live Evidence
Stock macOS Bash 3.2 parse sweep accepts tests/fm-calm-pi-extension.test.sh after the heredoc-in-command-substitution rewrite (and rejected the pre-fix file) ⏸️ untested no No Bash 3.2 parser was obtainable inside the workspace boundary: bash32/bash3/bash-3.2 are not on PATH, current nixpkgs and nixos-20.09 expose no bash_3_2 attribute, and a source build of bash-3.2.57…
Calm extension suite still passes end to end after the heredoc restructure, including test_working_spaceship_modes_and_selection ⏸️ untested no Ran bash bin/fm-test-tap-verify.sh tests/fm-calm-pi-extension.test.sh three times. The suite's node/tmux harnesses need the installed @earendil-works/pi-coding-agent package (the machine's global np…
Adversarial: with both Calm extensions loaded and config/calm-ship=spaceship, the standalone boat owns the shared working-row slot during a run and a Calm off/on toggle is the only mid-session way the… ⏸️ untested no This behavior is only observable by executing the new dual-install/toggle block in the Calm suite, which requires the same installed pi-coding-agent package the suite skips without; the run recorded o…
  • bash -n tests/fm-calm-pi-extension.test.sh (bash 5.3.9) - parses, as does the pre-fix revision, so not discriminating for the macOS bug
  • git show 1547a29f^:tests/fm-calm-pi-extension.test.sh &gt; /tmp/pre-fix-calm-test.sh &amp;&amp; bash -n /tmp/pre-fix-calm-test.sh - parses under bash 5.3
  • nix build --no-link --print-out-paths nixpkgs#bash_3_2 - attribute does not exist
  • nix build --no-link --print-out-paths https://github.com/NixOS/nixpkgs/archive/nixos-20.09.tar.gz#bash_3_2 - attribute does not exist
  • curl ftp.gnu.org/gnu/bash/bash-3.2.57.tar.gz, ./configure --without-bash-malloc, make CFLAGS=&#39;-O1 -std=gnu17 -Wno-error&#39; - build fails in mkbuiltins, no 3.2 binary produced
  • bash bin/fm-test-tap-verify.sh tests/fm-calm-pi-extension.test.sh (default and FM_PI_PACKAGE_DIR variants) - every Calm rendering test skipped for missing pi package / tmux
  • bash bin/fm-test-tap-verify.sh tests/fm-calm-pi-extension.test.sh with FM_PI_PACKAGE_DIR pointing at a symlink shim of releases/1.6.1 - still skipped (shim layout mismatch)

🔧 No changes applied.
✅ Re-checked - no issues remain.

  • Live validation: ✅ go - 7 of 7 scenarios driven live against the product
Scenario Result Live Evidence
Spaceship variant: a real Pi TUI with config/calm-ship=spaceship shows the ambient two-row saucer over hull while idle, the single-row warp saucer during an agent run, and the two-row drift again afte… ✅ pass live Live Pi TUI validation (rendered HTML) + S1 spaceship ambient/warp/settle pty transcript
Default selection: with no config/calm-ship file the real Pi TUI shows no ambient banner while idle, renders the run-scoped boat during a run, and removes it after settle ✅ pass live S2 default boat pty transcript
Calm toggle: live /calm off clears the selected spaceship banner and live /calm on restores it ✅ pass live S3 Calm toggle pty transcript
Adversarial value: config/calm-ship=SPACESHIP does not select the variant, so the ambient spaceship never appears ✅ pass live S4 adversarial variant and config override transcripts
FM_CONFIG_OVERRIDE: a spaceship selection in the override config directory is honored by the real Pi TUI ✅ pass live S4 adversarial variant and config override transcripts
Dual install: a synthetic standalone boat extension claiming the shared working-row slot renders one animation during a run, the spaceship steps aside, and it returns after /calm off then on ✅ pass live S7 dual-install shared-slot pty transcript + Live Pi TUI validation (rendered HTML)
GNU bash 3.2.57 parse sweep accepts the branch test file while the pre-fix copy still fails with the reported line 5518 EOF ✅ pass live Bash 3.2.57 parse sweep and pre-fix reproduction
  • Real pi 1.6.1 TUI driven through a Python pty (120x40, isolated FM_HOME, --no-extensions -e .pi/extensions/fm-calm.ts --tui-mode regular) for spaceship idle/run/settle (s1-spaceship-toggle-run.raw)
  • Real Pi TUI with no config/calm-ship for default boat selection (s2-default-boat.raw)
  • Real Pi TUI /calm off/on toggle with config/calm-ship=spaceship (s3-calm-toggle.raw)
  • Real Pi TUI with config/calm-ship=SPACESHIP and with FM_CONFIG_OVERRIDE selecting spaceship (s4a-garbage-variant.raw, s4b-config-override.raw)
  • Real Pi TUI with a disposable synthetic standalone-peer extension claiming calm-working-ship, then /calm off/on (s7-dual-install-toggle.raw)
  • ~/firstmate/data/upstream-calm-spaceship/bash32/bash-3.2.57/bash -n over all 616 canonical shell files and over a git show 42b4927e:tests/fm-calm-pi-extension.test.sh pre-fix copy
  • FM_PI_PACKAGE_DIR=~/firstmate/data/upstream-calm-spaceship/pinode/@earendil-works/pi-coding-agent bash tests/fm-calm-pi-extension.test.sh (13 ok, 4 environment skips, 0 failures)
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

…-ship

Add an optional spaceship variant for Calm's animated working row on Pi,
selected by the local config/calm-ship file.

- Add .pi/extensions/lib/fm-calm-working-spaceship.ts: a persistent banner
  under its own firstmate-calm-working-spaceship widget key, with an idle
  two-row saucer-over-hull rest pose drifting left to right, a single-row
  `=( * )` warp sprite while a run is thinking, a bounded settle ease back
  into the drift, freeze/resume continuity across hide and show, resize
  clamping, narrow fallbacks, and idle crew markers read from the home's
  state records on a slow tick.
- .pi/extensions/fm-calm.ts resolves config/calm-ship with the same
  effective-home and FM_CONFIG_OVERRIDE rules as config/calm, at extension
  load and again on session_start and /calm. Anything other than
  "spaceship", including an absent file, keeps the boat, which stays the
  default. The boat's own presentation path and its shared widget slot with
  standalone Pi Calm are unchanged; the spaceship is dispatched as a
  separate banner that owns its own slot, and a selection switch tears down
  the replaced variant before installing the new one.
- Document the variant in docs/calm.md and the config/calm-ship schema in
  docs/configuration.md.
- Cover selection, rendering, mode, settle, and freeze/resume in
  tests/fm-calm-pi-extension.test.sh, and add the new module to the
  typecheck fixture in tests/fm-pi-primary-types.test.sh.

Supersedes the earlier attempt in kunchenguid#5567, which was
closed unmerged on 2026-10-18 with a branch that had conflicted. This is a
fresh port onto current main, not a revival of that branch.
…rift

The selectable spaceship working presentation was scoped to one agent run,
which left Pi's stock working row in place the rest of the session. Make it
ambient: while Calm is active and config/calm-ship selects it, the banner is
installed at session_start and lives until session_shutdown, and the run signal
drives its mode instead of its visibility.

Idle shows the two-row resting pose, a three-cell (|) saucer directly over a
three-cell |^| hull, drifting one column every ~1.5s with a starfield streaming
left past it. A run switches the same banner into the single-row compact
=( * ) warp; the settle relaxes the pose, returns the starfield to the idle
cadence immediately, and eases the pace back into the drift over a bounded
handful of graduated moves.

The boat is unchanged and stays run-scoped. Both presentations still share the
one working-row slot, so a dual Calm install renders one animation and a
presentation another extension installed is left alone.
@101space 101space changed the title feat(pi): add selectable spaceship working presentation for Calm feat(pi): add selectable ambient spaceship Calm presentation Nov 26, 2026
@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate: thanks @101space for the fresh port, and for the frame-by-frame pty evidence. This is my first look at head d8061374 (base 2f000eb4; it still merges cleanly onto main 4b1d93d2).

Diff review (stands in for Greptile while it's out): safe, no P1. I read .pi/extensions/fm-calm.ts and the new lib/fm-calm-working-spaceship.ts line by line, plus the docs, the test-runner mapping and the two copy lines in the Pi suites. I also scanned the 962-line test addition for anything beyond temp-home fixtures. What I found:

  • config/calm-ship is read with the same home and FM_CONFIG_OVERRIDE rules as config/calm. Anything but spaceship (including absent or unreadable) keeps the boat.
  • With the file absent, the boat path is the same run-scoped widget as on main. The one shared change is that session_start now clears a still-installed working widget before re-applying. That only removes an orphan.
  • The spaceship's single setInterval is unref'd and cleared on dispose, it uses fixed ANSI codes, and it has no I/O.
  • There are no workflow, network or credential changes.

Because this is your first contribution from a fork, I approved the four pending CI runs (45757965142, 45757965217, 45757981086, 45819046990). The coverage guard, repo invariants and the no-mistakes check now pass. The attestation binds this head with no skipped steps, and there are 0 review threads.

Live evidence: go, 5 of 6 driven against a real Pi 1.6.1 TUI. The untested row is the Claude Code mod ignoring config/calm-ship. This PR doesn't touch the mod, so I'm accepting that.

Contract class: opt-in. Nothing changes unless a home writes spaceship to config/calm-ship. VISION, rule by rule: One captain: aligns (a presentation choice that composes with Calm, opt-in and out of the way) · Authority: aligns (explicit local file) · Scripts: aligns (deterministic tick-driven animation, no judgment) · Restart: aligns (re-read on session_start, cleared on shutdown) · Delegation: n/a · Vendor: aligns (Pi-only, behind the existing Calm adapter, Claude mod unchanged) · Scope: aligns (presentation inside the existing Calm surface).

Next: the full suite is the last gate. I've hit this pass's cap on new full-ci labels, so it goes on in the next pass. Then, as an opt-in change, it merges after a green run. Nothing is needed from you.

@101space 101space changed the title feat(pi): add selectable ambient spaceship Calm presentation feat(pi): add selectable ambient spaceship working presentation to Calm Nov 26, 2026
@101space

Copy link
Copy Markdown
Contributor Author

Brought this up to date with your current main, which clears the conflict. Two doc lines were aligned with the ambient banner in the process, docs/calm.md and docs/configuration.md, and nothing else moved: no code or test changes, and the change itself is the version you reviewed at d806137. New head is 42b4927.

@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate: thanks @101space for bringing it up to date. I checked new head 42b4927e: apart from docs, its diff against main is line-for-line the version I reviewed at d8061374. The doc changes in docs/calm.md, docs/calm-mode-feasibility.md and docs/configuration.md only describe the ambient spaceship next to the run-scoped boat. Diff review: safe, no P1, unchanged. The no-mistakes attestation binds this head with no skipped steps.

Because it's a new push from a fork, I approved its pending CI runs (45907803765, 45907803754, 45907839424, 45908011802).

Next: the full suite is still the last gate. This pass's full-ci labels went to PRs that were already queued ahead of this one by our ordering rule, so this is first in line for the next pass. I'm sorry it slipped a pass. After a green run it merges as opt-in. Contract class: opt-in, VISION aligns, both unchanged. Nothing is needed from you.

@kunchenguid kunchenguid added the full-ci Maintainer go-ahead: run the full CI suite on this outside pull request label Nov 27, 2026
@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate: thanks @101space. Every gate holds on head 42b4927e (no-mistakes attestation with no skipped steps, quick checks pass, my diff review safe with no P1, 0 threads, merges cleanly onto main b119e422), so I added the full-ci label and approved the fork run (run 45933914515). Contract class: opt-in. It stays off unless selected, so it merges after a green full suite. Nothing is needed from you.

…titution

Stock macOS Bash 3.2 lexes a heredoc body nested in $(...) as shell text,
so a prose apostrophe inside the JS harness opened shell quoting there and
an unbalanced parenthesis ended the substitution early. The macOS parse
sweep then reported an unrelated later line as an unmatched backtick.

Attach the harness to a group command that redirects to an output file,
the shape every other node harness in this file already uses, and read the
captured output back afterwards. The fixture, the JS harness, and every
assertion are unchanged.
@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate: thanks @101space for the Bash 3.2 fix to the spaceship test harness.

Where it stands: this waits on you (author). The head is now 1547a29f, but the body's attestation still binds 42b4927e, so the no-mistakes check won't pass on this head. Please re-run git push no-mistakes so the attestation binds the current head with no skipped steps.

Diff review of the new commit: safe, no P1. It's test-only: tests/fm-calm-pi-extension.test.sh now attaches the node heredoc to a subshell writing to $fixture/node-output instead of wrapping it in $(...), which matches the other harnesses in that file. Because it's a first-time fork, I approved its CI runs (46039299018, 46039298803). The full-ci label is still on, so the full suite runs on this head and you'll see whether the Bash 3.2 lane is fixed.

Contract class: opt-in (unchanged). Once the attestation binds the head and the full suite is green, this merges.

@101space 101space changed the title feat(pi): add selectable ambient spaceship working presentation to Calm feat(calm): add selectable spaceship working presentation Nov 28, 2026
@greptile-apps

greptile-apps Bot commented Nov 28, 2026 •

Copy link
Copy Markdown

Confidence Score: 5/5 · The PR appears safe to merge; the previous test gap is fixed and no new blocking issues were found.RetriggerView in GreptileConfidence Score: 5/5

[Low impact] The PR appears safe to merge; the previous test gap is fixed and no new blocking issues were found.

Reviews (2) · Last reviewed commit: "no-mistakes(ci): Addressed Greptile find..." · Reviewed by Greptile

Comment thread tests/fm-calm-pi-extension.test.sh Resolved
…extension.test.sh. The "absent config/calm-ship" case previously wrote an empty file, so readFileSync still succeeded and the missing-file fallback was never exercised. It now removes the file with `rmSync(..., { force: true })` (imported alongside writeFileSync), and the existing boat assertions are unchanged (no stale widget after session_start, boat hull during the run, clean settle on agent_settled). No product code touched, and no sibling sites write an empty calm-ship file. Verified by running the suite directly with FM_PI_PACKAGE_DIR pointing at the Pi 1.6.1 package-layout shim: all cases pass, including the "working-spaceship modes and selection" case; the four tmux/pi interactive E2E cases skip because tmux is absent, as expected
@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate: thanks @101space. The head is now 06ea0a81, and the attestation in the body binds it with every step completed, so the mismatch I flagged last time is cleared. Greptile is 5/5.

Diff review of what changed since 1547a29f: safe, no P1. It is a code comment, three doc lines and a new test case (toggling Calm off and back on while the standalone boat owns the slot), with a writeFileSync replaced by rmSync for the config file in that test. No workflow, network or credential changes. Because it's a new push from a fork, I approved its runs (46091348438, 46091348434). The full-ci label stays on, so the full suite re-runs on this head.

Contract class: opt-in (unchanged). Next: after a green full suite this merges. Nothing is needed from you.

@kunchenguid
kunchenguid merged commit 9abe136 into kunchenguid:main Nov 28, 2026
34 checks passed
@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate: this is merged. Thank you @101space — really appreciate you taking the time on this.

screamyx added a commit to screamyx/firstmate that referenced this pull request Nov 29, 2026
* fix(bearings): stop truncating Charted Next titles and reasons on the lavish board (kunchenguid#6357)

* fix(bearings): show full Charted Next titles and reasons on the lavish board

Charted Next rows on the board clipped their title and reason with an
ellipsis, and the snapshot shortened gate titles before the board saw them.
Charted Next rows now wrap their full text, and the snapshot's new
--fields gate-text opt-in carries untruncated title_full and reason_full
for the board while the chat digest keeps its compact bounds.

* fix(bearings): keep secondmate Charted Next text whole across the home summary

A secondmate's home summary shortened queued titles to 120 characters and
hold or blocked reasons to 160 before the bearings projection saw them, so
--fields gate-text still handed the lavish board clipped text for secondmate
gates. The summary now keeps up to 500 characters for those fields, which
covers any realistic backlog item while 20 bounded rows stay far inside the
summary byte cap. The stock macOS Bash CI lane's pinned Bearings test count
moves to 61 for the gate-text regression.

* no-mistakes(review): Pass secondmate queued title and reasons untruncated

* test(bearings): expect untruncated queued text in the secondmate home summary

* fix(bin): exec the herdr lab server launch so a timed-out provision cancels it (kunchenguid#8779)

* fix(bin): exec the herdr lab server launch so a timed-out provision cancels it

On bash builds that keep a subshell for an async function (macOS /bin/bash
3.2, the Linux CI bash), $! of the backgrounded launch was that subshell, so
fm_herdr_lab_cancel_provision left the herdr server running after a timed-out
provision. The launch now execs herdr through fm_herdr_lab_raw_exec, making
$! the server process on every bash; the cancel is unchanged.

The timed-out provision test now asserts, right after the provision returns,
that the launch process is gone, synchronized on the launch recording its pid
instead of a fixed sleep.

Fixes kunchenguid#8775

* no-mistakes(document): Document lab provision timeout cleanup

---------

Co-authored-by: Kun Chen <[email protected]>

* feat(bin): choose a codex account per ship or scout from a declared list (kunchenguid#8457)

* feat(bin): choose a codex account per ship or scout from a declared list

Add config/codex-accounts, the Codex counterpart of config/claude-accounts:
one Codex home per line (ordinary for the default ~/.codex, or an absolute
CODEX_HOME). While the list exists, every Codex ship or scout spawn names one
declared entry with --account, chosen at intake by the quota-array-dispatch
procedure from bin/fm-codex-account-quota.sh rows. The entry is checked with
codex login status in a stripped environment, launched with CODEX_HOME set
(or unset for ordinary) and CODEX_API_KEY and CODEX_ACCESS_TOKEN unset,
recorded as account=, and reused by relaunch unless --account moves it.
Without the list every Codex launch is unchanged and --account refuses.

bin/fm-worker-account-lib.sh now keys the declared list, its root variable,
and its shed credentials by runner, and the per-account quota read moves into
bin/fm-account-quota-lib.sh shared by the Claude and Codex entry points.

* no-mistakes(ci): I fixed both Greptile findings, and the new tests for each fail before the fix and pass after it. ci-1, Codex secondmates (`bin/fm-worker-account-lib.sh`). The rule: a secondmate without its own account pin file (Codex) must never read `config/codex-accounts`. `fm_worker_account_select` now returns early for such a secondmate, right after it refuses an explicit `--account`, and before the list is parsed. So an empty, malformed or unreadable list no longer blocks the launch or a relaunch. I checked the other place that reads the list, `fm_worker_account_relaunch_request`: it already returns before the read when given a secondmate. Ships, scouts, Claude and Pi follow the same path as before. New test: `test_codex_account_list_leaves_secondmates_alone` in `tests/fm-worker-account.test.sh` now writes a malformed `config/codex-accounts` and checks that a Codex secondmate still launches unchanged (exit 0, no `account=`). Before the fix it was refused with "config/codex-accounts must hold one account per line". ci-2, quota timeout (`bin/fm-account-quota-lib.sh`). The rule: each Claude account read must still honor the old `FM_CLAUDE_ACCOUNT_QUOTA_SECONDS`. `fm_account_quota_report` now picks the per-read limit once: `FM_ACCOUNT_QUOTA_SECONDS` first, then `FM_CLAUDE_ACCOUNT_QUOTA_SECONDS` for Claude only, then 60. The old variable is documented in the lib header. New test: `test_the_claude_read_timeout_is_honored` in `tests/fm-claude-account-quota.test.sh` uses a fake quota-axi that takes 3 seconds. With `FM_CLAUDE_ACCOUNT_QUOTA_SECONDS=1` the account is reported unreadable. Adding `FM_ACCOUNT_QUOTA_SECONDS=10` overrides it and the account is measured. Checks: `tests/fm-worker-account.test.sh`, `tests/fm-claude-account-quota.test.sh` and `tests/fm-codex-account-quota.test.sh` all pass, and `shellcheck -x` is clean on the four changed files. I did not reply to or resolve any PR comment

* fix(watch): absorb turn-end wakes after a user-aborted no-mistakes run (kunchenguid#8708)

* feat(watch): opt-in absorb of turn-ends after an aborted run

An aborted no-mistakes run keeps current state at failed until a fresh run
starts, so every turn-end of a worker that kept working surfaced.
config/turnend-abort-absorb absorbs it only when the run store records an
abort and an exact busy verdict is newer than the run's end.

Fixes kunchenguid#8675

* no-mistakes(document): Document turnend-abort-absorb flag

* fix(watch): match the exact abort errors no-mistakes records

A gate abort fails the run with 'step <name>: aborted by user[: <reason>]'
and 'axi abort' cancels it with 'cancelled: aborted by user'. Match those
errors exactly and no longer treat a run cancelled by a new push as aborted.

* no-mistakes(review): Fix abort-absorb docs for cancelled runs

* fix(watch): take the abort-absorb busy state from the busy-state verdict

* fix(lint): clear ShellCheck findings the new classify sources expose

* fix(calm): pass Claude Code 2.1.326 strict plugin validation (kunchenguid#8565)

Claude Code 2.1.323+ type-checks the Calm mod without
allowImportingTsExtensions and ignores a plugin tsconfig, so
`claude plugin validate --strict` refused the mod (TS5097 on the
.ts import specifiers) and the mod's test fixtures drifted from the
engine's declarations. Keep the .ts specifiers Node needs behind
@ts-ignore TS5097, update the fixtures (Spinner suffix, UserMessage
isExpanded, fs.stat isLink, ui.blit cells variant), and record the
2.1.326 verification. Runtime behavior is unchanged.

Closes kunchenguid#8558

* fix: support newer Codex releases for native Stop parking (kunchenguid#8174)

* fix(codex): admit Stop-park releases from 0.163.0

* no-mistakes(document): Remove stale Codex version selection claim

* fix(bin): reach a Codex primary from its SessionStart hook depth

Codex publishes no harness marker, so the session start digest identifies a
Codex primary only through the ancestry walk in bin/fm-harness.sh. That walk
examined eight processes, while the installed Codex runs the tracked
SessionStart wrapper nine parents above the digest's harness probe (eleven
and thirteen for the wake drain and guard probes). The digest therefore
reported harness unknown and rendered the generic supervision block, while
the session lock walker, which examines sixteen processes, still named the
Codex session.

The harness walks now share one sixteen-process reach matching
fm_harness_ancestry_pids, so the digest verdict and the lock owner come from
walks of the same reach. Marker and ancestry precedence is unchanged.

The Pi rebuild cases in the session-open suite set only the Pi marker beneath
the suite's long-lived codex fixture, which the shorter walk never reached;
they now run beneath a pi-named process, as a real Pi session's hooks do.

Adds a portable depth regression, a composed SessionStart regression under a
renamed codex process, and a token-free live SessionStart case for the
installed Codex.

* docs(codex): align version policy and ancestry trial scope

* no-mistakes(document): Clarify Codex SessionStart release coverage

* no-mistakes(document): Correct Stop park script reference

* no-mistakes(document): Clarify Codex Stop park and startup coverage

* fix: support wrapped Claude composer readback (kunchenguid#8501)

* fix: read a wrapped typed line in a named Claude composer

In a Claude session started with a name, the session title is drawn into
the composer's top rule. A titled top rule was accepted only when the
prompt glyph row sat directly on the closing rule, so typed text that
wrapped onto a second row read unknown and could not be extracted. A
backend that reads back its typed payload before pressing Enter then
withheld Enter: on a pane narrower than the text, the send failed, or
the text stayed in the composer and blocked every later send.

Accept the wrap rows between the glyph row and the closing rule when
they are contiguous, non-blank, edge-free and within
FM_COMPOSER_PI_MAX_LINES. A glyph followed by a blank row or a longer
region before the next rule still reads unknown.

* no-mistakes(document): Document wrapped named Claude composer reads

* fix(bin): read the PR scan past a review wait on the same PR (kunchenguid#8786)

* fix(bin): read the PR scan past a review wait on the same PR

A worker may declare its review wait with a paused: line right after its
ready done: line. The scan treated that wait as a later crew line and never
recorded the PR or armed its merge poll. The scan now reads back over paused:
lines whose every PR URL is the ready PR, while a paused: line naming no PR or
another PR, and any working:, blocked: or failed: line, still stop it.

Fixes kunchenguid#8762

* no-mistakes(review): ignore punctuation around a PR URL in a paused line

* fix(bin): pin secondmate retirement process-event calls to the retiring home's state (kunchenguid#8785)

fm-teardown.sh ran the retiring home's fm-procevent.sh with only FM_HOME and
FM_ROOT_OVERRIDE, so an inherited FM_STATE_OVERRIDE sent preflight, sweep, and
reconcile to the parent's state root. Retirement then refused on the parent's
directory mode, or swept the parent's own registrations and left the child's.

Pass FM_STATE_OVERRIDE="$home/state" on all three calls, match the docs and
recovery command, and replace the fake sweep test with the real fm-procevent.sh
under a parent override at modes 775 and 700, checking the parent's source and
directory mode stay unchanged.

* feat(calm): add selectable spaceship working presentation (kunchenguid#8769)

* feat(calm): selectable spaceship working presentation via config/calm-ship

Add an optional spaceship variant for Calm's animated working row on Pi,
selected by the local config/calm-ship file.

- Add .pi/extensions/lib/fm-calm-working-spaceship.ts: a persistent banner
  under its own firstmate-calm-working-spaceship widget key, with an idle
  two-row saucer-over-hull rest pose drifting left to right, a single-row
  `=( * )` warp sprite while a run is thinking, a bounded settle ease back
  into the drift, freeze/resume continuity across hide and show, resize
  clamping, narrow fallbacks, and idle crew markers read from the home's
  state records on a slow tick.
- .pi/extensions/fm-calm.ts resolves config/calm-ship with the same
  effective-home and FM_CONFIG_OVERRIDE rules as config/calm, at extension
  load and again on session_start and /calm. Anything other than
  "spaceship", including an absent file, keeps the boat, which stays the
  default. The boat's own presentation path and its shared widget slot with
  standalone Pi Calm are unchanged; the spaceship is dispatched as a
  separate banner that owns its own slot, and a selection switch tears down
  the replaced variant before installing the new one.
- Document the variant in docs/calm.md and the config/calm-ship schema in
  docs/configuration.md.
- Cover selection, rendering, mode, settle, and freeze/resume in
  tests/fm-calm-pi-extension.test.sh, and add the new module to the
  typecheck fixture in tests/fm-pi-primary-types.test.sh.

Supersedes the earlier attempt in kunchenguid#5567, which was
closed unmerged on 2026-10-18 with a branch that had conflicted. This is a
fresh port onto current main, not a revival of that branch.

* no-mistakes(review): Remove crew markers, dead saucer code, fix doc

* no-mistakes(review): Document calm-ship Pi-only scope and trim rule

* no-mistakes(review): Copy spaceship into live e2e; poll drift check

* no-mistakes(review): Tear down spaceship banner on shutdown; map module

* no-mistakes(review): Gate spaceship banner to one agent run

* no-mistakes(review): Share working slot; drop dead spaceship code

* no-mistakes(review): Name both presentation modules in file header

* no-mistakes(document): Align Calm docs with selectable spaceship variant

* feat(pi): keep the spaceship banner for the whole session with idle drift

The selectable spaceship working presentation was scoped to one agent run,
which left Pi's stock working row in place the rest of the session. Make it
ambient: while Calm is active and config/calm-ship selects it, the banner is
installed at session_start and lives until session_shutdown, and the run signal
drives its mode instead of its visibility.

Idle shows the two-row resting pose, a three-cell (|) saucer directly over a
three-cell |^| hull, drifting one column every ~1.5s with a starfield streaming
left past it. A run switches the same banner into the single-row compact
=( * ) warp; the settle relaxes the pose, returns the starfield to the idle
cadence immediately, and eases the pace back into the drift over a bounded
handful of graduated moves.

The boat is unchanged and stays run-scoped. Both presentations still share the
one working-row slot, so a dual Calm install renders one animation and a
presentation another extension installed is left alone.

* no-mistakes(review): Document dual-Calm spaceship exception and tests

* no-mistakes(document): Correct Calm spaceship narrow-fallback wording

* no-mistakes(document): Remove stale spaceship widget-key export

* no-mistakes(document): Align Calm spaceship docs with ambient banner

* test(calm): keep the spaceship harness out of a Bash 3.2 command substitution

Stock macOS Bash 3.2 lexes a heredoc body nested in $(...) as shell text,
so a prose apostrophe inside the JS harness opened shell quoting there and
an unbalanced parenthesis ended the substitution early. The macOS parse
sweep then reported an unrelated later line as an unmatched backtick.

Attach the harness to a group command that redirects to an output file,
the shape every other node harness in this file already uses, and read the
captured output back afterwards. The fixture, the JS harness, and every
assertion are unchanged.

* no-mistakes(review): Narrow dual-install docs; test Calm toggle

* no-mistakes(document): Scope Calm spaceship lifetime claims to calm.md

* no-mistakes(ci): Addressed Greptile finding ci-1 in tests/fm-calm-pi-extension.test.sh. The "absent config/calm-ship" case previously wrote an empty file, so readFileSync still succeeded and the missing-file fallback was never exercised. It now removes the file with `rmSync(..., { force: true })` (imported alongside writeFileSync), and the existing boat assertions are unchanged (no stale widget after session_start, boat hull during the run, clean settle on agent_settled). No product code touched, and no sibling sites write an empty calm-ship file. Verified by running the suite directly with FM_PI_PACKAGE_DIR pointing at the Pi 1.6.1 package-layout shim: all cases pass, including the "working-spaceship modes and selection" case; the four tmux/pi interactive E2E cases skip because tmux is absent, as expected

* fix: keep watcher liveness beacon fresh during long cycles (kunchenguid#8823)

* fix(bin): refresh watcher beacon at progress checkpoints

* fix(watch): reject zero checkpoint interval

* no-mistakes(document): Align beacon comments with checkpoint behavior

* fix(watch): checkpoint signal triage progress

* no-mistakes(review): Checkpoint turn-end worker classification

* no-mistakes(document): Document watcher beacon checkpoint behavior

---------

Co-authored-by: Pitch Perfekt Collective <[email protected]>

* fix(omp): consume every watcher wake omp merges into one message (kunchenguid#8711)

omp joins several queued follow-ups into one prompt or one text part
separated by a blank line. consumeWake only finished a pending wake when
the whole text equalled its content, so merged wakes were never finished
and the same replacement handoff was replayed in every later session.
Each pending wake whose full content the text carries is now consumed,
once per occurrence.

* feat(bin): reclaim returned Treehouse pool slot disk at teardown (kunchenguid#8778)

* feat(bin): reclaim a returned Treehouse pool slot's disk at teardown

A returned pool slot keeps every git-ignored build artifact behind
(node_modules, .next, dist, Electron builds), so pools only ever grow
across finished tasks. Teardown now destroys a ship or scout task's own
returned slot by default, relying on treehouse destroy's safe-by-default
behavior so unlanded, dirty, or otherwise disposable-ineligible slots are
only skipped with a warning, never a teardown failure. Opt out home-wide
with config/keep-pool-slots.

* no-mistakes(review): Release slot owner claim before pool slot destroy

* no-mistakes(document): Document keep-pool-slots flag in home layout

* feat(bin): make pool-slot reclaim opt-in (config/reclaim-pool-slots)

Per maintainer review on the PR: invert the flag so destroying a
returned pool slot only happens when a home explicitly opts in, never
by default. An unconfigured teardown behaves exactly as before this
feature existed.

* no-mistakes(review): Fix home-layout skill reclaim flag name

* fix(rex): resolve the launcher session from REX_BLOCK (kunchenguid#8834)

* fix(rex): resolve the launcher session from REX_BLOCK

* no-mistakes(document): Drop stale REX_SESSION from comments

* no-mistakes(lint): Fix ShellCheck warnings in Rex tests

* perf(watch): cut program starts from the idle watcher poll (kunchenguid#8631)

An idle watcher poll starts many short-lived programs whose answers bash
can give itself. Replace them with builtins on the per-poll path, keeping
every result and error word the same:

- sign each status file once per scan and pass that signature to the
  seen check instead of signing it again
- on Darwin, read path state, size and identity with one stat instead of
  four or five, with the same fields and error words
- hex-encode plain-ASCII signature fields with printf -v instead of
  od | tr; any other byte keeps the od encoding
- read the presentation marker, turn-ended markers and the pane capture
  file with $(<file) instead of cat, and strip the pgid without tr
- read kind/backend/harness from a window's meta with one builtin loop
  instead of grep | cut, keeping every value of a repeated key
- skip rm for per-window markers that do not exist (fm_rm_present, same
  exit status as rm -f; a dangling symlink still counts as present)
- skip mkdir of an existing state dir and dirname at library load

Measured with one method: a PATH-shim tracer that logs every program
start (absolute-path calls routed through the shims via BASH_ENV), on
macOS with /bin/bash 3.2, against a synthetic idle home (10
already-reported status files, tmux panes printing a clock, FM_POLL=3).
Each figure is the start count of one steady idle poll (polls after the
first two, between watcher beacon touches) in a 40-second traced run;
every steady poll in a run had the same count. Base is 427056c, the
other side is this commit, both exported from git:

- no task windows: 195 -> 86 starts per poll (-56%)
- four task windows: 291 -> 130 starts per poll (-55%)

An earlier measurement of part of this work reported 102 -> 72 and
170 -> 116 with the same tracer; those pairs differ because they measured
a different baseline - a tree that already had the first half of these
changes - and only the second half on top of it, so they are not quoted
here.

status_observed_signature output is byte-identical before and after on
72 fixture cases (regular, empty, symlinked, dangling, non-ASCII and
invalid-byte targets, directory, unreadable, FIFO, missing; LC_ALL=C and
UTF-8) under bash 3.2 and 5.3.

Not measured: Herdr panes, Linux, wake/drain/ack turns, the periodic
check and home-summary runs, and forks that do not exec.

The inactive-reconcile per-poll fast path and the procevent uname/id
caching are left to kunchenguid#7329 and kunchenguid#7349, which already propose them.

Refs kunchenguid#7330

* fix: classify Pi credential-less launch rejection (kunchenguid#8848)

* feat(watch): wake on an arrived captain-hold --until date (kunchenguid#8469)

* feat(watch): wake on an arrived captain-hold --until date (kunchenguid#8444)

Behind the existing opt-in config/open-decision-reminders flag, queue one
check wake per main-home captain hold and --until date when the date arrives.
A durable ledger keeps a watcher restart from refiring a recorded pair.

* no-mistakes(review): Skip Done rows in captain hold wake

* no-mistakes(document): Document captain-hold date wake skips Done rows

* no-mistakes(ci): Throttle failed captain-hold reads and bound them

* docs(watch): list captain hold date wake in the header reason index (kunchenguid#8444)

* test(wake-queue): retry lock directory removal in waiter test (kunchenguid#7901)

* test: retry removal of a lock directory the waiter still writes

The waiter creates owner directories inside the state directory while
it waits. One rm -rf can lose that race, leave the directory in place,
and let the waiter return 0.

On origin/main the test matches the copy that failed in CI run
https://github.com/kunchenguid/firstmate/actions/runs/40652730373
(job "Behavior portable serial 3"):
rm: cannot remove '/tmp/fm-wake-tests.ckX5w2/lock-dir-removed/state': Directory not empty
not ok - the lock wait over a removed directory returned 0, not 1

Locally, fm_lock_owner_dir against rm -rf printed "Directory not empty"
3 times in 300 tries. The unfixed test passed 40/40 because the race
did not land. The fixed test passed 20/20. A removal that never
succeeds fails with "the lock directory survived 50 removal retries".

* test(wake-queue): rename the lock directory before the bounded removal retry

* fix(bin): resolve the Rex launcher session on Rex 0.1.0 (kunchenguid#8855)

* fix(rex): resolve the launcher session on Rex 0.1.0

Rex 0.1.0 rejects a block id as a session.view target, so a Firstmate
running directly in a Rex terminal could not spawn any task and skipped
per-home session cleanup. Resolve the launcher from REX_SESSION when set,
refusing when that session does not hold REX_BLOCK exactly once; otherwise
walk the session list for the single session holding the block, and keep
the block-target call only as a fallback when the list cannot be read.
The refusal now names its reason and the next step.

Fixes kunchenguid#8842

* no-mistakes(review): Make real-Rex smoke no-walk assertion detect flagged ls calls

* no-mistakes(review): Require a matching session_id before confirming the Rex launcher block

* no-mistakes(review): Warn when secondmate placement skips an unresolved Rex launcher

* no-mistakes(review): Stop blaming Rex build in inventory-unreadable refusal

* no-mistakes(review): Restore test coverage for retirement's launcher-session exclusion

* no-mistakes(test): Document Rex launcher behaviour for builds 1758 and 2181

* no-mistakes(document): Clarify Rex per-home session fallback wording

* no-mistakes(ci): I fixed ci-2 (Greptile: unreadable session views were silently skipped). The rule being broken: before placing anything, Firstmate must confirm that REX_BLOCK appears exactly once inside the chosen session, so a session whose view can't be read must never count as "no match". There are three places that read a view, and two already followed this rule. The REX_SESSION path refuses when fm_backend_rex_view_holds_block fails, and the legacy block-target fallback refuses when it can't parse the view. Only the session-list walk in fm_backend_rex_sessions_holding_block treated an exit-0 view it couldn't parse as a non-match and moved on. Fix (bin/backends/rex.sh): in the walk, after a session.view exits 0, the response must be valid JSON whose `.session_id` matches the listed session before the exactly-once check runs. If it isn't, the walk returns 1, and fm_backend_rex_launcher_session refuses with "a live session's view could not be read". I updated the function comment to match. I added no new helpers or branches. Tests: - The fake fixture (tests/rex-fake-fixture.sh) has a new `view-garbled` switch. It holds a session id, and that session's view exits 0 with truncated JSON. - tests/fm-backend-rex.test.sh has a new case where the other session's view is garbled. Resolution must refuse with that reason. Without the fix, the walk would skip the garbled session and resolve to the launcher session. - The existing walked-view-without-session_id case now expects that same unreadable-view refusal, in line with the earlier decision that a view without session_id is unresolved on every path. When I removed the fix temporarily, that assertion failed, and the whole file passed again once I put it back. Results: tests/fm-backend-rex.test.sh passes with exit code 0 (42 tests ok). `/opt/homebrew/bin/shellcheck -x` is clean on all three changed files. I ran no other suites. I replied on the Greptile thread that it is fixed: kunchenguid#8855 (comment). The fix is not committed or pushed yet, so the thread will show it only once the pipeline pushes. As you asked, I changed nothing for ci-1 (Full suite waiting on the full-ci label) and did not comment asking for the label

* no-mistakes(test): Widen teardown-race poll window in PR-check test

---------

Co-authored-by: Jess Telford <[email protected]>
Co-authored-by: YifuGu <[email protected]>
Co-authored-by: Kun Chen <[email protected]>
Co-authored-by: Shawn Kost <[email protected]>
Co-authored-by: Tim Kleinschmidt <[email protected]>
Co-authored-by: Robert Christensen <[email protected]>
Co-authored-by: Tiago <[email protected]>
Co-authored-by: 101space <[email protected]>
Co-authored-by: Mehul Bhagwani <[email protected]>
Co-authored-by: Pitch Perfekt Collective <[email protected]>
Co-authored-by: Symphony <[email protected]>
Co-authored-by: geanoro <[email protected]>
Co-authored-by: Ian Brown <[email protected]>
Co-authored-by: Cody <[email protected]>
Co-authored-by: screamyx <[email protected]>
hoang-ross-dinh added a commit to hoang-ross-dinh/firstmate that referenced this pull request Nov 30, 2026
* origin/main: (99 commits)
  feat(bin): reclaim returned Treehouse pool slot disk at teardown (kunchenguid#8778)
  fix(omp): consume every watcher wake omp merges into one message (kunchenguid#8711)
  fix: keep watcher liveness beacon fresh during long cycles (kunchenguid#8823)
  feat(calm): add selectable spaceship working presentation (kunchenguid#8769)
  fix(bin): pin secondmate retirement process-event calls to the retiring home's state (kunchenguid#8785)
  fix(bin): read the PR scan past a review wait on the same PR (kunchenguid#8786)
  fix: support wrapped Claude composer readback (kunchenguid#8501)
  fix: support newer Codex releases for native Stop parking (kunchenguid#8174)
  fix(calm): pass Claude Code 2.1.326 strict plugin validation (kunchenguid#8565)
  fix(watch): absorb turn-end wakes after a user-aborted no-mistakes run (kunchenguid#8708)
  feat(bin): choose a codex account per ship or scout from a declared list (kunchenguid#8457)
  fix(bin): exec the herdr lab server launch so a timed-out provision cancels it (kunchenguid#8779)
  fix(bearings): stop truncating Charted Next titles and reasons on the lavish board (kunchenguid#6357)
  test: make behavior fixtures portable and isolated on macOS (kunchenguid#8756)
  fix: narrow Herdr presentation lock scope (kunchenguid#7430)
  feat: add opt-in Pi Bash timeout cap (kunchenguid#8445)
  fix(lock): never record an omp daemon worker as the session (kunchenguid#8731)
  feat(bin): add opt-in reports to the PR health monitor (kunchenguid#8773)
  fix: report an incompatible remote tasks-axi as OUTDATED (kunchenguid#8743)
  fix: publish extension packages on macOS before making them read-only (kunchenguid#8744)
  ...

Resolved conflicts by hunk:
- bin/fm-procevent.sh
- bin/fm-spawn.sh
- bin/fm-test-run.sh
- docs/configuration.md
- docs/fm-test-portable-shards.md
- docs/scripts.md
- tests/fm-session-lock-ancestry.test.sh
- tests/fm-spawn-batch.test.sh
- tests/fm-spawn-dispatch-profile.test.sh
- tests/fm-turnend-guard.test.sh
- tests/lib.sh

Carried the local recap publish timing hint into tests/fm-test-ci-timings.tsv.
screamyx added a commit to screamyx/firstmate that referenced this pull request Nov 30, 2026
* fix(bearings): stop truncating Charted Next titles and reasons on the lavish board (kunchenguid#6357)

* fix(bearings): show full Charted Next titles and reasons on the lavish board

Charted Next rows on the board clipped their title and reason with an
ellipsis, and the snapshot shortened gate titles before the board saw them.
Charted Next rows now wrap their full text, and the snapshot's new
--fields gate-text opt-in carries untruncated title_full and reason_full
for the board while the chat digest keeps its compact bounds.

* fix(bearings): keep secondmate Charted Next text whole across the home summary

A secondmate's home summary shortened queued titles to 120 characters and
hold or blocked reasons to 160 before the bearings projection saw them, so
--fields gate-text still handed the lavish board clipped text for secondmate
gates. The summary now keeps up to 500 characters for those fields, which
covers any realistic backlog item while 20 bounded rows stay far inside the
summary byte cap. The stock macOS Bash CI lane's pinned Bearings test count
moves to 61 for the gate-text regression.

* no-mistakes(review): Pass secondmate queued title and reasons untruncated

* test(bearings): expect untruncated queued text in the secondmate home summary

* fix(bin): exec the herdr lab server launch so a timed-out provision cancels it (kunchenguid#8779)

* fix(bin): exec the herdr lab server launch so a timed-out provision cancels it

On bash builds that keep a subshell for an async function (macOS /bin/bash
3.2, the Linux CI bash), $! of the backgrounded launch was that subshell, so
fm_herdr_lab_cancel_provision left the herdr server running after a timed-out
provision. The launch now execs herdr through fm_herdr_lab_raw_exec, making
$! the server process on every bash; the cancel is unchanged.

The timed-out provision test now asserts, right after the provision returns,
that the launch process is gone, synchronized on the launch recording its pid
instead of a fixed sleep.

Fixes kunchenguid#8775

* no-mistakes(document): Document lab provision timeout cleanup

---------

Co-authored-by: Kun Chen <[email protected]>

* feat(bin): choose a codex account per ship or scout from a declared list (kunchenguid#8457)

* feat(bin): choose a codex account per ship or scout from a declared list

Add config/codex-accounts, the Codex counterpart of config/claude-accounts:
one Codex home per line (ordinary for the default ~/.codex, or an absolute
CODEX_HOME). While the list exists, every Codex ship or scout spawn names one
declared entry with --account, chosen at intake by the quota-array-dispatch
procedure from bin/fm-codex-account-quota.sh rows. The entry is checked with
codex login status in a stripped environment, launched with CODEX_HOME set
(or unset for ordinary) and CODEX_API_KEY and CODEX_ACCESS_TOKEN unset,
recorded as account=, and reused by relaunch unless --account moves it.
Without the list every Codex launch is unchanged and --account refuses.

bin/fm-worker-account-lib.sh now keys the declared list, its root variable,
and its shed credentials by runner, and the per-account quota read moves into
bin/fm-account-quota-lib.sh shared by the Claude and Codex entry points.

* no-mistakes(ci): I fixed both Greptile findings, and the new tests for each fail before the fix and pass after it. ci-1, Codex secondmates (`bin/fm-worker-account-lib.sh`). The rule: a secondmate without its own account pin file (Codex) must never read `config/codex-accounts`. `fm_worker_account_select` now returns early for such a secondmate, right after it refuses an explicit `--account`, and before the list is parsed. So an empty, malformed or unreadable list no longer blocks the launch or a relaunch. I checked the other place that reads the list, `fm_worker_account_relaunch_request`: it already returns before the read when given a secondmate. Ships, scouts, Claude and Pi follow the same path as before. New test: `test_codex_account_list_leaves_secondmates_alone` in `tests/fm-worker-account.test.sh` now writes a malformed `config/codex-accounts` and checks that a Codex secondmate still launches unchanged (exit 0, no `account=`). Before the fix it was refused with "config/codex-accounts must hold one account per line". ci-2, quota timeout (`bin/fm-account-quota-lib.sh`). The rule: each Claude account read must still honor the old `FM_CLAUDE_ACCOUNT_QUOTA_SECONDS`. `fm_account_quota_report` now picks the per-read limit once: `FM_ACCOUNT_QUOTA_SECONDS` first, then `FM_CLAUDE_ACCOUNT_QUOTA_SECONDS` for Claude only, then 60. The old variable is documented in the lib header. New test: `test_the_claude_read_timeout_is_honored` in `tests/fm-claude-account-quota.test.sh` uses a fake quota-axi that takes 3 seconds. With `FM_CLAUDE_ACCOUNT_QUOTA_SECONDS=1` the account is reported unreadable. Adding `FM_ACCOUNT_QUOTA_SECONDS=10` overrides it and the account is measured. Checks: `tests/fm-worker-account.test.sh`, `tests/fm-claude-account-quota.test.sh` and `tests/fm-codex-account-quota.test.sh` all pass, and `shellcheck -x` is clean on the four changed files. I did not reply to or resolve any PR comment

* fix(watch): absorb turn-end wakes after a user-aborted no-mistakes run (kunchenguid#8708)

* feat(watch): opt-in absorb of turn-ends after an aborted run

An aborted no-mistakes run keeps current state at failed until a fresh run
starts, so every turn-end of a worker that kept working surfaced.
config/turnend-abort-absorb absorbs it only when the run store records an
abort and an exact busy verdict is newer than the run's end.

Fixes kunchenguid#8675

* no-mistakes(document): Document turnend-abort-absorb flag

* fix(watch): match the exact abort errors no-mistakes records

A gate abort fails the run with 'step <name>: aborted by user[: <reason>]'
and 'axi abort' cancels it with 'cancelled: aborted by user'. Match those
errors exactly and no longer treat a run cancelled by a new push as aborted.

* no-mistakes(review): Fix abort-absorb docs for cancelled runs

* fix(watch): take the abort-absorb busy state from the busy-state verdict

* fix(lint): clear ShellCheck findings the new classify sources expose

* fix(calm): pass Claude Code 2.1.326 strict plugin validation (kunchenguid#8565)

Claude Code 2.1.323+ type-checks the Calm mod without
allowImportingTsExtensions and ignores a plugin tsconfig, so
`claude plugin validate --strict` refused the mod (TS5097 on the
.ts import specifiers) and the mod's test fixtures drifted from the
engine's declarations. Keep the .ts specifiers Node needs behind
@ts-ignore TS5097, update the fixtures (Spinner suffix, UserMessage
isExpanded, fs.stat isLink, ui.blit cells variant), and record the
2.1.326 verification. Runtime behavior is unchanged.

Closes kunchenguid#8558

* fix: support newer Codex releases for native Stop parking (kunchenguid#8174)

* fix(codex): admit Stop-park releases from 0.163.0

* no-mistakes(document): Remove stale Codex version selection claim

* fix(bin): reach a Codex primary from its SessionStart hook depth

Codex publishes no harness marker, so the session start digest identifies a
Codex primary only through the ancestry walk in bin/fm-harness.sh. That walk
examined eight processes, while the installed Codex runs the tracked
SessionStart wrapper nine parents above the digest's harness probe (eleven
and thirteen for the wake drain and guard probes). The digest therefore
reported harness unknown and rendered the generic supervision block, while
the session lock walker, which examines sixteen processes, still named the
Codex session.

The harness walks now share one sixteen-process reach matching
fm_harness_ancestry_pids, so the digest verdict and the lock owner come from
walks of the same reach. Marker and ancestry precedence is unchanged.

The Pi rebuild cases in the session-open suite set only the Pi marker beneath
the suite's long-lived codex fixture, which the shorter walk never reached;
they now run beneath a pi-named process, as a real Pi session's hooks do.

Adds a portable depth regression, a composed SessionStart regression under a
renamed codex process, and a token-free live SessionStart case for the
installed Codex.

* docs(codex): align version policy and ancestry trial scope

* no-mistakes(document): Clarify Codex SessionStart release coverage

* no-mistakes(document): Correct Stop park script reference

* no-mistakes(document): Clarify Codex Stop park and startup coverage

* fix: support wrapped Claude composer readback (kunchenguid#8501)

* fix: read a wrapped typed line in a named Claude composer

In a Claude session started with a name, the session title is drawn into
the composer's top rule. A titled top rule was accepted only when the
prompt glyph row sat directly on the closing rule, so typed text that
wrapped onto a second row read unknown and could not be extracted. A
backend that reads back its typed payload before pressing Enter then
withheld Enter: on a pane narrower than the text, the send failed, or
the text stayed in the composer and blocked every later send.

Accept the wrap rows between the glyph row and the closing rule when
they are contiguous, non-blank, edge-free and within
FM_COMPOSER_PI_MAX_LINES. A glyph followed by a blank row or a longer
region before the next rule still reads unknown.

* no-mistakes(document): Document wrapped named Claude composer reads

* fix(bin): read the PR scan past a review wait on the same PR (kunchenguid#8786)

* fix(bin): read the PR scan past a review wait on the same PR

A worker may declare its review wait with a paused: line right after its
ready done: line. The scan treated that wait as a later crew line and never
recorded the PR or armed its merge poll. The scan now reads back over paused:
lines whose every PR URL is the ready PR, while a paused: line naming no PR or
another PR, and any working:, blocked: or failed: line, still stop it.

Fixes kunchenguid#8762

* no-mistakes(review): ignore punctuation around a PR URL in a paused line

* fix(bin): pin secondmate retirement process-event calls to the retiring home's state (kunchenguid#8785)

fm-teardown.sh ran the retiring home's fm-procevent.sh with only FM_HOME and
FM_ROOT_OVERRIDE, so an inherited FM_STATE_OVERRIDE sent preflight, sweep, and
reconcile to the parent's state root. Retirement then refused on the parent's
directory mode, or swept the parent's own registrations and left the child's.

Pass FM_STATE_OVERRIDE="$home/state" on all three calls, match the docs and
recovery command, and replace the fake sweep test with the real fm-procevent.sh
under a parent override at modes 775 and 700, checking the parent's source and
directory mode stay unchanged.

* feat(calm): add selectable spaceship working presentation (kunchenguid#8769)

* feat(calm): selectable spaceship working presentation via config/calm-ship

Add an optional spaceship variant for Calm's animated working row on Pi,
selected by the local config/calm-ship file.

- Add .pi/extensions/lib/fm-calm-working-spaceship.ts: a persistent banner
  under its own firstmate-calm-working-spaceship widget key, with an idle
  two-row saucer-over-hull rest pose drifting left to right, a single-row
  `=( * )` warp sprite while a run is thinking, a bounded settle ease back
  into the drift, freeze/resume continuity across hide and show, resize
  clamping, narrow fallbacks, and idle crew markers read from the home's
  state records on a slow tick.
- .pi/extensions/fm-calm.ts resolves config/calm-ship with the same
  effective-home and FM_CONFIG_OVERRIDE rules as config/calm, at extension
  load and again on session_start and /calm. Anything other than
  "spaceship", including an absent file, keeps the boat, which stays the
  default. The boat's own presentation path and its shared widget slot with
  standalone Pi Calm are unchanged; the spaceship is dispatched as a
  separate banner that owns its own slot, and a selection switch tears down
  the replaced variant before installing the new one.
- Document the variant in docs/calm.md and the config/calm-ship schema in
  docs/configuration.md.
- Cover selection, rendering, mode, settle, and freeze/resume in
  tests/fm-calm-pi-extension.test.sh, and add the new module to the
  typecheck fixture in tests/fm-pi-primary-types.test.sh.

Supersedes the earlier attempt in kunchenguid#5567, which was
closed unmerged on 2026-10-18 with a branch that had conflicted. This is a
fresh port onto current main, not a revival of that branch.

* no-mistakes(review): Remove crew markers, dead saucer code, fix doc

* no-mistakes(review): Document calm-ship Pi-only scope and trim rule

* no-mistakes(review): Copy spaceship into live e2e; poll drift check

* no-mistakes(review): Tear down spaceship banner on shutdown; map module

* no-mistakes(review): Gate spaceship banner to one agent run

* no-mistakes(review): Share working slot; drop dead spaceship code

* no-mistakes(review): Name both presentation modules in file header

* no-mistakes(document): Align Calm docs with selectable spaceship variant

* feat(pi): keep the spaceship banner for the whole session with idle drift

The selectable spaceship working presentation was scoped to one agent run,
which left Pi's stock working row in place the rest of the session. Make it
ambient: while Calm is active and config/calm-ship selects it, the banner is
installed at session_start and lives until session_shutdown, and the run signal
drives its mode instead of its visibility.

Idle shows the two-row resting pose, a three-cell (|) saucer directly over a
three-cell |^| hull, drifting one column every ~1.5s with a starfield streaming
left past it. A run switches the same banner into the single-row compact
=( * ) warp; the settle relaxes the pose, returns the starfield to the idle
cadence immediately, and eases the pace back into the drift over a bounded
handful of graduated moves.

The boat is unchanged and stays run-scoped. Both presentations still share the
one working-row slot, so a dual Calm install renders one animation and a
presentation another extension installed is left alone.

* no-mistakes(review): Document dual-Calm spaceship exception and tests

* no-mistakes(document): Correct Calm spaceship narrow-fallback wording

* no-mistakes(document): Remove stale spaceship widget-key export

* no-mistakes(document): Align Calm spaceship docs with ambient banner

* test(calm): keep the spaceship harness out of a Bash 3.2 command substitution

Stock macOS Bash 3.2 lexes a heredoc body nested in $(...) as shell text,
so a prose apostrophe inside the JS harness opened shell quoting there and
an unbalanced parenthesis ended the substitution early. The macOS parse
sweep then reported an unrelated later line as an unmatched backtick.

Attach the harness to a group command that redirects to an output file,
the shape every other node harness in this file already uses, and read the
captured output back afterwards. The fixture, the JS harness, and every
assertion are unchanged.

* no-mistakes(review): Narrow dual-install docs; test Calm toggle

* no-mistakes(document): Scope Calm spaceship lifetime claims to calm.md

* no-mistakes(ci): Addressed Greptile finding ci-1 in tests/fm-calm-pi-extension.test.sh. The "absent config/calm-ship" case previously wrote an empty file, so readFileSync still succeeded and the missing-file fallback was never exercised. It now removes the file with `rmSync(..., { force: true })` (imported alongside writeFileSync), and the existing boat assertions are unchanged (no stale widget after session_start, boat hull during the run, clean settle on agent_settled). No product code touched, and no sibling sites write an empty calm-ship file. Verified by running the suite directly with FM_PI_PACKAGE_DIR pointing at the Pi 1.6.1 package-layout shim: all cases pass, including the "working-spaceship modes and selection" case; the four tmux/pi interactive E2E cases skip because tmux is absent, as expected

* fix: keep watcher liveness beacon fresh during long cycles (kunchenguid#8823)

* fix(bin): refresh watcher beacon at progress checkpoints

* fix(watch): reject zero checkpoint interval

* no-mistakes(document): Align beacon comments with checkpoint behavior

* fix(watch): checkpoint signal triage progress

* no-mistakes(review): Checkpoint turn-end worker classification

* no-mistakes(document): Document watcher beacon checkpoint behavior

---------

Co-authored-by: Pitch Perfekt Collective <[email protected]>

* fix(omp): consume every watcher wake omp merges into one message (kunchenguid#8711)

omp joins several queued follow-ups into one prompt or one text part
separated by a blank line. consumeWake only finished a pending wake when
the whole text equalled its content, so merged wakes were never finished
and the same replacement handoff was replayed in every later session.
Each pending wake whose full content the text carries is now consumed,
once per occurrence.

* feat(bin): reclaim returned Treehouse pool slot disk at teardown (kunchenguid#8778)

* feat(bin): reclaim a returned Treehouse pool slot's disk at teardown

A returned pool slot keeps every git-ignored build artifact behind
(node_modules, .next, dist, Electron builds), so pools only ever grow
across finished tasks. Teardown now destroys a ship or scout task's own
returned slot by default, relying on treehouse destroy's safe-by-default
behavior so unlanded, dirty, or otherwise disposable-ineligible slots are
only skipped with a warning, never a teardown failure. Opt out home-wide
with config/keep-pool-slots.

* no-mistakes(review): Release slot owner claim before pool slot destroy

* no-mistakes(document): Document keep-pool-slots flag in home layout

* feat(bin): make pool-slot reclaim opt-in (config/reclaim-pool-slots)

Per maintainer review on the PR: invert the flag so destroying a
returned pool slot only happens when a home explicitly opts in, never
by default. An unconfigured teardown behaves exactly as before this
feature existed.

* no-mistakes(review): Fix home-layout skill reclaim flag name

* fix(rex): resolve the launcher session from REX_BLOCK (kunchenguid#8834)

* fix(rex): resolve the launcher session from REX_BLOCK

* no-mistakes(document): Drop stale REX_SESSION from comments

* no-mistakes(lint): Fix ShellCheck warnings in Rex tests

* perf(watch): cut program starts from the idle watcher poll (kunchenguid#8631)

An idle watcher poll starts many short-lived programs whose answers bash
can give itself. Replace them with builtins on the per-poll path, keeping
every result and error word the same:

- sign each status file once per scan and pass that signature to the
  seen check instead of signing it again
- on Darwin, read path state, size and identity with one stat instead of
  four or five, with the same fields and error words
- hex-encode plain-ASCII signature fields with printf -v instead of
  od | tr; any other byte keeps the od encoding
- read the presentation marker, turn-ended markers and the pane capture
  file with $(<file) instead of cat, and strip the pgid without tr
- read kind/backend/harness from a window's meta with one builtin loop
  instead of grep | cut, keeping every value of a repeated key
- skip rm for per-window markers that do not exist (fm_rm_present, same
  exit status as rm -f; a dangling symlink still counts as present)
- skip mkdir of an existing state dir and dirname at library load

Measured with one method: a PATH-shim tracer that logs every program
start (absolute-path calls routed through the shims via BASH_ENV), on
macOS with /bin/bash 3.2, against a synthetic idle home (10
already-reported status files, tmux panes printing a clock, FM_POLL=3).
Each figure is the start count of one steady idle poll (polls after the
first two, between watcher beacon touches) in a 40-second traced run;
every steady poll in a run had the same count. Base is 427056c, the
other side is this commit, both exported from git:

- no task windows: 195 -> 86 starts per poll (-56%)
- four task windows: 291 -> 130 starts per poll (-55%)

An earlier measurement of part of this work reported 102 -> 72 and
170 -> 116 with the same tracer; those pairs differ because they measured
a different baseline - a tree that already had the first half of these
changes - and only the second half on top of it, so they are not quoted
here.

status_observed_signature output is byte-identical before and after on
72 fixture cases (regular, empty, symlinked, dangling, non-ASCII and
invalid-byte targets, directory, unreadable, FIFO, missing; LC_ALL=C and
UTF-8) under bash 3.2 and 5.3.

Not measured: Herdr panes, Linux, wake/drain/ack turns, the periodic
check and home-summary runs, and forks that do not exec.

The inactive-reconcile per-poll fast path and the procevent uname/id
caching are left to kunchenguid#7329 and kunchenguid#7349, which already propose them.

Refs kunchenguid#7330

* fix: classify Pi credential-less launch rejection (kunchenguid#8848)

* feat(watch): wake on an arrived captain-hold --until date (kunchenguid#8469)

* feat(watch): wake on an arrived captain-hold --until date (kunchenguid#8444)

Behind the existing opt-in config/open-decision-reminders flag, queue one
check wake per main-home captain hold and --until date when the date arrives.
A durable ledger keeps a watcher restart from refiring a recorded pair.

* no-mistakes(review): Skip Done rows in captain hold wake

* no-mistakes(document): Document captain-hold date wake skips Done rows

* no-mistakes(ci): Throttle failed captain-hold reads and bound them

* docs(watch): list captain hold date wake in the header reason index (kunchenguid#8444)

* test(wake-queue): retry lock directory removal in waiter test (kunchenguid#7901)

* test: retry removal of a lock directory the waiter still writes

The waiter creates owner directories inside the state directory while
it waits. One rm -rf can lose that race, leave the directory in place,
and let the waiter return 0.

On origin/main the test matches the copy that failed in CI run
https://github.com/kunchenguid/firstmate/actions/runs/40652730373
(job "Behavior portable serial 3"):
rm: cannot remove '/tmp/fm-wake-tests.ckX5w2/lock-dir-removed/state': Directory not empty
not ok - the lock wait over a removed directory returned 0, not 1

Locally, fm_lock_owner_dir against rm -rf printed "Directory not empty"
3 times in 300 tries. The unfixed test passed 40/40 because the race
did not land. The fixed test passed 20/20. A removal that never
succeeds fails with "the lock directory survived 50 removal retries".

* test(wake-queue): rename the lock directory before the bounded removal retry

* fix(bin): resolve the Rex launcher session on Rex 0.1.0 (kunchenguid#8855)

* fix(rex): resolve the launcher session on Rex 0.1.0

Rex 0.1.0 rejects a block id as a session.view target, so a Firstmate
running directly in a Rex terminal could not spawn any task and skipped
per-home session cleanup. Resolve the launcher from REX_SESSION when set,
refusing when that session does not hold REX_BLOCK exactly once; otherwise
walk the session list for the single session holding the block, and keep
the block-target call only as a fallback when the list cannot be read.
The refusal now names its reason and the next step.

Fixes kunchenguid#8842

* no-mistakes(review): Make real-Rex smoke no-walk assertion detect flagged ls calls

* no-mistakes(review): Require a matching session_id before confirming the Rex launcher block

* no-mistakes(review): Warn when secondmate placement skips an unresolved Rex launcher

* no-mistakes(review): Stop blaming Rex build in inventory-unreadable refusal

* no-mistakes(review): Restore test coverage for retirement's launcher-session exclusion

* no-mistakes(test): Document Rex launcher behaviour for builds 1758 and 2181

* no-mistakes(document): Clarify Rex per-home session fallback wording

* no-mistakes(ci): I fixed ci-2 (Greptile: unreadable session views were silently skipped). The rule being broken: before placing anything, Firstmate must confirm that REX_BLOCK appears exactly once inside the chosen session, so a session whose view can't be read must never count as "no match". There are three places that read a view, and two already followed this rule. The REX_SESSION path refuses when fm_backend_rex_view_holds_block fails, and the legacy block-target fallback refuses when it can't parse the view. Only the session-list walk in fm_backend_rex_sessions_holding_block treated an exit-0 view it couldn't parse as a non-match and moved on. Fix (bin/backends/rex.sh): in the walk, after a session.view exits 0, the response must be valid JSON whose `.session_id` matches the listed session before the exactly-once check runs. If it isn't, the walk returns 1, and fm_backend_rex_launcher_session refuses with "a live session's view could not be read". I updated the function comment to match. I added no new helpers or branches. Tests: - The fake fixture (tests/rex-fake-fixture.sh) has a new `view-garbled` switch. It holds a session id, and that session's view exits 0 with truncated JSON. - tests/fm-backend-rex.test.sh has a new case where the other session's view is garbled. Resolution must refuse with that reason. Without the fix, the walk would skip the garbled session and resolve to the launcher session. - The existing walked-view-without-session_id case now expects that same unreadable-view refusal, in line with the earlier decision that a view without session_id is unresolved on every path. When I removed the fix temporarily, that assertion failed, and the whole file passed again once I put it back. Results: tests/fm-backend-rex.test.sh passes with exit code 0 (42 tests ok). `/opt/homebrew/bin/shellcheck -x` is clean on all three changed files. I ran no other suites. I replied on the Greptile thread that it is fixed: kunchenguid#8855 (comment). The fix is not committed or pushed yet, so the thread will show it only once the pipeline pushes. As you asked, I changed nothing for ci-1 (Full suite waiting on the full-ci label) and did not comment asking for the label

* test: make the Pi watch extension suite stable under machine load (kunchenguid#7789)

* test: wait on arm signals instead of fixed budgets in the Pi watch extension suite

* test: rerun unretired-successor scenarios lost to starved startup and bound hung-successor row counts

* no-mistakes(review): Bound Pi watch test polls and count hung-successor arm spawns

* test: rerun the unretired-successor scenario only when the successor never started

* no-mistakes(review): Rerun unretired-successor scenarios only after a delivered wake

* no-mistakes(ci): Stock macOS Bash snapshot compatibility (caused by this PR): stock Bash 3.2 failed to parse tests/fm-pi-watch-extension.test.sh ("line 2623: unexpected EOF while looking for matching `)'"). The PR added a comment with an unpaired apostrophe ("successor's") at two places, lines 2653 (Pi) and 5307 (OpenCode). Both are inside an out=$(... node <<'EOF' ... EOF) block. Bash 3.2 checks quotes inside $( ... ) even in a quoted heredoc, so it cannot find the closing parenthesis. Rule broken: text in a heredoc nested in $(...) must not contain an unpaired apostrophe. These were the only two lines the PR added with an apostrophe. Fix: both comments now say "arm row of the successor". The meaning is the same and no code or assertion changed. Checks run: bash -n (Bash 5.2) parses the file, and the full suite passes (exit 0, 69 ok lines, no "not ok"). Bash 3.2 is not available locally, so the macOS parse check could not be repeated here. A heredoc scan found three heredocs with odd apostrophe counts, and the same three are in the base commit, which passed this check, so the change adds no new cases. Only the macOS CI run can fully confirm the fix. Serial shards 1, 3, 4, 5, 6, 7 and 9 (not caused by this PR): the PR changes only tests/fm-pi-watch-extension.test.sh, which passed in shard 3 (exit=0). Each shard failed in a different unrelated script: fm-remote-secondmate-lifecycle-e2e, fm-public-followup, fm-record-export, fm-watch-checkpoint, fm-supervision-host, fm-remote-transport-lanes, fm-backend-rex, fm-pr-health, fm-contributions, fm-fleet-ledger and fm-herdr-groups. These are timing failures on a loaded runner and need a rerun, not a code change

* no-mistakes(test): Rerun late unretired-close cases when a starved successor is killed

* no-mistakes(test): Use shared wait deadline for remaining Pi test polls

* no-mistakes(ci): I fixed Greptile finding ci-2 in tests/fm-pi-watch-extension.test.sh. No product code or workflows changed. Two scratch files I made for the before/after check are still untracked: tests/.tmp-rerun-old.test.sh and tests/.tmp-rerun-regress.test.sh. My attempts to delete them were denied, so they must be deleted (or left out of the commit) before committing. Invariant: a retry attempt must not be able to see or keep alive a child left over from an earlier attempt. Where it applies: the retry loops in the Pi and OpenCode unretired-successor tests. Both reused one `log` and `release` file across attempts, so a TERM-ignoring successor from an attempt that exited 75 could write into the next attempt's log and throw off its row counts. The Pi and OpenCode late-close cases already gave each attempt its own files, so I left them alone. Fix: both unretired-successor tests now run their scenario through one new helper, `pi_rerun_until_started`. For each of up to five attempts it: - sets fresh files, `<prefix>-<attempt>.log` and `<prefix>-<attempt>.release`; - runs the scenario; - after an exit 75, sends SIGKILL to that attempt's node process group before retrying. The suite's per-node-run group is used for this, and the kill is guarded by the existing `pi_owned_group_live` check. This works because the plugins spawn arms without `detached`, so a surviving successor stays in that group. Regression test: `test_pi_rerun_stops_a_term_ignoring_successor_before_retrying` runs the helper itself. - Attempt 1 spawns a child that ignores TERM and keeps appending arm rows, then exits 75. - Attempt 2 fails if its own log gets any row, or if the attempt-1 child is still alive (not gone or a zombie) when the shared deadline runs out. - The oracle is the requirement itself: the next attempt starts with an empty log and no leftover child. - Run against a copy of the old pattern (shared files, no kill), it fails: "expected exit 0, got 1", because rows from attempt 1 leak into attempt 2's log. With the fix it passes. Verification: - `bash -n` and `shellcheck -x` on the file are clean. - The full suite, `bash tests/fm-pi-watch-extension.test.sh`, exits 0 with all 77 cases ok, including the check that the suite leaves no orphaned processes. ci-1 (the full-ci label guard) is outside the source, so I left it alone this round as instructed

* test: remove scratch copies of the Pi watch extension suite

* test: stop ShellCheck following the watcher in fm-watch-triage (kunchenguid#8859)

test_signal_paths_checkpoint_between_workers sources bin/fm-watch.sh in a
subshell without a source directive. ShellCheck follows the whole watcher
there and reports its assignments as subshell-local for the rest of the
file: 78 SC2031 notes and 1 SC2030 note, all false positives.

Use source=/dev/null, as the other tests do for production imports. The
watcher stays covered as its own lint root. ShellCheck then no longer sees
the code that uses this test's stubs and overrides, so it reports 5 SC2329
and 2 SC2034 findings. Suppress each at its definition.

Comments only; test behavior does not change.

Refs kunchenguid#8850

* test: run the fm-pr-check-security suite on macOS with GNU stat first on PATH (kunchenguid#8863)

file_mode() calls /usr/bin/stat on Darwin, and tests/lib.sh clears an inherited FM_CONTRIBUTIONS_REPLY_AGE.

* feat(bin): carry a linked issue as an explicit --closes field (kunchenguid#8517)

* feat(brief): carry a linked issue as an explicit --closes field

A no-mistakes ship worker drove the pipeline with plain `no-mistakes axi run`, so
the pipeline-written PR body named a fixed issue only as code and GitHub recorded
no closing reference. Add an opt-in --closes <issue> to fm-brief, fm-spawn and
fm-promote. The brief records closes=<n> on the Delivery contract line, spawn
records it in task meta for relaunch, and the drive instructions pass
--closes <n> on every run that starts a run. Under pr=manual the worker also
writes a plain Closes #<n> line into the PR body.

With the flag unset every generated brief and command is unchanged.

* fix(brief): drop --closes from the pr=manual drive instructions

no-mistakes refuses --closes together with --skip pr, and pr=manual skips pr,
so the instruction made every run on that path fail to start. The pr=manual
brief now names only the plain Closes line for the PR body the worker writes.

* refactor(bin): ask backends one capability question instead of matching names (kunchenguid#8783)

Add fm_backend_capability <backend> <cap> to bin/fm-backend.sh. Every
built-in backend answers it from one table, one row per backend. The
answers are static. An unknown backend, an unknown capability, or a
missing or malformed answer is refused with an error and no answer.

The capabilities are the ones core already branched on by name:
visible-capture, push, keys, state-verified, exit, relaunch, secondmate,
remote-secondmate, supervisor, and required-tools.

The per-name lists in fm-backend.sh, fm-control-lib.sh, fm-crew-state.sh,
fm-spawn.sh, fm-remote-secondmate-control.sh, fm-secondmate-liveness-lib.sh,
and fm-supervise-daemon.sh now ask the table. Every built-in backend gets
the same answer as before. Tests in tests/fm-backend.test.sh pin the table
to the old lists and check the refusals.

* fix: guard Antigravity swarm delegation (kunchenguid#8838)

* fix(agy): block native swarm delegation tool in subagent pretool guard

* no-mistakes(document): Update delegation guard documentation

* docs(agy): cite agy 1.5.18/1.5.19 native swarm tool in delegation guard

* no-mistakes(document): Document Antigravity swarm delegation guard

---------

Co-authored-by: Jess Telford <[email protected]>
Co-authored-by: YifuGu <[email protected]>
Co-authored-by: Kun Chen <[email protected]>
Co-authored-by: Shawn Kost <[email protected]>
Co-authored-by: Tim Kleinschmidt <[email protected]>
Co-authored-by: Robert Christensen <[email protected]>
Co-authored-by: Tiago <[email protected]>
Co-authored-by: 101space <[email protected]>
Co-authored-by: Mehul Bhagwani <[email protected]>
Co-authored-by: Pitch Perfekt Collective <[email protected]>
Co-authored-by: Symphony <[email protected]>
Co-authored-by: geanoro <[email protected]>
Co-authored-by: Ian Brown <[email protected]>
Co-authored-by: Cody <[email protected]>
Co-authored-by: AgardnerAU <[email protected]>
Co-authored-by: Gabriel Pagano <[email protected]>
Co-authored-by: Gurkirat Khaira <[email protected]>
Co-authored-by: screamyx <[email protected]>
screamyx added a commit to screamyx/firstmate that referenced this pull request Dec 1, 2026
* fix(bearings): stop truncating Charted Next titles and reasons on the lavish board (kunchenguid#6357)

* fix(bearings): show full Charted Next titles and reasons on the lavish board

Charted Next rows on the board clipped their title and reason with an
ellipsis, and the snapshot shortened gate titles before the board saw them.
Charted Next rows now wrap their full text, and the snapshot's new
--fields gate-text opt-in carries untruncated title_full and reason_full
for the board while the chat digest keeps its compact bounds.

* fix(bearings): keep secondmate Charted Next text whole across the home summary

A secondmate's home summary shortened queued titles to 120 characters and
hold or blocked reasons to 160 before the bearings projection saw them, so
--fields gate-text still handed the lavish board clipped text for secondmate
gates. The summary now keeps up to 500 characters for those fields, which
covers any realistic backlog item while 20 bounded rows stay far inside the
summary byte cap. The stock macOS Bash CI lane's pinned Bearings test count
moves to 61 for the gate-text regression.

* no-mistakes(review): Pass secondmate queued title and reasons untruncated

* test(bearings): expect untruncated queued text in the secondmate home summary

* fix(bin): exec the herdr lab server launch so a timed-out provision cancels it (kunchenguid#8779)

* fix(bin): exec the herdr lab server launch so a timed-out provision cancels it

On bash builds that keep a subshell for an async function (macOS /bin/bash
3.2, the Linux CI bash), $! of the backgrounded launch was that subshell, so
fm_herdr_lab_cancel_provision left the herdr server running after a timed-out
provision. The launch now execs herdr through fm_herdr_lab_raw_exec, making
$! the server process on every bash; the cancel is unchanged.

The timed-out provision test now asserts, right after the provision returns,
that the launch process is gone, synchronized on the launch recording its pid
instead of a fixed sleep.

Fixes kunchenguid#8775

* no-mistakes(document): Document lab provision timeout cleanup

---------

Co-authored-by: Kun Chen <[email protected]>

* feat(bin): choose a codex account per ship or scout from a declared list (kunchenguid#8457)

* feat(bin): choose a codex account per ship or scout from a declared list

Add config/codex-accounts, the Codex counterpart of config/claude-accounts:
one Codex home per line (ordinary for the default ~/.codex, or an absolute
CODEX_HOME). While the list exists, every Codex ship or scout spawn names one
declared entry with --account, chosen at intake by the quota-array-dispatch
procedure from bin/fm-codex-account-quota.sh rows. The entry is checked with
codex login status in a stripped environment, launched with CODEX_HOME set
(or unset for ordinary) and CODEX_API_KEY and CODEX_ACCESS_TOKEN unset,
recorded as account=, and reused by relaunch unless --account moves it.
Without the list every Codex launch is unchanged and --account refuses.

bin/fm-worker-account-lib.sh now keys the declared list, its root variable,
and its shed credentials by runner, and the per-account quota read moves into
bin/fm-account-quota-lib.sh shared by the Claude and Codex entry points.

* no-mistakes(ci): I fixed both Greptile findings, and the new tests for each fail before the fix and pass after it. ci-1, Codex secondmates (`bin/fm-worker-account-lib.sh`). The rule: a secondmate without its own account pin file (Codex) must never read `config/codex-accounts`. `fm_worker_account_select` now returns early for such a secondmate, right after it refuses an explicit `--account`, and before the list is parsed. So an empty, malformed or unreadable list no longer blocks the launch or a relaunch. I checked the other place that reads the list, `fm_worker_account_relaunch_request`: it already returns before the read when given a secondmate. Ships, scouts, Claude and Pi follow the same path as before. New test: `test_codex_account_list_leaves_secondmates_alone` in `tests/fm-worker-account.test.sh` now writes a malformed `config/codex-accounts` and checks that a Codex secondmate still launches unchanged (exit 0, no `account=`). Before the fix it was refused with "config/codex-accounts must hold one account per line". ci-2, quota timeout (`bin/fm-account-quota-lib.sh`). The rule: each Claude account read must still honor the old `FM_CLAUDE_ACCOUNT_QUOTA_SECONDS`. `fm_account_quota_report` now picks the per-read limit once: `FM_ACCOUNT_QUOTA_SECONDS` first, then `FM_CLAUDE_ACCOUNT_QUOTA_SECONDS` for Claude only, then 60. The old variable is documented in the lib header. New test: `test_the_claude_read_timeout_is_honored` in `tests/fm-claude-account-quota.test.sh` uses a fake quota-axi that takes 3 seconds. With `FM_CLAUDE_ACCOUNT_QUOTA_SECONDS=1` the account is reported unreadable. Adding `FM_ACCOUNT_QUOTA_SECONDS=10` overrides it and the account is measured. Checks: `tests/fm-worker-account.test.sh`, `tests/fm-claude-account-quota.test.sh` and `tests/fm-codex-account-quota.test.sh` all pass, and `shellcheck -x` is clean on the four changed files. I did not reply to or resolve any PR comment

* fix(watch): absorb turn-end wakes after a user-aborted no-mistakes run (kunchenguid#8708)

* feat(watch): opt-in absorb of turn-ends after an aborted run

An aborted no-mistakes run keeps current state at failed until a fresh run
starts, so every turn-end of a worker that kept working surfaced.
config/turnend-abort-absorb absorbs it only when the run store records an
abort and an exact busy verdict is newer than the run's end.

Fixes kunchenguid#8675

* no-mistakes(document): Document turnend-abort-absorb flag

* fix(watch): match the exact abort errors no-mistakes records

A gate abort fails the run with 'step <name>: aborted by user[: <reason>]'
and 'axi abort' cancels it with 'cancelled: aborted by user'. Match those
errors exactly and no longer treat a run cancelled by a new push as aborted.

* no-mistakes(review): Fix abort-absorb docs for cancelled runs

* fix(watch): take the abort-absorb busy state from the busy-state verdict

* fix(lint): clear ShellCheck findings the new classify sources expose

* fix(calm): pass Claude Code 2.1.326 strict plugin validation (kunchenguid#8565)

Claude Code 2.1.323+ type-checks the Calm mod without
allowImportingTsExtensions and ignores a plugin tsconfig, so
`claude plugin validate --strict` refused the mod (TS5097 on the
.ts import specifiers) and the mod's test fixtures drifted from the
engine's declarations. Keep the .ts specifiers Node needs behind
@ts-ignore TS5097, update the fixtures (Spinner suffix, UserMessage
isExpanded, fs.stat isLink, ui.blit cells variant), and record the
2.1.326 verification. Runtime behavior is unchanged.

Closes kunchenguid#8558

* fix: support newer Codex releases for native Stop parking (kunchenguid#8174)

* fix(codex): admit Stop-park releases from 0.163.0

* no-mistakes(document): Remove stale Codex version selection claim

* fix(bin): reach a Codex primary from its SessionStart hook depth

Codex publishes no harness marker, so the session start digest identifies a
Codex primary only through the ancestry walk in bin/fm-harness.sh. That walk
examined eight processes, while the installed Codex runs the tracked
SessionStart wrapper nine parents above the digest's harness probe (eleven
and thirteen for the wake drain and guard probes). The digest therefore
reported harness unknown and rendered the generic supervision block, while
the session lock walker, which examines sixteen processes, still named the
Codex session.

The harness walks now share one sixteen-process reach matching
fm_harness_ancestry_pids, so the digest verdict and the lock owner come from
walks of the same reach. Marker and ancestry precedence is unchanged.

The Pi rebuild cases in the session-open suite set only the Pi marker beneath
the suite's long-lived codex fixture, which the shorter walk never reached;
they now run beneath a pi-named process, as a real Pi session's hooks do.

Adds a portable depth regression, a composed SessionStart regression under a
renamed codex process, and a token-free live SessionStart case for the
installed Codex.

* docs(codex): align version policy and ancestry trial scope

* no-mistakes(document): Clarify Codex SessionStart release coverage

* no-mistakes(document): Correct Stop park script reference

* no-mistakes(document): Clarify Codex Stop park and startup coverage

* fix: support wrapped Claude composer readback (kunchenguid#8501)

* fix: read a wrapped typed line in a named Claude composer

In a Claude session started with a name, the session title is drawn into
the composer's top rule. A titled top rule was accepted only when the
prompt glyph row sat directly on the closing rule, so typed text that
wrapped onto a second row read unknown and could not be extracted. A
backend that reads back its typed payload before pressing Enter then
withheld Enter: on a pane narrower than the text, the send failed, or
the text stayed in the composer and blocked every later send.

Accept the wrap rows between the glyph row and the closing rule when
they are contiguous, non-blank, edge-free and within
FM_COMPOSER_PI_MAX_LINES. A glyph followed by a blank row or a longer
region before the next rule still reads unknown.

* no-mistakes(document): Document wrapped named Claude composer reads

* fix(bin): read the PR scan past a review wait on the same PR (kunchenguid#8786)

* fix(bin): read the PR scan past a review wait on the same PR

A worker may declare its review wait with a paused: line right after its
ready done: line. The scan treated that wait as a later crew line and never
recorded the PR or armed its merge poll. The scan now reads back over paused:
lines whose every PR URL is the ready PR, while a paused: line naming no PR or
another PR, and any working:, blocked: or failed: line, still stop it.

Fixes kunchenguid#8762

* no-mistakes(review): ignore punctuation around a PR URL in a paused line

* fix(bin): pin secondmate retirement process-event calls to the retiring home's state (kunchenguid#8785)

fm-teardown.sh ran the retiring home's fm-procevent.sh with only FM_HOME and
FM_ROOT_OVERRIDE, so an inherited FM_STATE_OVERRIDE sent preflight, sweep, and
reconcile to the parent's state root. Retirement then refused on the parent's
directory mode, or swept the parent's own registrations and left the child's.

Pass FM_STATE_OVERRIDE="$home/state" on all three calls, match the docs and
recovery command, and replace the fake sweep test with the real fm-procevent.sh
under a parent override at modes 775 and 700, checking the parent's source and
directory mode stay unchanged.

* feat(calm): add selectable spaceship working presentation (kunchenguid#8769)

* feat(calm): selectable spaceship working presentation via config/calm-ship

Add an optional spaceship variant for Calm's animated working row on Pi,
selected by the local config/calm-ship file.

- Add .pi/extensions/lib/fm-calm-working-spaceship.ts: a persistent banner
  under its own firstmate-calm-working-spaceship widget key, with an idle
  two-row saucer-over-hull rest pose drifting left to right, a single-row
  `=( * )` warp sprite while a run is thinking, a bounded settle ease back
  into the drift, freeze/resume continuity across hide and show, resize
  clamping, narrow fallbacks, and idle crew markers read from the home's
  state records on a slow tick.
- .pi/extensions/fm-calm.ts resolves config/calm-ship with the same
  effective-home and FM_CONFIG_OVERRIDE rules as config/calm, at extension
  load and again on session_start and /calm. Anything other than
  "spaceship", including an absent file, keeps the boat, which stays the
  default. The boat's own presentation path and its shared widget slot with
  standalone Pi Calm are unchanged; the spaceship is dispatched as a
  separate banner that owns its own slot, and a selection switch tears down
  the replaced variant before installing the new one.
- Document the variant in docs/calm.md and the config/calm-ship schema in
  docs/configuration.md.
- Cover selection, rendering, mode, settle, and freeze/resume in
  tests/fm-calm-pi-extension.test.sh, and add the new module to the
  typecheck fixture in tests/fm-pi-primary-types.test.sh.

Supersedes the earlier attempt in kunchenguid#5567, which was
closed unmerged on 2026-10-18 with a branch that had conflicted. This is a
fresh port onto current main, not a revival of that branch.

* no-mistakes(review): Remove crew markers, dead saucer code, fix doc

* no-mistakes(review): Document calm-ship Pi-only scope and trim rule

* no-mistakes(review): Copy spaceship into live e2e; poll drift check

* no-mistakes(review): Tear down spaceship banner on shutdown; map module

* no-mistakes(review): Gate spaceship banner to one agent run

* no-mistakes(review): Share working slot; drop dead spaceship code

* no-mistakes(review): Name both presentation modules in file header

* no-mistakes(document): Align Calm docs with selectable spaceship variant

* feat(pi): keep the spaceship banner for the whole session with idle drift

The selectable spaceship working presentation was scoped to one agent run,
which left Pi's stock working row in place the rest of the session. Make it
ambient: while Calm is active and config/calm-ship selects it, the banner is
installed at session_start and lives until session_shutdown, and the run signal
drives its mode instead of its visibility.

Idle shows the two-row resting pose, a three-cell (|) saucer directly over a
three-cell |^| hull, drifting one column every ~1.5s with a starfield streaming
left past it. A run switches the same banner into the single-row compact
=( * ) warp; the settle relaxes the pose, returns the starfield to the idle
cadence immediately, and eases the pace back into the drift over a bounded
handful of graduated moves.

The boat is unchanged and stays run-scoped. Both presentations still share the
one working-row slot, so a dual Calm install renders one animation and a
presentation another extension installed is left alone.

* no-mistakes(review): Document dual-Calm spaceship exception and tests

* no-mistakes(document): Correct Calm spaceship narrow-fallback wording

* no-mistakes(document): Remove stale spaceship widget-key export

* no-mistakes(document): Align Calm spaceship docs with ambient banner

* test(calm): keep the spaceship harness out of a Bash 3.2 command substitution

Stock macOS Bash 3.2 lexes a heredoc body nested in $(...) as shell text,
so a prose apostrophe inside the JS harness opened shell quoting there and
an unbalanced parenthesis ended the substitution early. The macOS parse
sweep then reported an unrelated later line as an unmatched backtick.

Attach the harness to a group command that redirects to an output file,
the shape every other node harness in this file already uses, and read the
captured output back afterwards. The fixture, the JS harness, and every
assertion are unchanged.

* no-mistakes(review): Narrow dual-install docs; test Calm toggle

* no-mistakes(document): Scope Calm spaceship lifetime claims to calm.md

* no-mistakes(ci): Addressed Greptile finding ci-1 in tests/fm-calm-pi-extension.test.sh. The "absent config/calm-ship" case previously wrote an empty file, so readFileSync still succeeded and the missing-file fallback was never exercised. It now removes the file with `rmSync(..., { force: true })` (imported alongside writeFileSync), and the existing boat assertions are unchanged (no stale widget after session_start, boat hull during the run, clean settle on agent_settled). No product code touched, and no sibling sites write an empty calm-ship file. Verified by running the suite directly with FM_PI_PACKAGE_DIR pointing at the Pi 1.6.1 package-layout shim: all cases pass, including the "working-spaceship modes and selection" case; the four tmux/pi interactive E2E cases skip because tmux is absent, as expected

* fix: keep watcher liveness beacon fresh during long cycles (kunchenguid#8823)

* fix(bin): refresh watcher beacon at progress checkpoints

* fix(watch): reject zero checkpoint interval

* no-mistakes(document): Align beacon comments with checkpoint behavior

* fix(watch): checkpoint signal triage progress

* no-mistakes(review): Checkpoint turn-end worker classification

* no-mistakes(document): Document watcher beacon checkpoint behavior

---------

Co-authored-by: Pitch Perfekt Collective <[email protected]>

* fix(omp): consume every watcher wake omp merges into one message (kunchenguid#8711)

omp joins several queued follow-ups into one prompt or one text part
separated by a blank line. consumeWake only finished a pending wake when
the whole text equalled its content, so merged wakes were never finished
and the same replacement handoff was replayed in every later session.
Each pending wake whose full content the text carries is now consumed,
once per occurrence.

* feat(bin): reclaim returned Treehouse pool slot disk at teardown (kunchenguid#8778)

* feat(bin): reclaim a returned Treehouse pool slot's disk at teardown

A returned pool slot keeps every git-ignored build artifact behind
(node_modules, .next, dist, Electron builds), so pools only ever grow
across finished tasks. Teardown now destroys a ship or scout task's own
returned slot by default, relying on treehouse destroy's safe-by-default
behavior so unlanded, dirty, or otherwise disposable-ineligible slots are
only skipped with a warning, never a teardown failure. Opt out home-wide
with config/keep-pool-slots.

* no-mistakes(review): Release slot owner claim before pool slot destroy

* no-mistakes(document): Document keep-pool-slots flag in home layout

* feat(bin): make pool-slot reclaim opt-in (config/reclaim-pool-slots)

Per maintainer review on the PR: invert the flag so destroying a
returned pool slot only happens when a home explicitly opts in, never
by default. An unconfigured teardown behaves exactly as before this
feature existed.

* no-mistakes(review): Fix home-layout skill reclaim flag name

* fix(rex): resolve the launcher session from REX_BLOCK (kunchenguid#8834)

* fix(rex): resolve the launcher session from REX_BLOCK

* no-mistakes(document): Drop stale REX_SESSION from comments

* no-mistakes(lint): Fix ShellCheck warnings in Rex tests

* perf(watch): cut program starts from the idle watcher poll (kunchenguid#8631)

An idle watcher poll starts many short-lived programs whose answers bash
can give itself. Replace them with builtins on the per-poll path, keeping
every result and error word the same:

- sign each status file once per scan and pass that signature to the
  seen check instead of signing it again
- on Darwin, read path state, size and identity with one stat instead of
  four or five, with the same fields and error words
- hex-encode plain-ASCII signature fields with printf -v instead of
  od | tr; any other byte keeps the od encoding
- read the presentation marker, turn-ended markers and the pane capture
  file with $(<file) instead of cat, and strip the pgid without tr
- read kind/backend/harness from a window's meta with one builtin loop
  instead of grep | cut, keeping every value of a repeated key
- skip rm for per-window markers that do not exist (fm_rm_present, same
  exit status as rm -f; a dangling symlink still counts as present)
- skip mkdir of an existing state dir and dirname at library load

Measured with one method: a PATH-shim tracer that logs every program
start (absolute-path calls routed through the shims via BASH_ENV), on
macOS with /bin/bash 3.2, against a synthetic idle home (10
already-reported status files, tmux panes printing a clock, FM_POLL=3).
Each figure is the start count of one steady idle poll (polls after the
first two, between watcher beacon touches) in a 40-second traced run;
every steady poll in a run had the same count. Base is 427056c, the
other side is this commit, both exported from git:

- no task windows: 195 -> 86 starts per poll (-56%)
- four task windows: 291 -> 130 starts per poll (-55%)

An earlier measurement of part of this work reported 102 -> 72 and
170 -> 116 with the same tracer; those pairs differ because they measured
a different baseline - a tree that already had the first half of these
changes - and only the second half on top of it, so they are not quoted
here.

status_observed_signature output is byte-identical before and after on
72 fixture cases (regular, empty, symlinked, dangling, non-ASCII and
invalid-byte targets, directory, unreadable, FIFO, missing; LC_ALL=C and
UTF-8) under bash 3.2 and 5.3.

Not measured: Herdr panes, Linux, wake/drain/ack turns, the periodic
check and home-summary runs, and forks that do not exec.

The inactive-reconcile per-poll fast path and the procevent uname/id
caching are left to kunchenguid#7329 and kunchenguid#7349, which already propose them.

Refs kunchenguid#7330

* fix: classify Pi credential-less launch rejection (kunchenguid#8848)

* feat(watch): wake on an arrived captain-hold --until date (kunchenguid#8469)

* feat(watch): wake on an arrived captain-hold --until date (kunchenguid#8444)

Behind the existing opt-in config/open-decision-reminders flag, queue one
check wake per main-home captain hold and --until date when the date arrives.
A durable ledger keeps a watcher restart from refiring a recorded pair.

* no-mistakes(review): Skip Done rows in captain hold wake

* no-mistakes(document): Document captain-hold date wake skips Done rows

* no-mistakes(ci): Throttle failed captain-hold reads and bound them

* docs(watch): list captain hold date wake in the header reason index (kunchenguid#8444)

* test(wake-queue): retry lock directory removal in waiter test (kunchenguid#7901)

* test: retry removal of a lock directory the waiter still writes

The waiter creates owner directories inside the state directory while
it waits. One rm -rf can lose that race, leave the directory in place,
and let the waiter return 0.

On origin/main the test matches the copy that failed in CI run
https://github.com/kunchenguid/firstmate/actions/runs/40652730373
(job "Behavior portable serial 3"):
rm: cannot remove '/tmp/fm-wake-tests.ckX5w2/lock-dir-removed/state': Directory not empty
not ok - the lock wait over a removed directory returned 0, not 1

Locally, fm_lock_owner_dir against rm -rf printed "Directory not empty"
3 times in 300 tries. The unfixed test passed 40/40 because the race
did not land. The fixed test passed 20/20. A removal that never
succeeds fails with "the lock directory survived 50 removal retries".

* test(wake-queue): rename the lock directory before the bounded removal retry

* fix(bin): resolve the Rex launcher session on Rex 0.1.0 (kunchenguid#8855)

* fix(rex): resolve the launcher session on Rex 0.1.0

Rex 0.1.0 rejects a block id as a session.view target, so a Firstmate
running directly in a Rex terminal could not spawn any task and skipped
per-home session cleanup. Resolve the launcher from REX_SESSION when set,
refusing when that session does not hold REX_BLOCK exactly once; otherwise
walk the session list for the single session holding the block, and keep
the block-target call only as a fallback when the list cannot be read.
The refusal now names its reason and the next step.

Fixes kunchenguid#8842

* no-mistakes(review): Make real-Rex smoke no-walk assertion detect flagged ls calls

* no-mistakes(review): Require a matching session_id before confirming the Rex launcher block

* no-mistakes(review): Warn when secondmate placement skips an unresolved Rex launcher

* no-mistakes(review): Stop blaming Rex build in inventory-unreadable refusal

* no-mistakes(review): Restore test coverage for retirement's launcher-session exclusion

* no-mistakes(test): Document Rex launcher behaviour for builds 1758 and 2181

* no-mistakes(document): Clarify Rex per-home session fallback wording

* no-mistakes(ci): I fixed ci-2 (Greptile: unreadable session views were silently skipped). The rule being broken: before placing anything, Firstmate must confirm that REX_BLOCK appears exactly once inside the chosen session, so a session whose view can't be read must never count as "no match". There are three places that read a view, and two already followed this rule. The REX_SESSION path refuses when fm_backend_rex_view_holds_block fails, and the legacy block-target fallback refuses when it can't parse the view. Only the session-list walk in fm_backend_rex_sessions_holding_block treated an exit-0 view it couldn't parse as a non-match and moved on. Fix (bin/backends/rex.sh): in the walk, after a session.view exits 0, the response must be valid JSON whose `.session_id` matches the listed session before the exactly-once check runs. If it isn't, the walk returns 1, and fm_backend_rex_launcher_session refuses with "a live session's view could not be read". I updated the function comment to match. I added no new helpers or branches. Tests: - The fake fixture (tests/rex-fake-fixture.sh) has a new `view-garbled` switch. It holds a session id, and that session's view exits 0 with truncated JSON. - tests/fm-backend-rex.test.sh has a new case where the other session's view is garbled. Resolution must refuse with that reason. Without the fix, the walk would skip the garbled session and resolve to the launcher session. - The existing walked-view-without-session_id case now expects that same unreadable-view refusal, in line with the earlier decision that a view without session_id is unresolved on every path. When I removed the fix temporarily, that assertion failed, and the whole file passed again once I put it back. Results: tests/fm-backend-rex.test.sh passes with exit code 0 (42 tests ok). `/opt/homebrew/bin/shellcheck -x` is clean on all three changed files. I ran no other suites. I replied on the Greptile thread that it is fixed: kunchenguid#8855 (comment). The fix is not committed or pushed yet, so the thread will show it only once the pipeline pushes. As you asked, I changed nothing for ci-1 (Full suite waiting on the full-ci label) and did not comment asking for the label

* test: make the Pi watch extension suite stable under machine load (kunchenguid#7789)

* test: wait on arm signals instead of fixed budgets in the Pi watch extension suite

* test: rerun unretired-successor scenarios lost to starved startup and bound hung-successor row counts

* no-mistakes(review): Bound Pi watch test polls and count hung-successor arm spawns

* test: rerun the unretired-successor scenario only when the successor never started

* no-mistakes(review): Rerun unretired-successor scenarios only after a delivered wake

* no-mistakes(ci): Stock macOS Bash snapshot compatibility (caused by this PR): stock Bash 3.2 failed to parse tests/fm-pi-watch-extension.test.sh ("line 2623: unexpected EOF while looking for matching `)'"). The PR added a comment with an unpaired apostrophe ("successor's") at two places, lines 2653 (Pi) and 5307 (OpenCode). Both are inside an out=$(... node <<'EOF' ... EOF) block. Bash 3.2 checks quotes inside $( ... ) even in a quoted heredoc, so it cannot find the closing parenthesis. Rule broken: text in a heredoc nested in $(...) must not contain an unpaired apostrophe. These were the only two lines the PR added with an apostrophe. Fix: both comments now say "arm row of the successor". The meaning is the same and no code or assertion changed. Checks run: bash -n (Bash 5.2) parses the file, and the full suite passes (exit 0, 69 ok lines, no "not ok"). Bash 3.2 is not available locally, so the macOS parse check could not be repeated here. A heredoc scan found three heredocs with odd apostrophe counts, and the same three are in the base commit, which passed this check, so the change adds no new cases. Only the macOS CI run can fully confirm the fix. Serial shards 1, 3, 4, 5, 6, 7 and 9 (not caused by this PR): the PR changes only tests/fm-pi-watch-extension.test.sh, which passed in shard 3 (exit=0). Each shard failed in a different unrelated script: fm-remote-secondmate-lifecycle-e2e, fm-public-followup, fm-record-export, fm-watch-checkpoint, fm-supervision-host, fm-remote-transport-lanes, fm-backend-rex, fm-pr-health, fm-contributions, fm-fleet-ledger and fm-herdr-groups. These are timing failures on a loaded runner and need a rerun, not a code change

* no-mistakes(test): Rerun late unretired-close cases when a starved successor is killed

* no-mistakes(test): Use shared wait deadline for remaining Pi test polls

* no-mistakes(ci): I fixed Greptile finding ci-2 in tests/fm-pi-watch-extension.test.sh. No product code or workflows changed. Two scratch files I made for the before/after check are still untracked: tests/.tmp-rerun-old.test.sh and tests/.tmp-rerun-regress.test.sh. My attempts to delete them were denied, so they must be deleted (or left out of the commit) before committing. Invariant: a retry attempt must not be able to see or keep alive a child left over from an earlier attempt. Where it applies: the retry loops in the Pi and OpenCode unretired-successor tests. Both reused one `log` and `release` file across attempts, so a TERM-ignoring successor from an attempt that exited 75 could write into the next attempt's log and throw off its row counts. The Pi and OpenCode late-close cases already gave each attempt its own files, so I left them alone. Fix: both unretired-successor tests now run their scenario through one new helper, `pi_rerun_until_started`. For each of up to five attempts it: - sets fresh files, `<prefix>-<attempt>.log` and `<prefix>-<attempt>.release`; - runs the scenario; - after an exit 75, sends SIGKILL to that attempt's node process group before retrying. The suite's per-node-run group is used for this, and the kill is guarded by the existing `pi_owned_group_live` check. This works because the plugins spawn arms without `detached`, so a surviving successor stays in that group. Regression test: `test_pi_rerun_stops_a_term_ignoring_successor_before_retrying` runs the helper itself. - Attempt 1 spawns a child that ignores TERM and keeps appending arm rows, then exits 75. - Attempt 2 fails if its own log gets any row, or if the attempt-1 child is still alive (not gone or a zombie) when the shared deadline runs out. - The oracle is the requirement itself: the next attempt starts with an empty log and no leftover child. - Run against a copy of the old pattern (shared files, no kill), it fails: "expected exit 0, got 1", because rows from attempt 1 leak into attempt 2's log. With the fix it passes. Verification: - `bash -n` and `shellcheck -x` on the file are clean. - The full suite, `bash tests/fm-pi-watch-extension.test.sh`, exits 0 with all 77 cases ok, including the check that the suite leaves no orphaned processes. ci-1 (the full-ci label guard) is outside the source, so I left it alone this round as instructed

* test: remove scratch copies of the Pi watch extension suite

* test: stop ShellCheck following the watcher in fm-watch-triage (kunchenguid#8859)

test_signal_paths_checkpoint_between_workers sources bin/fm-watch.sh in a
subshell without a source directive. ShellCheck follows the whole watcher
there and reports its assignments as subshell-local for the rest of the
file: 78 SC2031 notes and 1 SC2030 note, all false positives.

Use source=/dev/null, as the other tests do for production imports. The
watcher stays covered as its own lint root. ShellCheck then no longer sees
the code that uses this test's stubs and overrides, so it reports 5 SC2329
and 2 SC2034 findings. Suppress each at its definition.

Comments only; test behavior does not change.

Refs kunchenguid#8850

* test: run the fm-pr-check-security suite on macOS with GNU stat first on PATH (kunchenguid#8863)

file_mode() calls /usr/bin/stat on Darwin, and tests/lib.sh clears an inherited FM_CONTRIBUTIONS_REPLY_AGE.

* feat(bin): carry a linked issue as an explicit --closes field (kunchenguid#8517)

* feat(brief): carry a linked issue as an explicit --closes field

A no-mistakes ship worker drove the pipeline with plain `no-mistakes axi run`, so
the pipeline-written PR body named a fixed issue only as code and GitHub recorded
no closing reference. Add an opt-in --closes <issue> to fm-brief, fm-spawn and
fm-promote. The brief records closes=<n> on the Delivery contract line, spawn
records it in task meta for relaunch, and the drive instructions pass
--closes <n> on every run that starts a run. Under pr=manual the worker also
writes a plain Closes #<n> line into the PR body.

With the flag unset every generated brief and command is unchanged.

* fix(brief): drop --closes from the pr=manual drive instructions

no-mistakes refuses --closes together with --skip pr, and pr=manual skips pr,
so the instruction made every run on that path fail to start. The pr=manual
brief now names only the plain Closes line for the PR body the worker writes.

* refactor(bin): ask backends one capability question instead of matching names (kunchenguid#8783)

Add fm_backend_capability <backend> <cap> to bin/fm-backend.sh. Every
built-in backend answers it from one table, one row per backend. The
answers are static. An unknown backend, an unknown capability, or a
missing or malformed answer is refused with an error and no answer.

The capabilities are the ones core already branched on by name:
visible-capture, push, keys, state-verified, exit, relaunch, secondmate,
remote-secondmate, supervisor, and required-tools.

The per-name lists in fm-backend.sh, fm-control-lib.sh, fm-crew-state.sh,
fm-spawn.sh, fm-remote-secondmate-control.sh, fm-secondmate-liveness-lib.sh,
and fm-supervise-daemon.sh now ask the table. Every built-in backend gets
the same answer as before. Tests in tests/fm-backend.test.sh pin the table
to the old lists and check the refusals.

* fix: guard Antigravity swarm delegation (kunchenguid#8838)

* fix(agy): block native swarm delegation tool in subagent pretool guard

* no-mistakes(document): Update delegation guard documentation

* docs(agy): cite agy 1.5.18/1.5.19 native swarm tool in delegation guard

* no-mistakes(document): Document Antigravity swarm delegation guard

* fix(bin): bound SSH connection setup for remote secondmates (kunchenguid#8446)

* fix(bin): bound remote SSH connect timeout in fm-on.sh

Add -o ConnectTimeout to bin/fm-on.sh (default 15 s), overridable via
FM_SSH_CONNECT_TIMEOUT and validated as a positive integer. Document the
override alongside keepalive settings in docs/configuration.md and
docs/remote-secondmates.md. Add regression tests in tests/fm-on.test.sh
including real unreachable-host failure with a non-routable address.

Closes kunchenguid#6400

* no-mistakes(review): Make SSH timeout regression deterministic with loopback listener

* no-mistakes(document): Clarify SSH timeout settings and documentation ownership

* no-mistakes(ci): Captain, added `unset FM_SSH_BIN` at test startup, preserving the silent-peer case’s scoped override. Reproduced the failure before the fix; the complete fm-on suite now passes with FM_SSH_BIN=/usr/bin/false inherited. Focused lint, shell syntax, and diff checks passed

---------

Co-authored-by: mehulbhagwani <[email protected]>

* fix(session-start): keep the context re-emit under the hook output cap (kunchenguid#8554)

* fix(session-start): keep the context re-emit under the hook output cap

A context re-emit after a compaction or clear reprinted the whole digest,
which can be several times a harness's hook output cap. The harness then
saved it to a file, and the cue told the model to read that whole file,
spending most of the room the compaction had just freed.

The re-emit now keeps the lock, wake queue and its acknowledgement, away
posture, and network checks inline, and prints the supervision block,
backlog, task meta, status tails, and context files as one-line pointers
to their file or command. The cue says to read a pointed file only when
the turn needs it. A full session start is unchanged.

Refs kunchenguid#7991

* no-mistakes(review): Keep re-emit per-task lines short; fix NEXT STEP cue

* no-mistakes(document): Describe the compact re-emit digest in the nudge doc

* fix(session-start): shell-quote the re-emit supervision command

The context re-emit printed the supervision instructions command with
the home path and script path unquoted, so a path with a space split
into separate words and the printed command failed. Quote each value
with printf %q, and add a test that runs the printed command from a
home path that contains a space.

* Disable composer predictions in the omp worker overlay (kunchenguid#8875)

* omp worker 关闭 composer 自动预测

* no-mistakes(document): Document omp worker overlay composer predictions pin

* fix(bearings): prevent board template horizontal overflow on narrow screens (kunchenguid#8874)

* 舰队看板窄屏不再横向溢出

* no-mistakes(review): Add overflow-wrap anywhere for repo and row-id labels in narrow board CSS

* no-mistakes(review): Align narrow-board media-query selector lists: drop no-op .bb-brand__wm/.bb-row__main, add .bb-row__pr to overflow-wrap

* no-mistakes(review): Drop dead .bb-row__id selector from narrow-board media query lists

* no-mistakes(review): Remove non-overflow chrome declarations from narrow-board 640px media query

* fix(bin): make the whole-file open-decision fold scale with log size (kunchenguid#8098)

* fix(bin): fold whole status logs without per-transition subshells

The whole-file open-decision fold (status_open_decisions) cost grew with
transition lines times open-set size. Every needs-decision, blocked,
resolved, done, or failed line ran _fm_decision_fold_line in a command
substitution that made about four more, and _fm_decision_drop rebuilt the
whole open set through a here-document, which bash 3.2 writes to a temp
file. A persistent secondmate never gets a terminal reset, so its open set
only grows: on a real 2,935-line log with 117 open decisions (269 KB of
notes) one fold took about 2 minutes, and the fleet snapshot runs it
serially per task, so `fm-fleet-snapshot.sh --secondmate-home-summary`
took about 210 s and the home-summary refresh could not finish inside its
60-second deadline. The same fold inside fm-crew-state.sh also timed out
at its 10-second bound, so such a secondmate read as unknown.

Changes:
- _fm_decision_fold_action is now the one statement of the open/close
  rule. It classifies a line as none, clear, open, or close without
  forking.
- _fm_decision_fold_line keeps its interface and text-set mechanics, so
  the cursor-backed fold and other callers behave as before.
- status_open_decisions applies the actions to an in-memory key/record
  array, with no per-line subshell and no temp-file copy of the set.
- _fm_decision_key, status_line_note, and _fm_key_at_note_head take an
  optional out-variable, the convention status_line_verb already uses.
  Existing callers are unchanged.

Verification:
- Old and new whole-file folds are byte-identical on 13 real status logs
  (0 to 3,208 lines). Total fold time went from 170.7 s to 5.5 s, and the
  2-minute log above now folds in 2.4 s.
- The home summary of that fleet went from 208 s to 30 s, with an
  identical document apart from observation timestamps.
- A new case in tests/fm-classify-decision-key.test.sh pins that the
  whole-file fold's subprocess work does not grow with transitions (it
  fails on the previous code: 383 -> 312017) and pins open order against
  the cursor-backed fold.
- Existing fold, drain, watch, crew-state, and snapshot suites pass.
  bin/fm-lint.sh passes on both changed files.

* no-mistakes(document): Point fold doc comments at _fm_decision_fold_action

* no-mistakes(document): Point fold doc comments at _fm_decision_fold_action

* fix: stop review-park from stopping workers waiting on their own job (kunchenguid#8882)

* fix(park): do not park a worker that declared a wait for its own job

Parking accepted any declared paused: wait, so it could stop a worker
whose background job was still running. The generated instructions now
tell workers to tag that wait paused [wait=job], and fm-park.sh refuses
such a lane. The watcher also stops hiding an overdue declared wait
behind a pending park record whose stop is not confirmed.

* no-mistakes(review): Re-check job wait before stop; tag brief waits

* no-mistakes(review): Read past supervisor lines for job waits

* no-mistakes(review): Fix job-wait temp file and watcher tests

* no-mistakes(review): Make pending park watcher test fail without fix

* no-mistakes(lint): Quote done in park test loop (SC1010)

* no-mistakes(lint): Rename loop variable in job-wait tag test

* no-mistakes(ci): Keep caller's fake tmux command in until_watch

* fix(bin): start Firstmate's herdr server as a session leader (kunchenguid#8623)

* fix(herdr): start Firstmate's herdr server as a session leader

herdr derives capabilities.detached_server_daemon once, at server start,
from getsid(0) == getpid(), and `herdr machine add` refuses to save a
host whose server reports false ("remote server is not ready for saved
machines"). fm_backend_herdr_server_ensure started the server as a plain
background job, so it stayed in its caller's session (the SSH
daemon's session on a remote host) and reported false.

- bin/backends/herdr.sh: start the server through a new
  fm_backend_herdr_session_leader helper (setsid(1) where present, perl
  POSIX::setsid on macOS, forking first only for a process-group leader),
  using the same client fm_backend_herdr_cli selects for the session.
  Correct the comment that claimed the server launch was exec'd.
- bin/fm-remote-doctor.sh: add a non-gating `note:` check state and a
  herdr-detached note for a running server reporting
  detached_server_daemon=false. Its Linux action is the marker-guarded
  live handoff, never a stop; on darwin no repair is offered because
  launchd keeps launch-agent jobs in its own session.
- tests: a fake-herdr regression proving the started server leads its
  own session (with a control proving a plain background job does not),
  doctor note cases for Linux and darwin, a slot-free fake server launch
  so the canned-response container test no longer races the launch, and
  a real-herdr smoke assertion on the reported capability.

* no-mistakes(document): Note Herdr server launch bypasses CLI helper

* fix(bin): re-pin the trusted remote doctor identity to the updated doctor

* no-mistakes(review): Keep doctor notes out of readiness failure reasons

* fix(bin): guard the herdr live-handoff marker exclusively and shell-quote its path

---------

Co-authored-by: Artem Ananchenko <[email protected]>
Co-authored-by: Artem Ananchenko <[email protected]>

---------

Co-authored-by: Jess Telford <[email protected]>
Co-authored-by: YifuGu <[email protected]>
Co-authored-by: Kun Chen <[email protected]>
Co-authored-by: Shawn Kost <[email protected]>
Co-authored-by: Tim Kleinschmidt <[email protected]>
Co-authored-by: Robert Christensen <[email protected]>
Co-authored-by: Tiago <[email protected]>
Co-authored-by: 101space <[email protected]>
Co-authored-by: Mehul Bhagwani <[email protected]>
Co-authored-by: Pitch Perfekt Collective <[email protected]>
Co-authored-by: Symphony <[email protected]>
Co-authored-by: geanoro <[email protected]>
Co-authored-by: Ian Brown <[email protected]>
Co-authored-by: Cody <[email protected]>
Co-authored-by: AgardnerAU <[email protected]>
Co-authored-by: Gabriel Pagano <[email protected]>
Co-authored-by: Gurkirat Khaira <[email protected]>
Co-authored-by: mehulbhagwani <[email protected]>
Co-authored-by: c6aw <[email protected]>
Co-authored-by: 潭渊 <[email protected]>
Co-authored-by: Michal Moravčík <[email protected]>
Co-authored-by: Artem Ananchenko <[email protected]>
Co-authored-by: Artem Ananchenko <[email protected]>
Co-authored-by: Artem Ananchenko <[email protected]>
Co-authored-by: screamyx <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

full-ci Maintainer go-ahead: run the full CI suite on this outside pull request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants