Skip to content

feat(zellij): add a live crew supervisor tab - #1189

Closed
lmansf wants to merge 10 commits into
kunchenguid:mainfrom
lmansf:fm/crew-panes-gate-h4-r1
Closed

lmansf wants to merge 10 commits into
kunchenguid:mainfrom
lmansf:fm/crew-panes-gate-h4-r1

Conversation

@lmansf

@lmansf lmansf commented Jul 28, 2026

Copy link
Copy Markdown

Intent

Publish the zellij supervisor pane feature: push branch fm/crew-panes-gate-h4-r1, open the PR, and continue through CI.

What Changed

  • bin/backends/zellij.sh gains a display-only supervisor surface: fm_backend_zellij_supervisor_reconcile builds one fm-supervisor-<home-label> tab per home with an fm-<id> pane for each active non-secondmate zellij crew, closes the tab when no such crew remains, and re-resolves the tab by name when new-tab reports no id (closing supervisor-titled tabs it cannot pin to exactly one). Pane commands travel through an explicit env allow-list that forwards the caller-resolved FM_STATE_OVERRIDE/FM_DATA_OVERRIDE/FM_PROJECTS_OVERRIDE/FM_CONFIG_OVERRIDE so discovery and rendering read the same home.
  • New bin/fm-supervisor-panes.sh (discover zellij crews for the current session, then reconcile) and bin/fm-supervisor-pane-loop.sh (render header, run state, and bounded fm-peek.sh output until the task metadata disappears, peeking with FM_GUARD_READ_ONLY=1). The loop keeps two cadences — cheap redraw/peek on FM_SUPERVISOR_REFRESH_SECS and the expensive fm-crew-state.sh lookup on FM_SUPERVISOR_STATE_REFRESH_SECS, each stamped with its own timestamp. Reconcile is wired best-effort into fm-spawn.sh, fm-teardown.sh, and the locked path of fm-session-start.sh; it no-ops for every other backend.
  • Documented the surface and the FM_SUPERVISOR_REFRESH_SECS / FM_SUPERVISOR_STATE_REFRESH_SECS / FM_SUPERVISOR_PEEK_LINES knobs in docs/zellij-backend.md, docs/configuration.md, docs/scripts.md, docs/architecture.md, and the runtime-backends verification log; added tests/fm-supervisor-panes.test.sh plus new reconcile, tab-id recovery, and real-zellij smoke assertions in the existing zellij test suites.

Risk Assessment

✅ Low: The final delta is a small, self-consistent display fix - the run-state stamp is captured in the same block that refreshes the line it labels, docs match the rendered output exactly, and the new test asserts the real cached-stamp invariant - on top of a feature that stays confined to the explicit-only zellij backend behind failure-tolerant lifecycle hooks.

Testing

Exercised the zellij supervisor pane feature end-to-end against a real zellij 0.44.3 server plus the three targeted automated suites, focusing on the hardening the previous round asked for. The unit and real-zellij smoke suites pass, including the new tests that cover the silent-new-tab recovery and the new smoke assertions that pin its root cause. The key evidence is a deterministic reproduction of the round-1 race run against both the pre-fix adapter and this branch: pre-fix leaves a silently broken partial supervisor tab (exit=1, one pane titled with the raw env ... command, no pane for the still-active crew), while this branch recovers the tab id by name and produces a correct tab with fm-alpha and fm-bravo panes and live supervisor output, at exit=0. Reviewer-visible visual evidence is a PNG of a real attached zellij client showing both outcomes side by side. The happy-path lifecycle is unregressed and the failure did not recur across 21 race runs; one run left only a cosmetic stale pane title that the next reconcile heals, recorded as an informational note. The pre-existing fm-session-start tangle-diagnostic failure is unchanged and treated as unrelated per the author's instruction.

  • Evidence: Before/after: real zellij client attached to the supervisor tab after the torn-down-seed race (local file: /tmp/no-mistakes-evidence/01KYMB64GSBTCNWNZ0W4PGW17D/torn-down-seed-race.png)
