Skip to content

feat(supervision): add stall detector - #314

Closed
lndshk wants to merge 16 commits into
kunchenguid:mainfrom
lndshk:fm/stall-detector-w1
Closed

lndshk wants to merge 16 commits into
kunchenguid:mainfrom
lndshk:fm/stall-detector-w1

Conversation

@lndshk

@lndshk lndshk commented Jul 7, 2026

Copy link
Copy Markdown

Intent

Build a stall detector for firstmate so parked or finished workstreams do not go dormant because supervision depends on memory. This adds a read-only, pull-based bin/fm-stall-check.sh sweep, wires it into supervision docs, and surfaces a lightweight fm-guard pointer when dormant work needs attention.

What Changed

  • Added bin/fm-stall-check.sh for finished-but-not-advanced, blocker-cleared queued work, date-gated queued work, and idle-stall candidates.
  • Reused fm-tmux-lib.sh busy detection and respected FM_HOME, FM_STATE_OVERRIDE, and backlog/state conventions.
  • Kept fm-guard cheap by using a lightweight non-idle stall-check mode for pointer warnings.
  • Skipped healthy PR-ready tasks with pr= metadata, and read data/done-archive.md as a fallback for pruned blockers.
  • Documented the heartbeat/wake-handling invocation in AGENTS.md and added README command/env notes.
  • Added focused shell tests covering all detections, guard wiring, PR-ready carveouts, and archived Done blockers.

Validation

  • no-mistakes review/test/document/lint/push completed.
  • no-mistakes applied fixes: skip PR-ready tasks in stall checks; keep guard fast; read done-archive fallback for unblocked queued detection.
  • no-mistakes reported checks-passed for head cfe73156.

Pipeline

Updates from git push no-mistakes

lndshk added 16 commits June 24, 2026 12:22
Resolve the project dir to its physical path, derive the project name from
the registry arg instead of the resolved basename (so projects/quant-src ->
/mnt/e/Quant/src still reads as quant-src), and detect the treehouse worktree
by its invariant .treehouse path component rather than 'pane moved away from
project' (which false-positived on a transient startup cwd).
fix(spawn): support in-place symlinked projects on WSL mounts
fix(supervision): auto-re-arm watcher via keepalive and harden send swallow detection
…ehouse homes (#3)

* fix(spawn): reject project clone when detecting worktree

* no-mistakes(document): document PROJ_ABS rejection in spawn worktree detection comment
* fix(tmux): treat nbsp-padded prompts as idle

* no-mistakes(document): docs: note NBSP prompt normalization in composer detector and test coverage
@lndshk lndshk closed this Jul 7, 2026
@lndshk
lndshk deleted the fm/stall-detector-w1 branch August 1, 2026 19:00
@kingstyles

Copy link
Copy Markdown

Catch-up batch 6 notes

Summary

Upstream catch-up batch 6 of 6: merges the contiguous upstream range 723f43c7..df9eb03a (kunchenguid/firstmate, 14-21 Oct 2026, 58 commits) into the fork, stacked on batch 5.
Method as batches 1-5: one chronological merge; keep our side where a conflict is with a (c) duplicate; take upstream for (a) and fine (b) items.
The supervision host stays default off for every home (no change to its default).

Conflicts resolved (74 files)

Spawn, brief, teardown, harness

  • bin/fm-harness.sh (16 hunks) - ours. Upstream side is (c) 0e82f3ee per-mate runtime pins / 07912680 per-secondmate account pins; our Slop PR #157/feat: add safe secondmate lane restart helper #235 pin grammar kept. Clean-merged parser lines for upstream's mate <id>: grammar removed so the function matches ours. Command Code / Polytoken detection entries kept (inert).
  • bin/fm-spawn.sh (31) - combined. Kept Strata, worker nice, named-account routing, codex cost capture, lease-cd flow, task tmp root, our removal of the trailer-strip hooks. Took upstream dispatch entries for Command Code / Polytoken / Paseo (inert, never enabled) and the Orca launch-env path; re-added set -u initialisations that upstream code needs. forge=external ships now refuse before launch, because this fork installs no per-task git hooks directory to carry that rail's push guard.
  • bin/fm-brief.sh (3) - combined: our co-author rule 8 plus upstream's no-leading-cd rule (97316301), renumbered to 9.
  • bin/fm-teardown.sh (5) - combined: our custody/active-validation refusals, devlog, cost ledger and timeout lib, plus upstream's opt-in status archive (df9eb03a) and Polytoken cleanup; .git-hooks removal stays out.
  • bin/fm-pr-merge.sh (4) - combined: our merge_commit / --torn-down plus fields clean-merged GitLab code uses (inert).
  • bin/fm-backlog-transition-lib.sh (1) - combined.
  • Tests (teardown, secondmate-harness, spawn settle / dispatch-profile, trace-context, agy/kimi/muse/rovo harness, backlog atomicity, tangle guard, fleet ledger) - combined fakes that answer both our list-panes resolver and upstream's list-windows; removed clean-merged tests for the skipped pin grammar.

Watcher, wake, daemon

  • bin/fm-watch.sh (17) - combined. Took upstream's opt-in wedge escalation cap (bd866530, still off by default), operator evidence guards (4e6b9f59, opt-in), unknown-but-alive stale bound (8eb9be51), exit-picker dialog naming (138cf11a). Kept our quiet-mode stuck ladder, progress-class notes, review-wait absorb, declared-pause recheck cadence and append-failure handling. With the cap off our write order is unchanged.
  • bin/fm-wake-lib.sh (7) - combined: upstream's session-reachability check and lock re-key (eeeeb916, f05b6284) plus our rewake outcome and claim identity recording. The reachability check applies to arming claims only, as upstream does; our rewake claims carry no owner session id and keep batch 5's stuck-proof rule (otherwise a live rewake owner read as closed).
  • bin/fm-supervise-daemon.sh (7), fm-watch-arm.sh, fm-afk-contract.sh (9cd4a3be spend cap from live workers), fm-test-run.sh, fm-classify-lib.sh, fm-bootstrap.sh - combined.
  • bin/backends/tmux.sh, bin/fm-backend.sh, bin/fm-crew-state.sh - ours, plus two upstream points. Upstream aa9ab042 fixes tmux prefix-matching a gone window as alive; our fork already resolves every tmux target by exact list-panes -a enumeration (alive/gone/unknown) and never trusts display-message, which covers the same bug. Added from upstream: optional =session:=window exact markers, and malformed targets (empty, :, missing session or window, second colon) read gone instead of unknown. Kept ours: an unlabelled name.N explicit pane selector still resolves (fork contract); a recorded task target is protected from the gone-dotted-window trap by its expected label, and upstream's smoke case now checks that path. Upstream's second resolver (fm_backend_tmux_target_exists, fm_backend_tmux_window_id) and its bare-session and session:@window-id target claims were removed in review (R6), since our resolver does not support those forms.
  • bin/fm-composer-lib.sh - ours (our fix: accept landed squash-merged PR heads #149 Grok check accepts any mode suffix and overhang, from live Grok 4.7 evidence), plus upstream 3847411b's safety point: a suffixed Grok title is only accepted inside a rounded border, because an empty verdict lets firstmate type into the pane. Upstream test assertions that contradict fix: accept landed squash-merged PR heads #149 (unknown suffix, trailing text, second mid-dot, overhang width) were dropped. Removed a duplicate function the merge pasted in.
  • fm-busy-lib.sh, fm-branch-prompt.sh, afk/SKILL.md, OpenCode plugins - ours (upstream side was (c) or comment-only).
  • Tests: fm-session-lock-ancestry uses upstream's new phase order with our arm counts; wake helpers / wake queue / pi-watch extension combined; backend / session-start / fixtures ours.

Secondmate, control, contributions, role

  • bin/fm-contributions.sh + test (12+12) - ours plus 67abd40a (store only classified review fields). Upstream side was (c) 723f43c7 (ours chore: no-mistakes(test): make teardown content check portable across git versions #137) and 4f77bb37 (ours fix(spawn): make tmux window handling robust under non-default config #134).
  • bin/fm-control.sh, fm-secondmate-restart.sh, docs/agent-control.md - ours (skipped pin commits); Polytoken pre-stop check kept (inert).
  • bin/fm-remote-secondmate-control.sh - combined: upstream's early "already retired" exit plus our endpoint transition lock and overlap guards.
  • bin/fm-secondmate-nudge-lib.sh - combined: our stable-delivery-id reread helpers plus 63fc5ebd's owed argument; bootstrap and config-push callers checked consistent.
  • bin/fm-role-lib.sh - upstream (a65dceee, stricter: an unreadable selected remote no longer falls back).
  • bin/fm-config-inherit-lib.sh, fm-control-lib.sh - combined.
  • Tests: control-relaunch, self-repo-role, secondmate helpers/restart, send inbox/remote/strict, bearings snapshot - combined; skipped-pin tests removed.
  • secondmate-provisioning skill, docs/remote-secondmates.md - pins ours, reread wording combined.

Docs

After the rebase onto main (batch 5 squash ad356398)

  • Batch 6 replayed as its net diff against batch 5 (cd6d96a6) plus fix commits; 3 small conflicts with batch 5's later fixes: bin/fm-role-lib.sh (batch 6's stricter gh-resolved remote selection, main's comment), bin/fm-test-run.sh (main's browser-sweep entry plus the adapter tests), tests/fm-project-capacity.test.sh (main's fake tmux).
  • Batch 5 left two lines in error branches of bin/fm-spawn.sh (project-capacity library source, HERDR_RESUME_LOCK_WAIT=0); main already fixed both, so batch 6's copies were dropped.
  • bin/fm-pr-merge.sh: the GitLab merge read was repaired after the rebase; review then removed upstream's --allow-no-pipeline waiver entirely (R1), so the read is back to the fork's fields.
  • Spawn: names the leased worktree when the window closes on abort (upstream behaviour missed by the merge).

Skipped upstream changes (kept as inert code or ours-wins)

Tests

Run (all serial unless proven-isolated, --jobs 4 max, 600s per-script bound, waited for load under 20 before each batch):

  • bin/fm-lint.sh (changed-file mode): clean, except ShellCheck hits its 3 GiB memory cap on bin/fm-spawn.sh and tests/fm-procevent.test.sh (batch 5's unchanged fm-spawn.sh hits the same cap); bin/fm-lint.sh --fast on both passes. actionlint passes.
  • bin/fm-doc-audience-check.sh ok; bin/fm-test-run.sh --check-coverage ok.
  • Targeted set: 150 scripts = colocated tests for every bin/ file touched in 0397cb2b..df9eb03a, every test that range changed, every test changed on this branch, and the tests of the 22-24 Oct fixes (feat(project-memory): split situation-specific AGENTS.md detail into project skills #291, fix: sync project clones after merged PR wakes #293-feat(bin): add fleet freeze and stale-state reconciliation #305). On the rebased branch 137 passed first time.
  • The 13 that failed were fixed and re-run alone until green: fm-send-strict, fm-spawn-batch, fm-teardown (full file, 155 checks), fm-watch-arm (full file), fm-secondmate-harness, fm-secondmate-liveness, plus the GitLab cases of fm-pr-merge and the wedge-guard, exit-picker and captain-hold cases of fm-watch-triage; the secondmate group (secondmate-harness, secondmate-lifecycle-e2e, backlog-handoff, secondmate-reconcile, secondmate-safety, secondmate-hibernate, secondmate-sync, control-relaunch, spawn-batch) passes.
  • Still failing, identically on main ad356398 (checked in a clean copy of main): fm-captain-hold-lifecycle (600s timeout), fm-remote-secondmate-lifecycle-e2e (timeout), fm-supervision-host (timeout), fm-secondmate-restart (removed-model refusal text), fm-watch-guard (turn-end hook free-claim case).

Not run: the whole suite (one full run is planned at the end of the catch-up); the full fm-pr-merge and fm-watch-triage files (both exceed the 600s bound on main too; only the cases this batch touched were run in isolation); live harness and Herdr lanes beyond their default gate-skips.

Known gaps (not fixed here)

  • Teardown retry after a failed status archive: this fork releases the worktree before retiring status, so a retry refuses safely on the missing worktree identity instead of re-publishing; the retry half of upstream's archive test is not ported.
  • A captain backlog hold behind an elapsed declared pause: the fork's own pause recheck answers first, where upstream reports the hold; both treat the lane as a wait, never a wedge.

Risk

Validation pipeline

  • Review: 3 decided fix rounds were available; 2 used. Round 1 removed the GitLab waiver (R1) and the capacity report (R2), replaced source-grepping test assertions (R3, R4), and made the Herdr agents view retry its setup (R5). Round 2 removed the unused upstream tmux resolver and its unsupported target claims (R6).
  • Tests and documentation steps passed; lint stopped only on the ShellCheck memory cap above and was approved.
  • CI: hosted checks are off on this repository on purpose; approved past the CI wait, so no hosted check ran.

fritznoff pushed a commit to fritznoff/starship that referenced this pull request Nov 2, 2026
…catchup-u16

feat(bin): merge upstream firstmate through 3847411
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