Evidence: Rendered HTML version of the same before/after comparison
<!doctype html>
<meta charset="utf-8">
<title>zellij supervisor tab: torn-down seed pane race</title>
<style>
  * { box-sizing: border-box; }
  body { margin: 0; padding: 26px 30px 34px; background: #0d1117; color: #e6edf3;
         font: 14px/1.5 system-ui, -apple-system, sans-serif; }
  h1 { margin: 0 0 6px; font-size: 20px; letter-spacing: -.2px; }
  .lede { margin: 0 0 22px; color: #9198a1; font-size: 13.5px; max-width: 1500px; }
  .lede code { color: #cdd9e5; background: #161b22; padding: 1px 5px; border-radius: 4px;
                font-family: "DejaVu Sans Mono", ui-monospace, monospace; font-size: 12.5px; }
  .panel { border: 1px solid #30363d; border-radius: 9px; margin-bottom: 20px;
            overflow: hidden; background: #010409; min-width: 0; }
  .panel.bad { border-color: #6e2c2c; }
  .panel.good { border-color: #2c6e42; }
  .head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap;
           padding: 10px 14px; background: #161b22; border-bottom: 1px solid #30363d; }
  .badge { font-weight: 650; font-size: 13px; padding: 2px 9px; border-radius: 999px; }
  .bad .badge { background: #4a1d1d; color: #ffb0a8; }
  .good .badge { background: #14401f; color: #7ee787; }
  .sub { color: #9198a1; font-size: 12.5px; }
  pre { margin: 0; padding: 14px 16px; overflow-x: auto;
         font-family: "DejaVu Sans Mono", ui-monospace, monospace;
         font-size: 11.5px; line-height: 1.28; color: #d7dde8; white-space: pre; }
</style>
<body>
  <h1>Real zellij 0.44.3 client attached to the supervisor tab, after the torn-down-seed race</h1>
  <p class="lede">
    The race: <code>fm-spawn</code>/<code>fm-teardown</code> scan the active crews, then reconcile.
    If the first task in that list is torn down in between, its pane loop
    (<code>while [ -f state/&lt;id&gt;.meta ]</code>) exits at once, and
    <code>zellij action new-tab --close-on-exit</code> then prints <em>no id</em> while still creating the tab.
    Both screens below were captured on a 150&times;34 pty by attaching a real client after
    <code>fm_backend_zellij_supervisor_reconcile &lt;session&gt; alpha bravo</code> with <code>alpha.meta</code> already removed.
    Colors are dropped by the capture; text and layout are verbatim.
  </p>
  
  <section class="panel bad">
    <div class="head">
      <span class="badge">BEFORE (2e51b48, parent of the fix)</span>
      <span class="sub">reconcile exit=1 - the supervisor tab exists but its only pane still renders the raw env command as its frame title, and crew bravo has no pane at all. Every call site discards the error, so the captain sees no warning.</span>
    </div>
    <pre> Zellij (fm-torn-seed-before-322409)  Tab #1  fm-firstmate-81bfa1e2-alpha  fm-firstmate-81bfa1e2-bravo  fm-supervisor-firstmate-81bfa1e2 
┌ env FM_ROOT_OVERRIDE=/home/crow/snap/codex/34/.no-mistakes/worktrees/57[..]0251c82/01KYMB64GSBTCNWNZ0W4PGW17D/bin/fm-supervisor-pane-loop.sh alpha ┐
│                                                                                                                                                    │
│                                                                                                                                                    │
│                                                                                                                                                    │
│                                                                                                                                                    │
│                                                                                                                                                    │
│                                                                                                                                                    │
│                                                                                                                                                    │
│                                                                                                                                                    │
│                                                                                                                                                    │
│                                                                                                                                                    │
│                                                                                                                                                    │
│                                                                                                                                                    │
│                                                                                                                                                    │
│                                                                                                                                                    │
│                                                                                                                                                    │
│                                                                                                                                                    │
│                                                                                                                                                    │
│                                                                                                                                                    │
│                                                                                                                                                    │
│                                                                                                                                                    │
│                                                                                                                                                    │
│                                                                                                                                                    │
│                                                                                                                                                    │
│                                                                                                                                                    │
│                                                                                                                                                    │
│                                                                                                                                                    │
│                                                                                                                                                    │
│                                                                                                                                                    │
│                                                                                                                                                    │
│                                                                                                                                                    │
└────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
 Ctrl + &lt;g&gt; LOCK  &lt;p&gt; PANE  &lt;t&gt; TAB  &lt;n&gt; RESIZE  &lt;h&gt; MOVE  &lt;s&gt; SEARCH  &lt;o&gt; SESSION  &lt;q&gt; QUIT  Alt +  &lt;n&gt; New Pane  &lt;f&gt; Floating </pre>
  </section>
  
  <section class="panel good">
    <div class="head">
      <span class="badge">AFTER (842930f, this branch)</span>
      <span class="sub">reconcile exit=0 - the tab id is re-resolved by name, the seed pane is titled fm-alpha, and the still-active crew bravo gets its live supervisor pane.</span>
    </div>
    <pre> Zellij (fm-torn-seed-after-326569)  ← +2  fm-firstmate-81bfa1e2-bravo  fm-supervisor-firstmate-81bfa1e2                  Alt &lt;[]&gt;  VERTICAL 
┌ fm-alpha ───────────────────────────────────────────────────────────────┐┌ fm-bravo ─────────────────────────────────────────────── SCROLL:  0/150 ┐
│0 q                                                                      ││Firstmate Supervisor                                                     │
│                                                                         ││Task: fm-bravo                                                           │
│                                                                         ││Kind: scout                                                              │
│                                                                         ││Backend: zellij                                                          │
│                                                                         ││Project: demo-bravo                                                      │
│                                                                         ││Peek observed: 2026-07-28 09:30:05 EDT                                   │
│                                                                         ││state: unknown · source: none · worktree gone (torn down?) · run state as│
│                                                                         ││ of 09:29:49 EDT                                                         │
│                                                                         ││                                                                         │
│                                                                         ││●━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ │
│                                                                         ││●  WATCHER DOWN - SUPERVISION IS OFF                                     │
│                                                                         ││●  1 task(s) in flight, but no watcher has a fresh beacon (last beat: nev│
│                                                                         ││er, grace 300s).                                                         │
│                                                                         ││●  This read-only session should report the lapse, not repair it.        │
│                                                                         ││●  This is a supervision warning only; the guarded operation WILL still r│
│                                                                         ││un.                                                                      │
│                                                                         ││●  Watcher repair belongs to the session holding the fleet lock; do not d│
│                                                                         ││rain, arm, or repair from this read-only session.                        │
│                                                                         ││●━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ │
│                                                                         ││To run a command as administrator (user &quot;root&quot;), use &quot;sudo &lt;command&gt;&quot;.   │
│                                                                         ││See &quot;man sudo_root&quot; for details.                                         │
│                                                                         ││                                                                         │
│                                                                         ││crow@Owl:~/.no-mistakes/worktrees/57ae20251c82/0crow@Owl:~/.no-mistakes/w│
│                                                                         ││orktrees/57ae20251c82/01KYMB64GSBTCNWNZ0W4PGW17D$ echo &#x27;[bravo] crewmate │
│                                                                         ││working: running tests...&#x27;                                               │
│                                                                         ││crow@Owl:~/.no-mistakes/worktrees/57ae20251c82/01KYMB64GSBTCNWNZ0W4PGW17D│
│                                                                         ││$                                                                        │
│                                                                         ││                                                                         │
│                                                                         ││                                                                         │
│                                                                         ││                                                                         │
└─────────────────────────────────────────────────────────────────────────┘└─────────────────────────────────────────────────────────────────────────┘
 Ctrl + &lt;g&gt; LOCK  &lt;p&gt; PANE  &lt;t&gt; TAB  &lt;n&gt; RESIZE  &lt;h&gt; MOVE  &lt;s&gt; SEARCH  &lt;o&gt; SESSION  &lt;q&gt; QUIT                                      ...</pre>
  </section>
</body>
Evidence: Reconcile transcript under the race: pre-fix (2e51b48) vs this branch (842930f)

$ fm_backend_zellij_supervisor_reconcile <session> alpha bravo # with alpha.meta removed under it --- BEFORE (2e51b48, parent of the fix) --- exit=1 stderr: error: zellij supervisor tab did not return a numeric tab id for 'fm-supervisor-firstmate-81bfa1e2' (got '') tab 3 pane 3 title=env FM_ROOT_OVERRIDE=... bash .../bin/fm-supervisor-pane-loop.sh alpha RESULT(before): BROKEN - partial supervisor tab left behind (raw-command pane=1, fm-bravo panes=0) --- AFTER (842930f, this branch) --- exit=0 stderr: (none) tab 3 pane 3 title=fm-alpha tab 3 pane 4 title=fm-bravo RESULT(after): OK - no raw-command pane, and the surviving crew bravo has its supervisor pane

$ fm_backend_zellij_supervisor_reconcile <session> alpha bravo   # with alpha.meta removed under it

--- BEFORE (2e51b48, parent of the fix) ---
### 3. fm_backend_zellij_supervisor_reconcile fm-torn-seed-before-322409 alpha bravo
exit=1
stderr/stdout: error: zellij supervisor tab did not return a numeric tab id for 'fm-supervisor-firstmate-81bfa1e2' (got '')
### 4. what the captain's zellij session actually looks like now
{"tab_id":0,"name":"Tab #1"}
{"tab_id":1,"name":"fm-firstmate-81bfa1e2-alpha"}
{"tab_id":2,"name":"fm-firstmate-81bfa1e2-bravo"}
{"tab_id":3,"name":"fm-supervisor-firstmate-81bfa1e2"}
supervisor tabs matching the expected title: [3 ]
--- every non-plugin pane, with its rendered frame title ---
tab 0 pane 0 title=Pane #1
tab 1 pane 1 title=Pane #1
tab 2 pane 2 title=Pane #1
tab 3 pane 3 title=env FM_ROOT_OVERRIDE=/home/crow/snap/codex/34/.no-mistakes/worktrees/57ae20251c82/01KYMB64GSBTCNWNZ0W4PGW17D FM_HOME=/tmp/no-mistakes-evidence/01KYMB64GSBTCNWNZ0W4PGW17D/home-torn-before FM_STATE_OVERRIDE=/tmp/no-mistakes-evidence/01KYMB64GSBTCNWNZ0W4PGW17D/home-torn-before/state FM_DATA_OVERRIDE=/tmp/no-mistakes-evidence/01KYMB64GSBTCNWNZ0W4PGW17D/home-torn-before/data FM_PROJECTS_OVERRIDE=/tmp/no-mistakes-evidence/01KYMB64GSBTCNWNZ0W4PGW17D/home-torn-before/projects FM_CONFIG_OVERRIDE=/tmp/no-mistakes-evidence/01KYMB64GSBTCNWNZ0W4PGW17D/home-torn-before/config FM_SUPERVISOR_REFRESH_SECS=3 FM_SUPERVISOR_STATE_REFRESH_SECS=30 FM_SUPERVISOR_PEEK_LINES=6 bash /home/crow/snap/codex/34/.no-mistakes/worktrees/57ae20251c82/01KYMB64GSBTCNWNZ0W4PGW17D/bin/fm-supervisor-pane-loop.sh alpha
### 5. verdict
panes still showing the raw `env ... fm-supervisor-pane-loop.sh` command as their title: 1
supervisor panes titled fm-bravo (the other still-active crew): 0
RESULT(before): BROKEN - partial supervisor tab left behind (raw-command pane=1, fm-bravo panes=0)

--- AFTER (842930f, this branch) ---
### 3. fm_backend_zellij_supervisor_reconcile fm-torn-seed-after-326569 alpha bravo
exit=0
stderr/stdout: (none)
### 4. what the captain's zellij session actually looks like now
{"tab_id":0,"name":"Tab #1"}
{"tab_id":1,"name":"fm-firstmate-81bfa1e2-alpha"}
{"tab_id":2,"name":"fm-firstmate-81bfa1e2-bravo"}
{"tab_id":3,"name":"fm-supervisor-firstmate-81bfa1e2"}
supervisor tabs matching the expected title: [3 ]
--- every non-plugin pane, with its rendered frame title ---
tab 0 pane 0 title=Pane #1
tab 1 pane 1 title=Pane #1
tab 2 pane 2 title=Pane #1
tab 3 pane 3 title=fm-alpha
tab 3 pane 4 title=fm-bravo
### 5. verdict
panes still showing the raw `env ... fm-supervisor-pane-loop.sh` command as their title: 0
supervisor panes titled fm-bravo (the other still-active crew): 1
RESULT(after): OK - no raw-command pane, and the surviving crew bravo has its supervisor pane
Evidence: Real-zellij smoke assertions pinning the new-tab contract the recovery rests on
$ bash tests/fm-backend-zellij-smoke.test.sh
ok - real zellij: new-tab echoes no id for an instantly-exiting command yet creates the tab (recoverable by name)
ok - real zellij: supervisor tab candidates exclude the just-closed tab ids
Evidence: Full pre-fix race run log (adapter pinned to 2e51b48)

### 0. variant under test
variant : before
adapter : /tmp/no-mistakes-evidence/01KYMB64GSBTCNWNZ0W4PGW17D/repo-before/bin/backends/zellij.sh
zellij  : zellij 0.44.3
session : fm-torn-seed-before-322409
expected supervisor tab title: fm-supervisor-firstmate-81bfa1e2

### 1. start the isolated session and two real crew tabs (alpha, bravo)
crew alpha  -> tab 1 pane 1
crew bravo  -> tab 2 pane 2

### 2. the race: alpha is torn down AFTER the caller scanned [alpha bravo]
remaining metas: bravo.meta 
the seed pane command 'fm-supervisor-pane-loop.sh alpha' will now exit at once

### 3. fm_backend_zellij_supervisor_reconcile fm-torn-seed-before-322409 alpha bravo
exit=1
stderr/stdout: error: zellij supervisor tab did not return a numeric tab id for 'fm-supervisor-firstmate-81bfa1e2' (got '')

### 4. what the captain's zellij session actually looks like now
{"tab_id":0,"name":"Tab #1"}
{"tab_id":1,"name":"fm-firstmate-81bfa1e2-alpha"}
{"tab_id":2,"name":"fm-firstmate-81bfa1e2-bravo"}
{"tab_id":3,"name":"fm-supervisor-firstmate-81bfa1e2"}
supervisor tabs matching the expected title: [3 ]
--- every non-plugin pane, with its rendered frame title ---
tab 0 pane 0 title=Pane #1
tab 1 pane 1 title=Pane #1
tab 2 pane 2 title=Pane #1
tab 3 pane 3 title=env FM_ROOT_OVERRIDE=/home/crow/snap/codex/34/.no-mistakes/worktrees/57ae20251c82/01KYMB64GSBTCNWNZ0W4PGW17D FM_HOME=/tmp/no-mistakes-evidence/01KYMB64GSBTCNWNZ0W4PGW17D/home-torn-before FM_STATE_OVERRIDE=/tmp/no-mistakes-evidence/01KYMB64GSBTCNWNZ0W4PGW17D/home-torn-before/state FM_DATA_OVERRIDE=/tmp/no-mistakes-evidence/01KYMB64GSBTCNWNZ0W4PGW17D/home-torn-before/data FM_PROJECTS_OVERRIDE=/tmp/no-mistakes-evidence/01KYMB64GSBTCNWNZ0W4PGW17D/home-torn-before/projects FM_CONFIG_OVERRIDE=/tmp/no-mistakes-evidence/01KYMB64GSBTCNWNZ0W4PGW17D/home-torn-before/config FM_SUPERVISOR_REFRESH_SECS=3 FM_SUPERVISOR_STATE_REFRESH_SECS=30 FM_SUPERVISOR_PEEK_LINES=6 bash /home/crow/snap/codex/34/.no-mistakes/worktrees/57ae20251c82/01KYMB64GSBTCNWNZ0W4PGW17D/bin/fm-supervisor-pane-loop.sh alpha

### 4b. what a captain SEES: attach a real zellij client and capture the screen
captured -> /tmp/no-mistakes-evidence/01KYMB64GSBTCNWNZ0W4PGW17D/torn-down-screen-before.txt

### 5. verdict
panes still showing the raw `env ... fm-supervisor-pane-loop.sh` command as their title: 1
supervisor panes titled fm-bravo (the other still-active crew): 0
RESULT(before): BROKEN - partial supervisor tab left behind (raw-command pane=1, fm-bravo panes=0)
Evidence: Full this-branch race run log

### 0. variant under test
variant : after
adapter : /home/crow/snap/codex/34/.no-mistakes/worktrees/57ae20251c82/01KYMB64GSBTCNWNZ0W4PGW17D/bin/backends/zellij.sh
zellij  : zellij 0.44.3
session : fm-torn-seed-after-326569
expected supervisor tab title: fm-supervisor-firstmate-81bfa1e2

### 1. start the isolated session and two real crew tabs (alpha, bravo)
crew alpha  -> tab 1 pane 1
crew bravo  -> tab 2 pane 2

### 2. the race: alpha is torn down AFTER the caller scanned [alpha bravo]
remaining metas: bravo.meta 
the seed pane command 'fm-supervisor-pane-loop.sh alpha' will now exit at once

### 3. fm_backend_zellij_supervisor_reconcile fm-torn-seed-after-326569 alpha bravo
exit=0
stderr/stdout: (none)

### 4. what the captain's zellij session actually looks like now
{"tab_id":0,"name":"Tab #1"}
{"tab_id":1,"name":"fm-firstmate-81bfa1e2-alpha"}
{"tab_id":2,"name":"fm-firstmate-81bfa1e2-bravo"}
{"tab_id":3,"name":"fm-supervisor-firstmate-81bfa1e2"}
supervisor tabs matching the expected title: [3 ]
--- every non-plugin pane, with its rendered frame title ---
tab 0 pane 0 title=Pane #1
tab 1 pane 1 title=Pane #1
tab 2 pane 2 title=Pane #1
tab 3 pane 3 title=fm-alpha
tab 3 pane 4 title=fm-bravo

### 4b. what a captain SEES: attach a real zellij client and capture the screen
captured -> /tmp/no-mistakes-evidence/01KYMB64GSBTCNWNZ0W4PGW17D/torn-down-screen-after.txt

### 5. verdict
panes still showing the raw `env ... fm-supervisor-pane-loop.sh` command as their title: 0
supervisor panes titled fm-bravo (the other still-active crew): 1
RESULT(after): OK - no raw-command pane, and the surviving crew bravo has its supervisor pane

### 6. live content of the recovered supervisor tab's panes
--- tab 3 pane 3 ---
--- tab 3 pane 4 ---
Firstmate Supervisor
Task: fm-bravo
Kind: scout
Backend: zellij
Project: demo-bravo
Peek observed: 2026-07-28 09:29:49 EDT
state: unknown · source: none · worktree gone (torn down?) · run state as of 09:29:49 EDT
●━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
●  WATCHER DOWN - SUPERVISION IS OFF
●  1 task(s) in flight, but no watcher has a fresh beacon (last beat: never, grace 300s).
●  This read-only session should report the lapse, not repair it.
●  This is a supervision warning only; the guarded operation WILL still run.
●  Watcher repair belongs to the session holding the fleet lock; do not drain, arm, or repair from this read-only session.
●━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
To run a command as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.
crow@Owl:~/.no-mistakes/worktrees/57ae20251c82/0crow@Owl:~/.no-mistakes/worktrees/57ae20251c82/01KYMB64GSBTCNWNZ0W4PGW17D$ echo '[bravo] crewmate working: running tests...'
[bravo] crewmate working: running tests...
crow@Owl:~/.no-mistakes/worktrees/57ae20251c82/01KYMB64GSBTCNWNZ0W4PGW17D$
Firstmate Supervisor
Task: fm-bravo
Kind: scout
Backend: zellij
Project: demo-bravo
Peek observed: 2026-07-28 09:29:52 EDT
state: unknown · source: none · worktree gone (torn down?) · run state as of 09:29:49 EDT
●━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
●  WATCHER DOWN - SUPERVISION IS OFF
●  1 task(s) in flight, but no watcher has a fresh beacon (last beat: never, grace 300s).
●  This read-only session should report the lapse, not repair it.
●  This is a supervision warning only; the guarded operation WILL still run.
●  Watcher repair belongs to the session holding the fleet lock; do not drain, arm, or repair from this read-only session.
●━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
To run a command as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.
crow@Owl:~/.no-mistakes/worktrees/57ae20251c82/0crow@Owl:~/.no-mistakes/worktrees/57ae20251c82/01KYMB64GSBTCNWNZ0W4PGW17D$ echo '[bravo] crewmate working: running tests...'
[bravo] crewmate working: running tests...
crow@Owl:~/.no-mistakes/worktrees/57ae20251c82/01KYMB64GSBTCNWNZ0W4PGW17D$
Firstmate Supervisor
Task: fm-bravo
Kind: scout
Backend: zellij
Project: demo-bravo
Peek observed: 2026-07-28 09:29:56 EDT
state: unknown · source: none · worktree gone (torn down?) · run state as of 09:29:49 EDT
●━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
●  WATCHER DOWN - SUPERVISION IS OFF
●  1 task(s) in flight, but no watcher has a fresh beacon (last beat: never, grace 300s).
●  This read-only session should report the lapse, not repair it.
●  This is a supervision warning only; the guarded operation WILL still run.
●  Watcher repair belongs to the session holding the fleet lock; do not drain, arm, or repair from this read-only session.
●━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
To run a command as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.
crow@Owl:~/.no-mistakes/worktrees/57ae20251c82/0crow@Owl:~/.no-mistakes/worktrees/57ae20251c82/01KYMB64GSBTCNWNZ0W4PGW17D$ echo '[bravo] crewmate working: running tests...'
crow@Owl:~/.no-mistakes/worktrees/57ae20251c82/01KYMB64GSBTCNWNZ0W4PGW17D$
Firstmate Supervisor
Task: fm-bravo
Kind: scout
Backend: zellij
Project: demo-bravo
Peek observed: 2026-07-28 09:29:59 EDT
state: unknown · source: none · worktree gone (torn down?) · run state as of 09:29:49 EDT
●━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
●  WATCHER DOWN - SUPERVISION IS OFF
●  1 task(s) in flight, but no watcher has a fresh beacon (last beat: never, grace 300s).
●  This read-only session should report the lapse, not repair it.
●  This is a supervision warning only; the guarded operation WILL still run.
●  Watcher repair belongs to the session holding the fleet lock; do not drain, arm, or repair from this read-only session.
●━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
To run a command as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.
crow@Owl:~/.no-mistakes/worktrees/57ae20251c82/0crow@Owl:~/.no-mistakes/worktrees/57ae20251c82/01KYMB64GSBTCNWNZ0W4PGW17D$ echo '[bravo] crewmate working: running tests...'
crow@Owl:~/.no-mistakes/worktrees/57ae20251c82/01KYMB64GSBTCNWNZ0W4PGW17D$
Firstmate Supervisor
Task: fm-bravo
Kind: scout
Backend: zellij
Project: demo-bravo
Peek observed: 2026-07-28 09:30:02 EDT
state: unknown · source: none · worktree gone (torn down?) · run state as of 09:29:49 EDT
●━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
●  WATCHER DOWN - SUPERVISION IS OFF
●  1 task(s) in flight, but no watcher has a fresh beacon (last beat: never, grace 300s).
●  This read-only session should report the lapse, not repair it.
●  This is a supervision warning only; the guarded operation WILL still run.
●  Watcher repair belongs to the session holding the fleet lock; do not drain, arm, or repair from this read-only session.
●━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
To run a command as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.
crow@Owl:~/.no-mistakes/worktrees/57ae20251c82/0crow@Owl:~/.no-mistakes/worktrees/57ae20251c82/01KYMB64GSBTCNWNZ0W4PGW17D$ echo '[bravo] crewmate working: running tests...'
crow@Owl:~/.no-mistakes/worktrees/57ae20251c82/01KYMB64GSBTCNWNZ0W4PGW17D$
Firstmate Supervisor
Task: fm-bravo
Kind: scout
Backend: zellij
Project: demo-bravo
Peek observed: 2026-07-28 09:30:05 EDT
state: unknown · source: none · worktree gone (torn down?) · run state as of 09:29:49 EDT
●━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
●  WATCHER DOWN - SUPERVISION IS OFF
●  1 task(s) in flight, but no watcher has a fresh beacon (last beat: never, grace 300s).
●  This read-only session should report the lapse, not repair it.
●  This is a supervision warning only; the guarded operation WILL still run.
●  Watcher repair belongs to the session holding the fleet lock; do not drain, arm, or repair from this read-only session.
●━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
To run a command as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.
crow@Owl:~/.no-mistakes/worktrees/57ae20251c82/0crow@Owl:~/.no-mistakes/worktrees/57ae20251c82/01KYMB64GSBTCNWNZ0W4PGW17D$ echo '[bravo] crewmateworking: running tests...'
crow@Owl:~/.no-mistakes/worktrees/57ae20251c82/01KYMB64GSBTCNWNZ0W4PGW17D$
- Evidence: Happy-path supervisor lifecycle e2e at HEAD (build, shrink on teardown, remove when no crews remain) (local file: /tmp/no-mistakes-evidence/01KYMB64GSBTCNWNZ0W4PGW17D/supervisor-e2e-happy-path-at-head.log)
Evidence: Race repeat stability, batches 1 and 2
Repeat stability: the torn-down-seed race, 6 consecutive runs against a real zellij 0.44.3 server.
Each run: two real crew tabs, alpha.meta removed, then reconcile <session> alpha bravo.

run 1: exit=0 | RESULT(after): OK - no raw-command pane, and the surviving crew bravo has its supervisor pane
run 2: exit=0 | RESULT(after): BROKEN - partial supervisor tab left behind (raw-command pane=1, fm-bravo panes=1)
run 3: exit=0 | RESULT(after): OK - no raw-command pane, and the surviving crew bravo has its supervisor pane
run 4: exit=0 | RESULT(after): OK - no raw-command pane, and the surviving crew bravo has its supervisor pane
run 5: exit=0 | RESULT(after): OK - no raw-command pane, and the surviving crew bravo has its supervisor pane
run 6: exit=0 | RESULT(after): OK - no raw-command pane, and the surviving crew bravo has its supervisor pane
- Evidence: Seed-rename residual probe: 8 rounds, each followed by the next lifecycle reconcile (local file: /tmp/no-mistakes-evidence/01KYMB64GSBTCNWNZ0W4PGW17D/seed-rename-residual.log) - Evidence: Race reproduction harness (runs either adapter, captures a real attached client) (local file: /tmp/no-mistakes-evidence/01KYMB64GSBTCNWNZ0W4PGW17D/torn-down-seed-e2e.sh) - Outcome: ⚠️ 1 info across 2 runs (43m16s)

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

🔧 **Review** - 5 issues found → auto-fixed (2) ✅
  • ⚠️ bin/fm-supervisor-pane-loop.sh:31 - The 5s default refresh makes each supervisor pane do heavy work continuously. Every cycle calls fm-crew-state.sh, which for kind=ship runs no-mistakes axi status inside the crew worktree with a 10s timeout (bin/fm-crew-state.sh:459) plus several git rev-parse/merge-base calls and a backend busy probe, and then fm-peek.sh, which runs fm-guard.sh (more git) and a zellij dump-screen capture. That is roughly 2 no-mistakes CLI invocations plus ~6 git and 2 dump-screen calls per crew per 5 seconds, indefinitely, and it keeps running even when no zellij client is attached (the docs themselves note a headless session reports no active tab). With a fleet of N crews this is ~12N no-mistakes invocations per minute against the same pipeline CLI the crews are validating with. Consider a much larger default (15-30s), or skipping the expensive run-state lookup on most cycles, rather than the peek-only path.
  • ℹ️ bin/backends/zellij.sh:387 - The pane env allow-list hardcodes FM_STATE_OVERRIDE=$FM_HOME/state (and the data/projects/config equivalents) instead of forwarding the values the caller actually resolved. bin/fm-supervisor-panes.sh:8 discovers task ids from ${FM_STATE_OVERRIDE:-$FM_HOME/state}, so when FM_STATE_OVERRIDE points anywhere other than $FM_HOME/state the reconciler builds panes for ids it found in the override dir while each pane loop looks for $FM_HOME/state/<id>.meta, fails the while [ -f &#34;$META&#34; ] guard on the first iteration, and exits; with --close-on-exit every pane closes the instant it is created, leaving an empty (or immediately drained) supervisor tab. Forward ${FM_STATE_OVERRIDE:-$FM_HOME/state} etc. so discovery and rendering always agree. Only reachable in override-based harnesses today, which is why this is info rather than a blocker.
  • ℹ️ bin/backends/zellij.sh:135 - The pane-id shape validation added by commit 8299614 aborts reconcile with a specific stderr message, but all three call sites redirect stderr to /dev/null and swallow the exit status (bin/fm-spawn.sh:1543, bin/fm-teardown.sh:1235, bin/fm-session-start.sh:308). In production a new-pane that echoes something other than terminal_<id> therefore leaves a partially built supervisor tab (seed pane only, remaining crews silently absent) with no diagnostic anywhere; the validation is only observable from the tests. The tab is rebuilt on the next lifecycle event, so this is a diagnosability note rather than a defect - worth knowing if the tab is ever reported as incomplete.
  • ℹ️ bin/backends/zellij.sh:424 - Reconcile always closes the existing supervisor tab and recreates it from scratch, even when the active crew set is unchanged - e.g. spawning a tmux crew in a home that also has zellij crews, or the fm-session-start.sh locked path. Every rebuild restarts all pane loops and triggers a synchronized burst of per-crew no-mistakes axi status / git / dump-screen calls, and discards whatever the operator had on screen. An early exit when the live pane titles already equal the expected fm-<id> set would make the common case a no-op. Deliberate simplicity tradeoff, noted rather than blocking.
  • ℹ️ bin/backends/zellij.sh:436 - Reconcile takes no lock, and zellij does not enforce unique tab names (documented at bin/backends/zellij.sh:312). Two overlapping lifecycle events (e.g. a watcher-driven teardown while an agent spawns) can both read list-tabs before either creates its tab, and each then creates its own fm-supervisor-&lt;hometag&gt; tab with a full pane set - transiently doubling the supervisor tabs and the background pane-loop load. It self-heals on the next reconcile, since tabs_by_name closes every tab matching the name, so this is a transient-state note.

🔧 Fix: split supervisor pane cadences and forward resolved override dirs
2 infos still open:

  • ℹ️ bin/fm-supervisor-pane-loop.sh:97 - The pane prints a freshly-computed Observed: &lt;now&gt; line immediately above the run-state line, but after the cadence split that state line can be up to STATE_REFRESH_SECS (60s by default) old while the timestamp and the peek output below it are current. A reader naturally attributes the one timestamp to everything under it, so a crew that parked or hit needs-decision 50 seconds ago still reads as state: working under a timestamp that says now. Cheap fix: stamp the state line when it is actually refreshed (capture date inside the if block at line 58 and render it with the line, e.g. … (as of HH:MM:SS)), or reword Observed: so it clearly labels the peek only. Display wording is user-facing, so flagging rather than fixing.
  • ℹ️ tests/fm-supervisor-panes.test.sh:155 - The new cadence test runs the real loop in the background and asserts against wall clock: with FM_SUPERVISOR_REFRESH_SECS=1 it sleeps 3s and requires at least 2 peek calls (expected 3-4) and, in the second pass, at least 2 state calls. The exact states = 1 assertion is structurally deterministic (STATE_REFRESH=3600), but the -ge 2 assertions have only ~1.5-2x headroom, so a heavily loaded runner could flake. It also adds roughly 6-16s of wall clock to the portable-serial lane across the two invocations. Acceptable as written - noted so the shape is a known suspect if this test ever goes intermittent.

🔧 Fix: stamp supervisor run-state line separately from redraw
✅ Re-checked - no issues remain.

⚠️ **Test** - 1 info
  • ⚠️ bin/backends/zellij.sh:434 - Intermittent supervisor-tab reconcile failure observed once in 10 real-zellij reconcile cycles: zellij action new-tab echoed an empty tab id, so fm_backend_zellij_supervisor_reconcile printed "supervisor tab did not return a numeric tab id" and returned 1 before renaming the seed pane or creating the remaining panes. Because every call site runs the reconciler as &gt;/dev/null 2&gt;&amp;1 || true, the captain sees no error - only a supervisor tab whose seed pane is titled with the raw env FM_ROOT_OVERRIDE=... bash .../fm-supervisor-pane-loop.sh alpha command line and no pane for the other active crew, until the next spawn/teardown/session-start reconcile heals it. Not reproducible on demand (9 subsequent cycles, including a dedicated 5-round teardown-race probe, were clean); it appeared under first-run cold-start load while two pane loops were doing real fm-crew-state/fm-peek work. Evidence: /tmp/no-mistakes-evidence/01KYMB64GSBTCNWNZ0W4PGW17D/observed-intermittent-reconcile-failure.log. Whether to add a retry/second-chance lookup for the tab id is a product call, not a test fix.
  • ℹ️ tests/fm-session-start.test.sh:629 - tests/fm-session-start.test.sh fails on "read-only bootstrap did not surface the tangle diagnostic". This is pre-existing and unrelated to this branch: the identical assertion fails when the same test is run from a clean export of base commit fa0d85d. Noting it so the failure is not attributed to the supervisor-pane change.
  • bin/fm-test-run.sh tests/fm-supervisor-panes.test.sh tests/fm-backend-zellij.test.sh tests/fm-backend-zellij-smoke.test.sh (all pass, including the real-zellij smoke)
  • bin/fm-test-run.sh tests/fm-session-start.test.sh tests/fm-teardown.test.sh (teardown passes; session-start's read-only tangle case fails)
  • Re-ran bin/fm-test-run.sh tests/fm-session-start.test.sh from a clean git archive fa0d85d export to confirm that failure is pre-existing
  • Manual end-to-end: supervisor-e2e.sh against a live zellij 0.44.3 server on an isolated session - two real crew tabs via fm_backend_zellij_create_task, metas written, then bin/fm-supervisor-panes.sh
  • zellij action list-tabs --json / list-panes --json to verify the fm-supervisor-&lt;hometag&gt; tab and its fm-alpha / fm-bravo pane titles, and that secondmate and tmux crews were excluded
  • zellij action dump-screen --pane-id &lt;id&gt; --full on each supervisor pane to read the live rendered panel (header, kind/backend/project, run-state line, crew peek output)
  • Attached a real zellij client on a 150x44 pty (pty_capture.py) and captured the composed supervisor tab screen, rendered to supervisor-tab-screenshot.png
  • Cadence check: three timed dump-screen probes showing Peek observed advancing every ~3s while the cached run state as of stamp held for the 30s state interval
  • Lifecycle checks: removed one crew meta then reconciled (tab rebuilt with only fm-alpha), removed the last meta then reconciled (supervisor tab removed)
  • probe-teardown-race.sh (5 rounds) and probe-newtab-after-close.sh (5 rounds) to test the reproducibility of the one observed reconcile failure

🔧 Fix: recover supervisor tab id when zellij new-tab prints none
1 info still open:

  • ℹ️ bin/backends/zellij.sh:528 - Residual observed once in 21 real-zellij race runs: after the recovery path re-resolves the tab id, the best-effort seed-pane rename occasionally does not land, leaving that one pane titled with the raw env ... fm-supervisor-pane-loop.sh &lt;id&gt; command. This is materially smaller than the round-1 finding and does not reproduce it: reconcile still returned exit=0, and the still-active crew's pane (fm-bravo) WAS built, so no live crew loses its supervisor pane. The stale title belongs to the crew that was already torn down, and a dedicated 8-round probe (seed-rename-residual.log) shows the next lifecycle reconcile rebuilds the tab cleanly. The rename is deliberately best-effort and documented as such in the adapter ("Cosmetic, so it is best-effort: a missing pane id or a failed rename never fails reconcile"), so this is informational - noting the observed frequency, not asking for a change before publishing. Evidence: /tmp/no-mistakes-evidence/01KYMB64GSBTCNWNZ0W4PGW17D/torn-down-seed-repeat.log (run 2) and seed-rename-residual.log.
  • bash tests/fm-backend-zellij.test.sh — full adapter suite, including the new test_supervisor_reconcile_recovers_a_silent_new_tab_id and test_supervisor_reconcile_closes_the_partial_tab_when_the_id_stays_unresolvable
  • bash tests/fm-supervisor-panes.test.sh — supervisor pane reconcile, lifecycle hooks, pane-loop cadences and guard read-only mode
  • bash tests/fm-backend-zellij-smoke.test.sh — real zellij 0.44.3 on an isolated throwaway session, including the two new assertions that new-tab echoes no id for an instantly-exiting command yet creates the tab, and that fm_backend_zellij_supervisor_tab_candidates excludes just-closed tab ids
  • Manual e2e race reproduction against a real zellij server, run against BOTH adapters: bash torn-down-seed-e2e.sh before (adapter pinned to 2e51b48) and bash torn-down-seed-e2e.sh after (HEAD) — two real crew tabs, alpha.meta removed, then fm_backend_zellij_supervisor_reconcile &lt;session&gt; alpha bravo
  • Real attached-client screen capture of the resulting supervisor tab for both variants on a 150x34 pty (pty_capture.py), rendered into a before/after PNG
  • bash supervisor-e2e.sh at HEAD — happy-path lifecycle: build supervisor tab with one pane per active crew, shrink to one pane after tearing one crew down, remove the tab once no zellij crew remains
  • 21 total race runs for stability: torn-down-seed-repeat.log (6), torn-down-seed-repeat-batch2.log (6), and probe-seed-rename-residual.sh 8 which also verifies the next lifecycle reconcile heals any residual
  • bash tests/fm-session-start.test.sh — confirmed the only failure is the same pre-existing read-only bootstrap did not surface the tangle diagnostic assertion already accepted as unrelated
⚠️ **Document** - 2 infos
  • ℹ️ tests/fm-supervisor-panes.test.sh - tests/fm-supervisor-panes.test.sh is committed mode 100644 while every other tests/*.test.sh is 100755; bin/fm-test-run.sh invokes tests as bash &#34;$script&#34;, so CI is unaffected, but direct invocation fails with 'Permission denied'. Out of scope for the documentation phase (executable-bit change, not docs) - flagging for the test-owning phase.
  • ℹ️ bin/backends/cmux.sh:30 - bin/backends/cmux.sh's header says 'docs/cmux-backend.md has the full evidence log', but that doc has no evidence log - the owner is docs/verification/runtime-backends.md, the same stale pointer I corrected in bin/backends/zellij.sh. Untouched by this change, so left alone rather than widening the diff; worth a one-line follow-up fix.
⚠️ **Lint** - 1 warning
  • ⚠️ linter found issues (exit code 127)
✅ **Push** - passed

✅ No issues found.

@lmansf
lmansf force-pushed the fm/crew-panes-gate-h4-r1 branch from 9a5d792 to e21076b Compare August 3, 2026 05:12
@kunchenguid

kunchenguid commented Aug 5, 2026 •

Copy link
Copy Markdown
Owner

Automated reminder: thanks for the PR! This branch currently has a merge conflict with the base branch.

When you get a chance, please rebase onto (or merge) the latest base branch, resolve the conflict, and push. After that, checks will re-run and the PR will get looked at again.

Noted for firstmate#1189 at e21076b8.

@kunchenguid kunchenguid added wheelhouse:pending-contributor-action Managed by Wheelhouse and removed wheelhouse:pending-contributor-action Managed by Wheelhouse labels Aug 5, 2026
@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate: closing this as stale. It has been waiting on a contributor update for 14+ days with no author push or comment. Reopen if you want to pick it back up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants