Skip to content

feat: integrate upstream runtime and supervision improvements - #45

Merged
peterOC26 merged 678 commits into
mainfrom
fm/fm-upstream-sync-1107-s1
Nov 9, 2026
Merged

peterOC26 merged 678 commits into
mainfrom
fm/fm-upstream-sync-1107-s1

Conversation

@peterOC26

Copy link
Copy Markdown
Owner

Intent

Q1873 (2026-11-07): "Start the upstream update job? Y = start the update job: a worker merges upstream into our copy keeping our local fixes, a check by the other model family, then a firstmate PR for your merge word". Answer: "q1873 y can we safely use deepseek & grok for that? also we can drop six-column board - i don't use it anymore".
Context: upstream kunchenguid/firstmate main (head bf05a4f, 2026-11-06) has about 188 changes since this fork's last sync (PR #29, 2026-10-20): wake and supervision fixes (resurfaced wakes from handling successors, overdue worker decisions, fewer repeat stale alarms), supervision-host idle compaction, PR safety (no-CI PR is unverified, expected PR head on merge), teardown safety, Herdr fixes. This fork carries its own changes (PRs #20-#44: Jobs page and away-mode fixes, Grok and Codex composer/launch fixes, treehouse pool fixes, PR poll auth, contribution snapshot limits) that must survive, except the six-column bearings board and its GitHub fleet-board sync overlay, which the captain no longer uses.

What Changed

  • Add hc, Paseo, Rex, T3 Code, and Tern backends; Cortex, Hermes, and Kiro worker support; capacity reporting, usage warnings, and fleet-record export.
  • Integrate upstream supervision and recovery improvements, including idle compaction, safer remote delivery and cleanup, and PR verification with expected-head merge protection.
  • Replace the six-column Bearings digest with four sections and remove the GitHub fleet-board sync overlay; update documentation, regression coverage, and CI.

Risk Assessment

🚨 High: The round-4 bounded wait is correct and cannot deadlock, because every other holder of the project lock uses a non-blocking try-acquire. But the branch is still an 88k-line upstream merge whose conflict resolution in spawn, teardown and Treehouse lease locking produced regressions in each of the previous four review rounds, so it needs explicit human approval before merge.

Testing

Targeted lease, notification, and contribution checks passed after setup corrections; contention failed before the fix and passed afterward, including timeout retention. Live CLI, Codex, Herdr, Treehouse, GitHub-read, and browser checks produced evidence. Trust prompts and unavailable disposable backend/forge authority prevented complete live coverage.

  • Live validation: ⚠️ inconclusive - 6 of 11 scenarios driven live against the product
Scenario Result Live Evidence
Open Bearings: the four-section page renders preserved job names, and selecting queued work updates its selection count. ✅ pass live Live Bearings desktop; Live Bearings mobile; Generated Bearings page
Drain notifications: an uncovered completion appears once while an unanswered decision remains visible. ✅ pass live wake-live-first.txt, wake-live-second.txt, wake-live-decision.txt
Type a Codex draft: the real worker composer changes from empty to pending. ✅ pass live codex-worker-live.log; codex-worker-composer-result.json
Create a Herdr task through Firstmate: commands run in the intended directory and cleanup confirms the endpoint is gone. ✅ pass live herdr-adapter-live.log
Attempt to replace a slot claim or return the wrong lease: both refuse; the matching return succeeds without a leftover claim. ✅ pass live treehouse-live.log; treehouse-live-allocation.json; treehouse-live-returned.json
Read a public merged PR through the real GitHub CLI: Firstmate reports its merged state. ✅ pass live pr-state-live.log; pr-state-response.txt
Abort a worker during project-lock contention: temporary contention permits cleanup, while timeout retains the lease, claim, and journal. ⏸️ untested no Fixture-backed regressions passed and reproduced failure before the fix. Polytoken is absent from PATH, and no disposable authenticated T3 Code endpoint was supplied. Provide one of those backends for…
Launch Grok and safely steer its composer. ⏸️ untested no Grok stopped at folder trust. The operator must pretrust this checkout or authorize the narrowly scoped persistent trust write before rerunning.
Run a Claude primary through idle compaction while preserving supervision. ⏸️ untested no The real primary, with supervision enabled in its disposable home, stopped at folder trust. Pretrust the checkout or authorize that persistent choice before rerunning.
Aggregate away-mode contribution classifications across homes without treating expired evidence as measured. ⏸️ untested no Focused fixture-backed cases passed after correcting temporary-home placement. A live multi-home workflow requires pretrusted running primaries; Claude and Grok launches remained at trust prompts.
Attempt a merge with no CI evidence or a changed PR head and observe refusal. ⏸️ untested no No authorized disposable forge PR was supplied for guarded merge attempts. This phase forbids executing the delivery PR phase; provide a dedicated forge lab and explicit test authority.

Live Bearings desktop

Evidence: Generated Bearings page

Source: Generated Bearings page

<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Bearings - fleet board</title>
<style>
/* ============================================================
   Bearings board - Firstmate Design System, inlined for portability.
   Tokens copied verbatim from myfirstmate priv/static/assets/app.css
   (the compiled adoption of .agents/skills/firstmate-design).
   ============================================================ */
@import url("https://fonts.googleapis.com/css2?family=Chango&family=Jost:wght@400;500;600;700;800;900&family=JetBrains+Mono:wght@400;500;600;700&display=swap");

:root {
  --rust-700: #8f2f17; --rust-600: #a93a1f; --rust-500: #c0452a;
  --rust-400: #d35f3f; --rust-300: #e08365; --rust-100: #f4d8c9; --rust-050: #fbece3;
  --navy-700: #1a2238; --navy-600: #222c49; --navy-500: #2a3656;
  --navy-300: #6c7796; --navy-100: #d9deea;
  --gold-600: #b5791c; --gold-500: #e0a52e; --gold-300: #f0d38c; --gold-100: #f8ecc9;
  --ocean-600: #2f6688; --ocean-500: #3c7ea6; --ocean-200: #b6d4e2; --ocean-050: #e8f1f5;
  --sea-700: #234e3a; --sea-500: #2f6b4f; --sea-200: #b9d4c5; --sea-050: #e9f2ec;
  --paper-000: #fbf4e2; --paper-100: #f6ecd3; --paper-200: #f0e3c4; --paper-300: #e7d6ae;
  --cream-line: #ddc89c;
  --ink-900: #241c14; --ink-700: #3f3224; --ink-500: #6f5e46; --ink-300: #9c8a6c;
  --white: #fffdf7;
  --bg-page: var(--paper-100);
  --surface-card: var(--white);
  --surface-card-warm: var(--paper-000);
  --text-strong: var(--ink-900); --text-body: var(--ink-700);
  --text-muted: var(--ink-500); --text-faint: var(--ink-300);
  --border-default: var(--cream-line); --border-soft: var(--paper-300);
  --status-online: var(--sea-500); --status-online-soft: var(--sea-050);
  --status-warn: var(--gold-600); --status-warn-soft: var(--gold-100);
  --status-danger: var(--rust-600); --status-danger-soft: var(--rust-050);
  --status-info: var(--ocean-500); --status-info-soft: var(--ocean-050);
  --font-display: "Chango", "Cooper Black", Rockwell, Georgia, serif;
  --font-sans: "Jost", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --fs-h3: 1.4rem; --fs-h4: 1.15rem; --fs-base: 1rem; --fs-sm: 0.9375rem;
  --fs-xs: 0.8125rem; --fs-2xs: 0.6875rem;
  --ls-caps: 0.16em;
  --radius-xs: 6px; --radius-sm: 9px; --radius-md: 12px; --radius-banner: 7px;
  --radius-lg: 18px; --radius-pill: 999px;
  --shadow-sm: 0 1px 2px rgba(36, 28, 20, 0.06), 0 4px 10px rgba(36, 28, 20, 0.06);
  --shadow-hard: 4px 4px 0 var(--ink-900);
  --shadow-hard-sm: 3px 3px 0 var(--ink-900);
  --texture-paper: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.045'/%3E%3C/svg%3E");
  --focus-ring: 0 0 0 3px var(--gold-300);
  --container-app: 1180px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-sans);
  color: var(--text-body);
  background: var(--bg-page);
  background-image: var(--texture-paper);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }

/* ---- fm-badge (enamel sign-pin), verbatim contract ---- */
.fm-badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: var(--fs-2xs); font-weight: 800; line-height: 1;
  padding: 5px 9px 4px; text-transform: uppercase; letter-spacing: 0.07em;
  border-radius: var(--radius-xs); border: 1.5px solid var(--ink-900);
  box-shadow: 2px 2px 0 var(--ink-900); white-space: nowrap;
}
.fm-badge--online  { background: var(--sea-500);  color: var(--paper-000); }
.fm-badge--warn    { background: var(--gold-500); color: var(--navy-700); }
.fm-badge--danger  { background: var(--rust-600); color: var(--paper-000); }
.fm-badge--info    { background: var(--ocean-500); color: var(--paper-000); }
.fm-badge--neutral { background: var(--paper-000); color: var(--ink-900); }
.fm-badge--solid   { background: var(--rust-500); color: var(--paper-000); }

/* ---- fm-btn ---- */
.fm-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--font-sans); font-weight: 800; line-height: 1; white-space: nowrap;
  border: 2px solid transparent; border-radius: var(--radius-banner); cursor: pointer;
  text-decoration: none; transition: background 120ms, border-color 120ms, transform 120ms, box-shadow 120ms;
}
.fm-btn:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.fm-btn:active { transform: translateY(1px); }
.fm-btn--sm { font-size: var(--fs-xs); padding: 8px 16px; }
.fm-btn--primary { background: var(--rust-500); color: var(--white); border-color: var(--ink-900); box-shadow: var(--shadow-hard-sm); }
.fm-btn--primary:hover { background: var(--rust-600); }
.fm-btn--gold { background: var(--gold-500); color: var(--navy-700); border-color: var(--ink-900); box-shadow: var(--shadow-hard-sm); }
.fm-btn--gold:hover { background: var(--gold-600); color: var(--white); }
.fm-btn[disabled] { opacity: 0.5; cursor: not-allowed; }

/* ---- fm-card ---- */
.fm-card {
  background: var(--surface-card); border: 1px solid var(--border-default);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); overflow: hidden;
}
.fm-card--poster { border: 2px solid var(--ink-900); box-shadow: var(--shadow-hard); border-radius: var(--radius-md); }
.fm-card--warm { background: var(--surface-card-warm); }

/* ---- fm-sign (eyebrow section label) ---- */
.fm-sign {
  display: inline-flex; align-items: center; gap: 8px; font-weight: 800;
  text-transform: uppercase; letter-spacing: var(--ls-caps); font-size: var(--fs-xs);
  line-height: 1; white-space: nowrap;
}
.fm-sign--eyebrow { color: var(--rust-500); }
.fm-sign--muted { color: var(--ink-500); }
.fm-sign svg { width: 14px; height: 14px; }
.fm-ico { width: 1.15em; height: 1.15em; flex: none; vertical-align: -0.18em; }

/* ============================================================
   Board chrome (bb-*) - built on the same tokens
   ============================================================ */
.bb-nav {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--paper-100) 86%, transparent);
  backdrop-filter: saturate(150%) blur(10px);
  border-bottom: 1px solid var(--border-default);
}
.bb-nav__inner {
  max-width: var(--container-app); margin: 0 auto; padding: 0 28px; height: 64px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.bb-brand { display: inline-flex; align-items: center; gap: 12px; }
.bb-brand__disc {
  display: grid; place-items: center; width: 34px; height: 34px; flex: none;
  border-radius: 999px; background: var(--rust-500); color: var(--paper-000);
  border: 2px solid var(--ink-900); box-shadow: var(--shadow-hard-sm);
}
.bb-brand__disc svg { width: 60%; height: 60%; }
.bb-brand__wm { font-family: var(--font-display); font-size: 23px; color: var(--text-strong); line-height: 1; }
.bb-meta-mono { font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--text-faint); white-space: nowrap; }

.bb-main {
  max-width: var(--container-app); margin: 0 auto;
  padding: 26px 28px 72px; display: flex; flex-direction: column; gap: 22px;
}

/* stat strip */
.bb-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.bb-stat {
  display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; min-width: 0;
  background: var(--surface-card-warm); border: 1px solid var(--border-soft); border-radius: var(--radius-md);
}
.bb-stat--call { background: var(--rust-050); border: 2px solid var(--rust-500); }
.bb-stat__num { font-family: var(--font-mono); font-size: var(--fs-h3); font-weight: 600; line-height: 1; color: var(--text-strong); }
.bb-stat--call .bb-stat__num { color: var(--rust-600); }
.bb-stat__label { font-family: var(--fon

... [21543 bytes truncated] ...

();
      answerLimit.classList.remove("is-visible");
      var fd = new FormData(form);
      var value = fd.get("answer");
      var note = (fd.get("note") || "").trim();
      var displayAnswer = value ? (note ? value + " - " + note : value) : note;
      if (!displayAnswer) return;
      if (utf8ByteLength(displayAnswer) > 512) {
        answerLimit.textContent = "Answer is too long to queue (512 bytes maximum).";
        answerLimit.classList.add("is-visible");
        return;
      }
      if (window.lavish && window.lavish.queuePrompt) {
        /* The versioned context keeps the selected option separate from its
           note, while close carries the composer-declared completion mode. */
        var ctxData = {
          schema: "fm-bearings-answer.v1",
          question: item.key,
          selection: value || "",
          note: note
        };
        if (item.close) ctxData.close = item.close;
        window.lavish.queuePrompt(
          "Captain's Call answer - " + item.title + ": " + displayAnswer,
          { tag: "choice", text: item.title + " -> " + displayAnswer, element: form,
            data: ctxData }
        );
      }
      card.classList.add("is-queued");
      /* deal the next card once this one is answered */
      setTimeout(function () { showCard(active < cards.length - 1 ? active + 1 : active); }, 450);
    });

    pad.appendChild(form);
    card.appendChild(pad);
    deck.appendChild(card);
  });

  /* stack navigation: one card at a time, dealt off the pile */
  var cards = Array.prototype.slice.call(deck.children);
  var active = 0;
  var stackCount = document.getElementById("bb-stack-count");
  var stackPrev = document.getElementById("bb-stack-prev");
  var stackNext = document.getElementById("bb-stack-next");
  var stackNav = stackCount.parentNode;
  function showCard(i) {
    active = Math.max(0, Math.min(cards.length - 1, i));
    cards.forEach(function (c, j) { c.hidden = j !== active; });
    var answered = deck.querySelectorAll(".is-queued").length;
    stackCount.textContent = "card " + (active + 1) + " of " + cards.length +
      (answered ? " · " + answered + " answered" : "");
    stackPrev.disabled = active === 0;
    stackNext.disabled = active === cards.length - 1;
    /* the pile thins as the deal approaches the bottom */
    deck.classList.toggle("bb-call--penult", active === cards.length - 2);
    deck.classList.toggle("bb-call--last", active === cards.length - 1);
  }
  if (cards.length) {
    stackPrev.addEventListener("click", function () { showCard(active - 1); });
    stackNext.addEventListener("click", function () { showCard(active + 1); });
    showCard(0);
  } else {
    deck.classList.add("bb-call--empty");
    deck.appendChild(el("div", "bb-empty", "Nothing needs your action right now."));
    stackNav.hidden = true;
  }

  /* Underway */
  var uw = document.getElementById("bb-underway");
  if (!data.underway.length) uw.appendChild(el("div", "bb-empty", "Nothing is underway."));
  data.underway.forEach(function (t) {
    var row = el("div", "bb-row");
    row.appendChild(badge(t.state === "working" ? "online" : "info", t.state));
    var main = el("div", "bb-row__main");
    /* the snapshot's durable name-or-id label leads the row so a scan says
       WHICH task this is; the run status keeps its place on the second line */
    main.appendChild(el("div", "bb-row__title", t.name));
    /* captain-facing rows name the repo; the internal task id shows only when
       no repo is known */
    main.appendChild(el("div", "bb-row__sub",
      t.doing + " · " + t.kind + " · " + (t.repo || t.id)));
    row.appendChild(main);
    uw.appendChild(row);
  });

  /* Landed */
  var ld = document.getElementById("bb-landed");
  if (!data.landed.length) ld.appendChild(el("div", "bb-empty", "No recent completions are in the current baseline."));
  data.landed.forEach(function (t) {
    var row = el("div", "bb-row");
    var chk = el("span", "bb-row__check");
    chk.innerHTML = '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M20 6 9 17l-5-5"/></svg>';
    row.appendChild(chk);
    var main = el("div", "bb-row__main");
    main.appendChild(el("div", "bb-row__title", t.what));
    main.appendChild(el("div", "bb-row__sub", (t.repo || t.id) + " · " + t.owner));
    row.appendChild(main);
    if (t.pr_url) {
      var a = el("a", "bb-row__pr", "#" + t.pr_url.split("/").pop());
      a.href = t.pr_url; a.title = t.pr_url; a.target = "_blank"; a.rel = "noopener";
      row.appendChild(a);
    }
    ld.appendChild(row);
  });

  /* Charted Next + dispatch picker */
  var ch = document.getElementById("bb-charted");
  var bar = document.getElementById("bb-dispatch");
  var barCount = document.getElementById("bb-dispatch-count");
  var barBtn = document.getElementById("bb-dispatch-btn");
  var anyPickable = false;

  function pickedIds() {
    return Array.prototype.map.call(ch.querySelectorAll(".bb-pick:checked"), function (c) { return c.value; });
  }
  function refreshBar(limitMessage) {
    var n = pickedIds().length;
    barCount.textContent = limitMessage || (n ? n + " picked for dispatch" : "pick queued work to dispatch");
    barBtn.disabled = !n;
  }

  if (!chartedQueued(data.charted).length && !chartedMoreQueued) {
    ch.appendChild(el("div", "bb-empty", "Nothing is queued."));
  }
  chartedOrder(data.charted).forEach(function (t) {
    var row = el("div", "bb-row");
    if (t.dispatchable && !isWarning(t)) {
      anyPickable = true;
      var pick = document.createElement("input");
      pick.type = "checkbox"; pick.className = "bb-pick"; pick.value = t.id;
      pick.setAttribute("aria-label", "Pick " + t.id + " for dispatch");
      pick.addEventListener("change", function () {
        if (pick.checked && utf8ByteLength(pickedIds().join(",")) > 512) {
          pick.checked = false;
          refreshBar("Selection limit reached (512 bytes maximum). ");
          return;
        }
        refreshBar();
      });
      row.appendChild(pick);
    } else {
      row.appendChild(el("span", "bb-pick-spacer"));
    }
    var main = el("div", "bb-row__main");
    main.appendChild(el("div", "bb-row__title", t.title));
    /* second line keeps the title uncrowded in the half-width column */
    var chSub = t.repo || t.id;
    main.appendChild(el("div", "bb-row__sub", t.reason ? t.reason + " · " + chSub : chSub));
    row.appendChild(main);
    if (isWarning(t)) row.appendChild(badge("danger", "needs repair"));
    else if (t.reason) row.appendChild(badge("warn", "waiting"));
    ch.appendChild(row);
  });
  var chartedShown = chartedQueued(data.charted).length;
  var chartedTotal = chartedShown + chartedMoreQueued;
  document.getElementById("bb-charted-sub").textContent =
    chartedMoreQueued ? "showing " + chartedShown + " of " + chartedTotal : "";
  if (chartedMoreQueued) {
    ch.appendChild(el("span", "bb-morechip", "+" + chartedMoreQueued + " more queued - ask firstmate for the full chart"));
  }
  if (chartedMoreWarnings) {
    ch.appendChild(el("span", "bb-morechip", "+" + chartedMoreWarnings + " more repair warning" + (chartedMoreWarnings === 1 ? "" : "s") + " - ask firstmate for the full chart"));
  }

  if (anyPickable) {
    bar.hidden = false;
    refreshBar();
    barBtn.addEventListener("click", function () {
      var ids = pickedIds();
      var dispatchAnswer = ids.join(",");
      if (!ids.length) return;
      if (utf8ByteLength(dispatchAnswer) > 512) {
        refreshBar("Selection is too long to queue (512 bytes maximum). ");
        return;
      }
      if (window.lavish && window.lavish.queuePrompt) {
        window.lavish.queuePrompt(
          "Dispatch order - start this queued work now: " + ids.join(", "),
          { tag: "choice", text: "Dispatch: " + ids.join(", "), element: bar,
            queueKey: "dispatch.charted",
            data: { question: "dispatch.charted", answer: dispatchAnswer } }
        );
      }
      bar.classList.add("is-queued");
    });
  }
  } catch (e) {
    renderBoardError("The board data could not be rendered");
  }
})();
</script>
</body>
</html>
Evidence: Real Herdr adapter lifecycle

Source: Real Herdr adapter lifecycle

Created home container: fm-lab-upstream-adapter-1107:w1
Created task endpoint: fm-lab-upstream-adapter-1107:w1:p2 tab=w1:t2
zabi@purplevoice:~/.no-mistakes/worktrees/7f0ec18181b6/01M6W1RCVXS15VZT05F5RDMYXZ$ printf "FM_ADAPTER_LIVE_OK\n"; pwd
FM_ADAPTER_LIVE_OK
~/.no-mistakes/worktrees/7f0ec18181b6/01M6W1RCVXS15VZT05F5RDMYXZ
zabi@purplevoice:~/.no-mistakes/worktrees/7f0ec18181b6/01M6W1RCVXS15VZT05F5RDMYXZ$
Firstmate adapter confirmed its own endpoint gone after cleanup.
Evidence: Real Treehouse ownership guards

Source: Real Treehouse ownership guards

A new version of treehouse is available: v2.3.0 → v3.1.8
Run "treehouse update" to update

🌳 Setting up worktree...
🌳 Leased worktree at ~/.no-mistakes/worktrees/7f0ec18181b6/01M6W1RCVXS15VZT05F5RDMYXZ/.test-treehouse-live/pool/.treehouse/project-086c55/1/project. Run 'treehouse return ~/.no-mistakes/worktrees/7f0ec18181b6/01M6W1RCVXS15VZT05F5RDMYXZ/.test-treehouse-live/pool/.treehouse/project-086c55/1/project' to release it.
{"path":"~/.no-mistakes/worktrees/7f0ec18181b6/01M6W1RCVXS15VZT05F5RDMYXZ/.test-treehouse-live/pool/.treehouse/project-086c55/1/project","lease_id":"457ce65a05bdf242093e37568148d0f5","lease_holder":"~/.no-mistakes/worktrees/7f0ec18181b6/01M6W1RCVXS15VZT05F5RDMYXZ/.test-treehouse-live/home/live-task/a1","leased_at":"2026-11-08T00:01:24.122273634+01:00"}
Existing slot claim refused replacement and still belongs to live-task.
A new version of treehouse is available: v2.3.0 → v3.1.8
Run "treehouse update" to update

failed to return worktree: lease precondition failed: lease identity does not match worktree ~/.no-mistakes/worktrees/7f0ec18181b6/01M6W1RCVXS15VZT05F5RDMYXZ/.test-treehouse-live/pool/.treehouse/project-086c55/1/project
Wrong lease identity refused; the original live lease remains verified.
A new version of treehouse is available: v2.3.0 → v3.1.8
Run "treehouse update" to update

🌳 Worktree returned to pool.
{"name":"1","path":"~/.no-mistakes/worktrees/7f0ec18181b6/01M6W1RCVXS15VZT05F5RDMYXZ/.test-treehouse-live/pool/.treehouse/project-086c55/1/project","created_at":"2026-11-08T00:01:24.122234823+01:00"}
Matching return released the lease with no remaining claim.
Evidence: Codex live composer classification

Source: Codex live composer classification

codex: 160x45

  >_ OpenAI Codex (v0.160.0)
     ~/.no-mistakes/worktrees/7f0ec18181b6/01M6W1RCVXS15VZT05F5RDMYXZ

  Rough sketches welcome.









                                                                           ⣀⣤⣤⣤⣀⣀
                                                                        ⣠⣶⣿⣿⣿⣿⣿⣿⣿⣿⣦⣤⣤⣤⣤⣤⣤⡀
                                                                      ⢀⣾⣿⣿⠿⠋⠉⠉⢉⣭⣿⣿⣿⣿⣿⠿⣿⣿⣿⣿⣷⣄
                                                                     ⣀⣾⣿⣿⠃ ⣀⣴⣾⣿⣿⡿⠟⠋ ⣀⡀ ⠈⠙⢿⣿⣿⣧
                                                                  ⣀⣶⣿⣿⣿⣿⡇ ⢸⣿⣿⡿⠛⠉⢀⣠⣴⣿⣿⣿⣷⣦⣀⠈⢻⣿⣿⡇
                                                                 ⣰⣿⣿⡿⢿⣿⣿⡇ ⢸⣿⣿⢀⣤⣶⣿⣿⣿⠟⠛⠻⣿⣿⣿⣿⣮⣿⣿⡷
                                                                ⢰⣿⣿⡟⠁⢸⣿⣿⡇ ⢸⣿⣿⣿⣿⠿⠿⣿⣿⣿⣦⣄⡀⠈⠛⠿⣿⣿⣿⣧⡀
                                                                ⣾⣿⣿⠃ ⢸⣿⣿⡇ ⢸⣿⣿⠋⠁  ⠈⠙⢻⣿⣿⣿⣶⣤⡀ ⠹⢿⣿⣷⡄
                                                                ⢸⣿⣿⣇ ⠸⣿⣿⣷⣦⣼⣿⣿      ⢸⣿⣿⠻⢿⣿⣿⡇ ⠘⣿⣿⣿
                                                                ⠈⢿⣿⣿⣦⡀⠈⠛⠿⣿⣿⣿⣿⣄⡀  ⢀⣠⣼⣿⣿  ⣿⣿⡇  ⣿⣿⣿⠇
                                                                  ⢻⣿⣿⣿⣷⣦⣀⠈⠙⠻⣿⣿⣿⣶⣶⣿⣿⣿⣿⣿  ⣿⣿⡇ ⣠⣿⣿⣿
                                                                  ⢸⣿⣿⡿⢿⣿⣿⣿⣦⣠⣴⣿⣿⣿⡿⠟⠋⢸⣿⣿  ⣿⣿⣷⣴⣿⣿⣿⠃
                                                                  ⠘⣿⣿⣷ ⠈⠛⢿⣿⣿⣿⠿⠋⠉ ⣠⣴⣿⣿⣿  ⣿⣿⣿⣿⣿⠟⠁
                                                                   ⠻⣿⣿⣿⣤⣀ ⠈⠉ ⢀⣤⣶⣿⣿⣿⠿⠟⠁ ⣰⣿⣿⡟⠋⠁
                                                                    ⠈⠿⣿⣿⣿⣿⣶⣾⣿⣿⣿⣿⠟⠋⠁  ⣠⣼⣿⣿⡟
                                                                       ⠙⠛⠛⠛⠻⠛⢿⣿⣿⣿⣿⣷⣾⣿⣿⣿⡿⠏
                                                                              ⠈⠙⠛⠿⠿⠿⠿⠛⠉










› Ask Codex to do anything


  ? for shortcuts

Composer before typing: empty; after typing: pending
Private tmux server stopped; disposable lab removed.
Evidence: Recovered completion notification

Source: Recovered completion notification

STATUS OUTCOME BACKSTOP (newest captain-facing task event has no covering branch outcome):
delivery done: upstream-update CLI event reached the operator
- Outcome: ⏭️ skipped across 1 run (14m26s)

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

🔧 **Review** - 3 issues found → auto-fixed (4) ✅
  • 🚨 bin/fm-spawn.sh:6086 - The merge put back upstream's Herdr-only lease path (spawn_lease_herdr_slot, fm-spawn.sh:5542-5549). It runs treehouse get --lease --lease-holder &#34;$ID&#34; but never sets TREEHOUSE_LEASE_ID or TREEHOUSE_LEASE_HOLDER, so the meta written at fm-spawn.sh:7348 has no treehouse_lease_* lines. The fork's lease checks, which the merge kept, treat a leased copy with no recorded identity as unverifiable and refuse it. In the fork base (25c1d6a), Herdr went through the generic fm_treehouse_lease_get journal path, so this is a new regression.

Concrete sequence on a real Treehouse pool:

  1. Spawn task A on Herdr in project P. The copy becomes leased=true with holder=A, and A's meta has no lease fields.
  2. Spawn task B (any backend) in P. fm_treehouse_records_reserved reaches bin/fm-wake-lib.sh:2225 for A's record: fm_treehouse_record_lease fails, there is no treehouse_lease_ line, and fm_treehouse_legacy_unleased is false because the copy is leased. Result: "REFUSED: retained task A names pool copy ... without a verified matching durable lease". Only one Herdr worker per project can exist at a time.
  3. Relaunch A: bin/fm-spawn.sh:4271 refuses for the same reason.
  4. Tear down A: bin/fm-teardown.sh:2776 refuses with "no verified identity for the copy's pool reservation", so the task cannot be cleaned up.

The same gap applies to upstream's t3code lease (fm-spawn.sh:5426, holder=$ID, no meta fields). A sibling issue: the Herdr/t3code claim block (fm-spawn.sh ~6219) now uses the fork's refuse-if-any-claim fm_treehouse_slot_owner_claim, while upstream's abort path relied on the next spawn replacing a stale claim.

Fix: send Herdr (and t3code) through the fork's journaled fm_treehouse_lease_get / structured-holder path and record treehouse_lease_id/holder in meta, keeping upstream's explicit cd into the leased copy. Alternatively, record the Treehouse lease_id and holder from these gets so the shared checks can verify them.

  • ⚠️ bin/fm-watch.sh:4455 - Resolving the terminal-stale branch kept the fork's older rm -f &#34;$ssf&#34; and dropped upstream's wedge_episode_end &#34;$key&#34; 0 1. Upstream's header calls that function the single place that ends a wedge episode: it clears the cap markers and, when a cap is configured, the escalation count.

Concrete sequence with FM_WEDGE_MAX_ESCALATIONS>0:

  1. A wedged window fires the cap, which writes .wedge-permanent-<key>.
  2. The crew then logs done:. A new hash surfaces the bare terminal stale at :4455 and wakes, but the cap marker stays.
  3. On the next poll of the same hash, the gate at ~4466 ([ -e &#34;$ssf&#34; ] || { cap&gt;0 &amp;&amp; -e .wedge-permanent }) sends a genuinely finished crew into wedge_timer_check on every poll. The leftover cap also keeps silencing that window's future wedges.

The fork's delivered-terminal absorb at :4440 has the same gap. Its own comment says it removes $ssf so the next poll does not go through wedge_timer_check, but a standing cap marker still sends it there with the pane hash, which defeats the once-per-identity absorb.

Fix: call wedge_episode_end &#34;$key&#34; 0 1 instead of rm -f &#34;$ssf&#34; at both :4440 and :4455. With the default cap of 0 the behavior is unchanged.

  • ℹ️ bin/fm-captain-hold.sh:444 - Upstream's archived-entry resolution (task_show_archived / archived_entry) replaced the fork's PR fix: allow scout cleanup after answered calls are archived #31 archive reader, but the merge kept that reader's helpers, and now nothing calls them:
  • task_show_inventory (:444-484)
  • captain_archive_path (:411), whose only caller is task_show_inventory
  • the TASK_SHOW_ARCHIVED global, which is set at :394/:397/:483 and never read
  • the optional [reader] parameter of resolve_entry (:873), which every caller leaves at its default

Remove these leftovers so the archived lookup has a single owner. This does not change behavior.

🔧 Fix applied.
3 issues (2 errors, 1 warning) still open:

  • 🚨 bin/fm-spawn.sh:6086 - The merge put back upstream's Herdr-only lease path (spawn_lease_herdr_slot, fm-spawn.sh:5542-5549). It runs treehouse get --lease --lease-holder &#34;$ID&#34; but never sets TREEHOUSE_LEASE_ID or TREEHOUSE_LEASE_HOLDER, so the meta written at fm-spawn.sh:7348 has no treehouse_lease_* lines. The fork's lease checks, which the merge kept, treat a leased copy with no recorded identity as unverifiable and refuse it. In the fork base (25c1d6a), Herdr went through the generic fm_treehouse_lease_get journal path, so this is a new regression.

Concrete sequence on a real Treehouse pool:

  1. Spawn task A on Herdr in project P. The copy becomes leased=true with holder=A, and A's meta has no lease fields.
  2. Spawn task B (any backend) in P. fm_treehouse_records_reserved reaches bin/fm-wake-lib.sh:2225 for A's record: fm_treehouse_record_lease fails, there is no treehouse_lease_ line, and fm_treehouse_legacy_unleased is false because the copy is leased. Result: "REFUSED: retained task A names pool copy ... without a verified matching durable lease". Only one Herdr worker per project can exist at a time.
  3. Relaunch A: bin/fm-spawn.sh:4271 refuses for the same reason.
  4. Tear down A: bin/fm-teardown.sh:2776 refuses with "no verified identity for the copy's pool reservation", so the task cannot be cleaned up.

The same gap applies to upstream's t3code lease (fm-spawn.sh:5426, holder=$ID, no meta fields). A sibling issue: the Herdr/t3code claim block (fm-spawn.sh ~6219) now uses the fork's refuse-if-any-claim fm_treehouse_slot_owner_claim, while upstream's abort path relied on the next spawn replacing a stale claim.

Fix: send Herdr (and t3code) through the fork's journaled fm_treehouse_lease_get / structured-holder path and record treehouse_lease_id/holder in meta, keeping upstream's explicit cd into the leased copy. Alternatively, record the Treehouse lease_id and holder from these gets so the shared checks can verify them.

  • 🚨 bin/fm-spawn.sh:1952 - Bug introduced by round 1's herdr-lease-identity fix. That fix sent Herdr and t3code through spawn_lease_treehouse_slot (fm-spawn.sh:1725), which creates state/&lt;id&gt;.treehouse-acquire and keeps it after any failure. It left upstream's unguarded abort returns in place, so an abort can now hand the copy back while still keeping the journal that names it.

Concrete t3code sequence:

  1. A t3code ship spawn of task A in project P leases a copy at :5465.
  2. freshen_spawn_worktree_base fails with exit 1, or thread creation fails with a code other than 1. The abort trap prints "retaining Treehouse lease recovery journal" (:2034), and the T3CODE_LEASED block (:1952-1966) runs treehouse return --force $WT, which succeeds.
  3. The pool entry is now unleased, but $STATE/A.treehouse-acquire/allocation.json still names it.
  4. Every later fresh spawn in P from this home reaches fm_treehouse_records_reserved (fm-wake-lib.sh:2229-2259). The journal's path is a pool slot and fm_treehouse_lease_matches fails, so the spawn is refused with "unresolved Treehouse acquisition journal … reconcile its lease". A retry of A is refused at :4328. The project stays blocked until someone removes the journal by hand.

Before round 1, t3code kept no journal, so it did not fail this way.

The same class appears at:

  • The Herdr abort return (:2045-2057). It runs for polytoken pre-launch aborts once the pane is confirmed gone. test_abort_returns_a_clean_lease_once_the_pane_is_gone (tests/fm-spawn-herdr-lease.test.sh) asserts only returned and never checks the journal, so it passes with this defect.
  • The operator hints at :1929, :1940, :1963, :2054 and :5470, which tell the operator to run a bare treehouse return --force $WT. That leaves the same blocking journal.

Fix: when TREEHOUSE_ACQUIRE_JOURNAL is set, make these abort returns use treehouse return --if-lease-id &#34;$TREEHOUSE_LEASE_ID&#34; --if-lease-holder &#34;$TREEHOUSE_LEASE_HOLDER&#34;. Remove the journal only after that return succeeds. Point the hints at spawn_treehouse_recovery_steps. The alternative is to skip these returns for journaled leases, as the fork's header contract at :227-236 describes. Either way, update the header and the Herdr test to assert the journal state.

  • ⚠️ tests/fm-backend-t3code.test.sh:124 - Round 1 moved the t3code lease onto fm_treehouse_lease_get. That runs treehouse get --lease --lease-holder &lt;home&gt;/&lt;id&gt;/a… --json and parses .path and .lease_id with jq (fm-spawn.sh:1745-1749). Round 1 did not update this suite's fake.

make_treehouse_fakebin still prints a bare path for get and keeps no lease state, so jq fails and every t3code worker spawn test that builds this fake aborts before the thread is created. The assertion at :1533 also still expects get --lease --lease-holder $id with the bare task id.

The abort-return expectations at :1898-1906, :1988, :2007, :2027 and :2064 assume the pre-journal behavior. They should follow whatever fix the journaled-lease-abort-return finding settles on.

Fix: switch the fake to fm_test_fake_treehouse (as round 1 did in tests/fm-spawn-herdr-lease.test.sh), or emit the JSON and lease state the journaled path verifies. Then update the holder assertion.

🔧 Fix applied.
3 errors still open:

  • 🚨 bin/fm-spawn.sh:6086 - The merge put back upstream's Herdr-only lease path (spawn_lease_herdr_slot, fm-spawn.sh:5542-5549). It runs treehouse get --lease --lease-holder &#34;$ID&#34; but never sets TREEHOUSE_LEASE_ID or TREEHOUSE_LEASE_HOLDER, so the meta written at fm-spawn.sh:7348 has no treehouse_lease_* lines. The fork's lease checks, which the merge kept, treat a leased copy with no recorded identity as unverifiable and refuse it. In the fork base (25c1d6a), Herdr went through the generic fm_treehouse_lease_get journal path, so this is a new regression.

Concrete sequence on a real Treehouse pool:

  1. Spawn task A on Herdr in project P. The copy becomes leased=true with holder=A, and A's meta has no lease fields.
  2. Spawn task B (any backend) in P. fm_treehouse_records_reserved reaches bin/fm-wake-lib.sh:2225 for A's record: fm_treehouse_record_lease fails, there is no treehouse_lease_ line, and fm_treehouse_legacy_unleased is false because the copy is leased. Result: "REFUSED: retained task A names pool copy ... without a verified matching durable lease". Only one Herdr worker per project can exist at a time.
  3. Relaunch A: bin/fm-spawn.sh:4271 refuses for the same reason.
  4. Tear down A: bin/fm-teardown.sh:2776 refuses with "no verified identity for the copy's pool reservation", so the task cannot be cleaned up.

The same gap applies to upstream's t3code lease (fm-spawn.sh:5426, holder=$ID, no meta fields). A sibling issue: the Herdr/t3code claim block (fm-spawn.sh ~6219) now uses the fork's refuse-if-any-claim fm_treehouse_slot_owner_claim, while upstream's abort path relied on the next spawn replacing a stale claim.

Fix: send Herdr (and t3code) through the fork's journaled fm_treehouse_lease_get / structured-holder path and record treehouse_lease_id/holder in meta, keeping upstream's explicit cd into the leased copy. Alternatively, record the Treehouse lease_id and holder from these gets so the shared checks can verify them.

  • 🚨 bin/fm-spawn.sh:1952 - Bug introduced by round 1's herdr-lease-identity fix. That fix sent Herdr and t3code through spawn_lease_treehouse_slot (fm-spawn.sh:1725), which creates state/&lt;id&gt;.treehouse-acquire and keeps it after any failure. It left upstream's unguarded abort returns in place, so an abort can now hand the copy back while still keeping the journal that names it.

Concrete t3code sequence:

  1. A t3code ship spawn of task A in project P leases a copy at :5465.
  2. freshen_spawn_worktree_base fails with exit 1, or thread creation fails with a code other than 1. The abort trap prints "retaining Treehouse lease recovery journal" (:2034), and the T3CODE_LEASED block (:1952-1966) runs treehouse return --force $WT, which succeeds.
  3. The pool entry is now unleased, but $STATE/A.treehouse-acquire/allocation.json still names it.
  4. Every later fresh spawn in P from this home reaches fm_treehouse_records_reserved (fm-wake-lib.sh:2229-2259). The journal's path is a pool slot and fm_treehouse_lease_matches fails, so the spawn is refused with "unresolved Treehouse acquisition journal … reconcile its lease". A retry of A is refused at :4328. The project stays blocked until someone removes the journal by hand.

Before round 1, t3code kept no journal, so it did not fail this way.

The same class appears at:

  • The Herdr abort return (:2045-2057). It runs for polytoken pre-launch aborts once the pane is confirmed gone. test_abort_returns_a_clean_lease_once_the_pane_is_gone (tests/fm-spawn-herdr-lease.test.sh) asserts only returned and never checks the journal, so it passes with this defect.
  • The operator hints at :1929, :1940, :1963, :2054 and :5470, which tell the operator to run a bare treehouse return --force $WT. That leaves the same blocking journal.

Fix: when TREEHOUSE_ACQUIRE_JOURNAL is set, make these abort returns use treehouse return --if-lease-id &#34;$TREEHOUSE_LEASE_ID&#34; --if-lease-holder &#34;$TREEHOUSE_LEASE_HOLDER&#34;. Remove the journal only after that return succeeds. Point the hints at spawn_treehouse_recovery_steps. The alternative is to skip these returns for journaled leases, as the fork's header contract at :227-236 describes. Either way, update the header and the Herdr test to assert the journal state.

  • 🚨 bin/fm-spawn.sh:1765 - Round 2's spawn_return_treehouse_slot returns a Herdr or t3code copy to the pool and deletes its acquisition journal without first making sure this task's slot claim (.fm-slot-owner) is gone. Round 1 brought back upstream's abort returns and created this problem. Round 2 added the lease-ID guard but did not close it.

Concrete t3code sequence:

  1. A fresh t3code spawn of task A leases a pool copy (:5475) and claims it (:6204, SPAWN_SLOT_CLAIMED=1).
  2. A publishes its record, and :7516 releases the project lock.
  3. fm_backend_t3code_turn_start is refused (:8015) and the spawn exits 1.
  4. In spawn_abort_cleanup, the thread is archived and the T3CODE_LEASED block (:1973) calls spawn_return_treehouse_slot. The copy is now unleased and the journal is deleted.
  5. The fresh-commit rollback removes the meta. The claim-release block (:2075-2088) finds that the project lock is not held and the harness is not polytoken. It prints "the next spawn's claim replaces it" and leaves the claim.

The pool now holds an unleased copy whose claim names A. The fork's refuse-if-any-claim rule makes that message false. The next spawn that gets this copy leases it, then spawn_lease_treehouse_slot refuses it (:1757-1760, "carries an existing slot claim"). That spawn keeps a new live lease and journal, so an operator has to reconcile by hand. That is the stale-claim state the user said must not be repaired by replacement.

The Herdr block (:2046-2057) has the same gap. For example: Herdr with rovo, hermes or opencode2, a launch gate fails after the record is published, rovo_endpoint_cleanup closes the pane, the rollback removes the meta, and the clean copy is returned while the project lock is not held. For polytoken the claim is released only if fm_lock_try_acquire succeeds (:2082). If it fails, the same state remains.

A related ordering problem: the t3code return at :1973 runs before spawn_fresh_commit_rollback (:1980). If the rollback fails, a retained record still names a copy that was already returned.

Neither test catches this. Neither suite runs the claim path: test_spawn_abort_returns_lease_only_after_archive, test_abort_returns_a_clean_lease_once_the_pane_is_gone, and the other tests round 2 added assert only returned and that the journal is gone. None checks .fm-slot-owner.

Fix: in spawn_return_treehouse_slot, the helper both abort sites share, do these steps when SPAWN_SLOT_CLAIMED=1:

  • Hold or retake SPAWN_TREEHOUSE_PROJECT_LOCK for any harness, not only polytoken.
  • Release this task's claim before returning the copy and deleting the journal.
  • If the claim cannot be released, skip the return and keep the journal so the recovery steps apply.

Also run the t3code return only after the record rollback has succeeded and no meta exists, as the Herdr block already does. Correct the stale "next spawn's claim replaces it" warning and comment at :2069-2087, and add an assertion that the claim file is absent after a successful abort return.

🔧 Fix applied.
4 issues (3 errors, 1 warning) still open:

  • 🚨 bin/fm-spawn.sh:6086 - The merge put back upstream's Herdr-only lease path (spawn_lease_herdr_slot, fm-spawn.sh:5542-5549). It runs treehouse get --lease --lease-holder &#34;$ID&#34; but never sets TREEHOUSE_LEASE_ID or TREEHOUSE_LEASE_HOLDER, so the meta written at fm-spawn.sh:7348 has no treehouse_lease_* lines. The fork's lease checks, which the merge kept, treat a leased copy with no recorded identity as unverifiable and refuse it. In the fork base (25c1d6a), Herdr went through the generic fm_treehouse_lease_get journal path, so this is a new regression.

Concrete sequence on a real Treehouse pool:

  1. Spawn task A on Herdr in project P. The copy becomes leased=true with holder=A, and A's meta has no lease fields.
  2. Spawn task B (any backend) in P. fm_treehouse_records_reserved reaches bin/fm-wake-lib.sh:2225 for A's record: fm_treehouse_record_lease fails, there is no treehouse_lease_ line, and fm_treehouse_legacy_unleased is false because the copy is leased. Result: "REFUSED: retained task A names pool copy ... without a verified matching durable lease". Only one Herdr worker per project can exist at a time.
  3. Relaunch A: bin/fm-spawn.sh:4271 refuses for the same reason.
  4. Tear down A: bin/fm-teardown.sh:2776 refuses with "no verified identity for the copy's pool reservation", so the task cannot be cleaned up.

The same gap applies to upstream's t3code lease (fm-spawn.sh:5426, holder=$ID, no meta fields). A sibling issue: the Herdr/t3code claim block (fm-spawn.sh ~6219) now uses the fork's refuse-if-any-claim fm_treehouse_slot_owner_claim, while upstream's abort path relied on the next spawn replacing a stale claim.

Fix: send Herdr (and t3code) through the fork's journaled fm_treehouse_lease_get / structured-holder path and record treehouse_lease_id/holder in meta, keeping upstream's explicit cd into the leased copy. Alternatively, record the Treehouse lease_id and holder from these gets so the shared checks can verify them.

  • 🚨 bin/fm-spawn.sh:1952 - Bug introduced by round 1's herdr-lease-identity fix. That fix sent Herdr and t3code through spawn_lease_treehouse_slot (fm-spawn.sh:1725), which creates state/&lt;id&gt;.treehouse-acquire and keeps it after any failure. It left upstream's unguarded abort returns in place, so an abort can now hand the copy back while still keeping the journal that names it.

Concrete t3code sequence:

  1. A t3code ship spawn of task A in project P leases a copy at :5465.
  2. freshen_spawn_worktree_base fails with exit 1, or thread creation fails with a code other than 1. The abort trap prints "retaining Treehouse lease recovery journal" (:2034), and the T3CODE_LEASED block (:1952-1966) runs treehouse return --force $WT, which succeeds.
  3. The pool entry is now unleased, but $STATE/A.treehouse-acquire/allocation.json still names it.
  4. Every later fresh spawn in P from this home reaches fm_treehouse_records_reserved (fm-wake-lib.sh:2229-2259). The journal's path is a pool slot and fm_treehouse_lease_matches fails, so the spawn is refused with "unresolved Treehouse acquisition journal … reconcile its lease". A retry of A is refused at :4328. The project stays blocked until someone removes the journal by hand.

Before round 1, t3code kept no journal, so it did not fail this way.

The same class appears at:

  • The Herdr abort return (:2045-2057). It runs for polytoken pre-launch aborts once the pane is confirmed gone. test_abort_returns_a_clean_lease_once_the_pane_is_gone (tests/fm-spawn-herdr-lease.test.sh) asserts only returned and never checks the journal, so it passes with this defect.
  • The operator hints at :1929, :1940, :1963, :2054 and :5470, which tell the operator to run a bare treehouse return --force $WT. That leaves the same blocking journal.

Fix: when TREEHOUSE_ACQUIRE_JOURNAL is set, make these abort returns use treehouse return --if-lease-id &#34;$TREEHOUSE_LEASE_ID&#34; --if-lease-holder &#34;$TREEHOUSE_LEASE_HOLDER&#34;. Remove the journal only after that return succeeds. Point the hints at spawn_treehouse_recovery_steps. The alternative is to skip these returns for journaled leases, as the fork's header contract at :227-236 describes. Either way, update the header and the Herdr test to assert the journal state.

  • 🚨 bin/fm-spawn.sh:1765 - Round 2's spawn_return_treehouse_slot returns a Herdr or t3code copy to the pool and deletes its acquisition journal without first making sure this task's slot claim (.fm-slot-owner) is gone. Round 1 brought back upstream's abort returns and created this problem. Round 2 added the lease-ID guard but did not close it.

Concrete t3code sequence:

  1. A fresh t3code spawn of task A leases a pool copy (:5475) and claims it (:6204, SPAWN_SLOT_CLAIMED=1).
  2. A publishes its record, and :7516 releases the project lock.
  3. fm_backend_t3code_turn_start is refused (:8015) and the spawn exits 1.
  4. In spawn_abort_cleanup, the thread is archived and the T3CODE_LEASED block (:1973) calls spawn_return_treehouse_slot. The copy is now unleased and the journal is deleted.
  5. The fresh-commit rollback removes the meta. The claim-release block (:2075-2088) finds that the project lock is not held and the harness is not polytoken. It prints "the next spawn's claim replaces it" and leaves the claim.

The pool now holds an unleased copy whose claim names A. The fork's refuse-if-any-claim rule makes that message false. The next spawn that gets this copy leases it, then spawn_lease_treehouse_slot refuses it (:1757-1760, "carries an existing slot claim"). That spawn keeps a new live lease and journal, so an operator has to reconcile by hand. That is the stale-claim state the user said must not be repaired by replacement.

The Herdr block (:2046-2057) has the same gap. For example: Herdr with rovo, hermes or opencode2, a launch gate fails after the record is published, rovo_endpoint_cleanup closes the pane, the rollback removes the meta, and the clean copy is returned while the project lock is not held. For polytoken the claim is released only if fm_lock_try_acquire succeeds (:2082). If it fails, the same state remains.

A related ordering problem: the t3code return at :1973 runs before spawn_fresh_commit_rollback (:1980). If the rollback fails, a retained record still names a copy that was already returned.

Neither test catches this. Neither suite runs the claim path: test_spawn_abort_returns_lease_only_after_archive, test_abort_returns_a_clean_lease_once_the_pane_is_gone, and the other tests round 2 added assert only returned and that the journal is gone. None checks .fm-slot-owner.

Fix: in spawn_return_treehouse_slot, the helper both abort sites share, do these steps when SPAWN_SLOT_CLAIMED=1:

  • Hold or retake SPAWN_TREEHOUSE_PROJECT_LOCK for any harness, not only polytoken.
  • Release this task's claim before returning the copy and deleting the journal.
  • If the claim cannot be released, skip the return and keep the journal so the recovery steps apply.

Also run the t3code return only after the record rollback has succeeded and no meta exists, as the Herdr block already does. Correct the stale "next spawn's claim replaces it" warning and comment at :2069-2087, and add an assertion that the claim file is absent after a successful abort return.

  • ⚠️ bin/fm-spawn.sh:1771 - Round 3 added this code (abort-return-leaves-slot-claim fix). It closes the stale-claim path when nothing else holds the project lock. When another spawn holds the lock, it swaps that failure for a project-wide block that needs manual recovery. spawn_return_treehouse_slot takes SPAWN_TREEHOUSE_PROJECT_LOCK again with a single non-blocking fm_lock_try_acquire (fm-wake-lib.sh:1453), so ordinary contention makes the return give up.

Concrete sequence:

  1. A fresh t3code spawn of task A in project P publishes its record. :7521 releases the project lock.
  2. Spawn B in P takes the project lock at :4302. It holds the lock through lease, claim, freshen_spawn_worktree_base, harness setup and publish (:4306-7521), which can take tens of seconds.
  3. A's fm_backend_t3code_turn_start is refused. In spawn_abort_cleanup the thread is archived, the rollback removes the meta, and the T3 block (:2004) calls spawn_return_treehouse_slot. The try-acquire at :1771 fails and the function returns 1.
  4. The copy stays leased, A's .fm-slot-owner claim and state/A.treehouse-acquire journal remain, and the trap prints the manual recovery steps. After B finishes, every later fresh spawn in P is refused by fm_treehouse_records_reserved (unresolved acquisition journal) until an operator reconciles by hand.

The same path exists at the Herdr abort return (:2075), for example when several polytoken or rovo spawns in one project start together.

Fix: in spawn_return_treehouse_slot, replace the single try with the existing bounded wait (fm_lock_acquire_wait_max &#34;$SPAWN_TREEHOUSE_PROJECT_LOCK&#34; &lt;seconds&gt;, fm-wake-lib.sh:1605). This is safe: at both call sites the abort no longer holds a lock the main flow takes before the project lock, because SPAWN_TASK_LOCK is released first and the per-id meta lock comes after the project lock in normal order. Keep the current skip-and-retain behaviour when the bounded wait times out.

🔧 Fix applied.
✅ Re-checked - no issues remain.

⏭️ **Test** - skipped
  • ⚠️ The complete update cannot be judged from the available live evidence. Grok and Claude stopped at folder-trust prompts; accepting them would persist configuration outside the authorized boundary. Real abort cleanup and forge merge guards also remain untested. Re-run with operator-pretrusted lab launches, the required worker backend, and an authorized disposable forge PR.
  • ⚠️ live validation verdict: inconclusive (6 of 11 scenarios were driven live against the product); untested: Abort a worker during project-lock contention: temporary contention permits cleanup, while timeout retains the lease, claim, and journal., Launch Grok and safely steer its composer., Run a Claude primary through idle compaction while preserving supervision., Aggregate away-mode contribution classifications across homes without treating expired evidence as measured., Attempt a merge with no CI evidence or a changed PR head and observe refusal.
  • Live validation: ⚠️ inconclusive - 6 of 11 scenarios driven live against the product
Scenario Result Live Evidence
Open Bearings: the four-section page renders preserved job names, and selecting queued work updates its selection count. ✅ pass live Live Bearings desktop; Live Bearings mobile; Generated Bearings page
Drain notifications: an uncovered completion appears once while an unanswered decision remains visible. ✅ pass live wake-live-first.txt, wake-live-second.txt, wake-live-decision.txt
Type a Codex draft: the real worker composer changes from empty to pending. ✅ pass live codex-worker-live.log; codex-worker-composer-result.json
Create a Herdr task through Firstmate: commands run in the intended directory and cleanup confirms the endpoint is gone. ✅ pass live herdr-adapter-live.log
Attempt to replace a slot claim or return the wrong lease: both refuse; the matching return succeeds without a leftover claim. ✅ pass live treehouse-live.log; treehouse-live-allocation.json; treehouse-live-returned.json
Read a public merged PR through the real GitHub CLI: Firstmate reports its merged state. ✅ pass live pr-state-live.log; pr-state-response.txt
Abort a worker during project-lock contention: temporary contention permits cleanup, while timeout retains the lease, claim, and journal. ⏸️ untested no Fixture-backed regressions passed and reproduced failure before the fix. Polytoken is absent from PATH, and no disposable authenticated T3 Code endpoint was supplied. Provide one of those backends for…
Launch Grok and safely steer its composer. ⏸️ untested no Grok stopped at folder trust. The operator must pretrust this checkout or authorize the narrowly scoped persistent trust write before rerunning.
Run a Claude primary through idle compaction while preserving supervision. ⏸️ untested no The real primary, with supervision enabled in its disposable home, stopped at folder trust. Pretrust the checkout or authorize that persistent choice before rerunning.
Aggregate away-mode contribution classifications across homes without treating expired evidence as measured. ⏸️ untested no Focused fixture-backed cases passed after correcting temporary-home placement. A live multi-home workflow requires pretrusted running primaries; Claude and Grok launches remained at trust prompts.
Attempt a merge with no CI evidence or a changed PR head and observe refusal. ⏸️ untested no No authorized disposable forge PR was supplied for guarded merge attempts. This phase forbids executing the delivery PR phase; provide a dedicated forge lab and explicit test authority.
  • bash tests/fm-spawn-herdr-lease.test.sh before and after adding the contention regression
  • bash tests/fm-wake-drain-outcome-backstop.test.sh
  • bash tests/fm-contributions.test.sh; re-ran its three setup-affected cases with normal temporary directories
  • Executed the contention regression against 62c15fad and confirmed failure before the fix
  • Executed a focused 60-second contention-timeout check
  • FM_PR_STATE_LIVE_E2E=1 bash tests/fm-pr-state-live-e2e.test.sh
  • Drove disposable Herdr sessions exclusively through bin/fm-herdr-lab.sh, including Firstmate adapter creation, command delivery, capture, and cleanup
  • Drove real Treehouse allocation, claim-conflict refusal, mismatched-return refusal, and matching return
  • Launched real Codex, Grok, and Claude in disposable private tmux sessions with 160×45 grids
  • Classified real Codex worker captures before and after typing an unsent draft
  • Built Bearings with real Lavish, exercised selection in Chromium, and captured desktop/mobile screenshots
  • Drove notification drains and Bearings snapshot generation through production CLIs
  • Stopped disposable sessions and servers; removed transient worktree files
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

KostadinP and others added 30 commits October 14, 2026 15:51
…re, including absolute paths (kunchenguid#7307)

* fix(composer): treat OpenCode >= 1.18 right-aligned cwd:branch as furniture

OpenCode 1.18.31 draws the worker pane's working directory and branch
right-aligned inside the left-bar composer rows above the Build footer,
wrapped over up to three rail-width fragments whose final fragment
continues onto the footer row's right end. The fragments are RGB 128
grey with luminance exactly on the ghost-luma ceiling, so they survive
ghost stripping, and the left-bar classifier read them as unsent typed
text: every idle 1.18.31 pane answered pending, which skipped the
steering doorbell, the watcher's re-ring ladder, and /exit typing.

_fm_composer_leftbar_cwd_start recognises the run structurally and
position-gated: contiguous single-token rows immediately above the
footer row whose gap after the bar exceeds half the row, whose
fragments plus the footer row's gap-separated right-hand tail
concatenate to a path, optionally followed by :<branch>. A path-shaped
string typed at the composer's left edge is still typed text, so a
wrong call can only defer, never inject. Extraction shares the same
rule so extracted composer content stays user-scoped.

* no-mistakes(review): drop dead footer-tail concat, add live short-cwd fixture

* no-mistakes(review): accept only ~/ cwd rail; lone slash stays pending

* no-mistakes(review): require footer row for leftbar cwd furniture walk

* no-mistakes(review): Require topmost cwd fragment to carry ~/ prefix

* no-mistakes(document): Correct cwd furniture recognition doc to topmost-fragment check

* fix(composer): gate cwd rail on region width; correct version story

Review round on the independent PR review: the position gate now measures
the gap against the region's width (the widest trimmed plain row across
first..last), so a short space-prefixed home path typed into an otherwise
empty composer no longer reads empty; the right-half lone-token residual
is pinned explicitly. The cwd:branch furniture is documented as present
since OpenCode 1.18.0 (upstream anomalyco/opencode#36457, merged
2026-07-11), not a 1.18.31 layout change. The 1.18.30 capture comment
notes it omits the directory footer, and a cropped-composer extraction
assertion scopes user content to the typed row above the rail.

* no-mistakes(document): correct OpenCode cwd-furniture version framing and doc typos

* fix(composer): accept an absolute cwd rail outside $HOME as OpenCode furniture

Refs kunchenguid#4632, builds on kunchenguid#5030.

* no-mistakes(review): Harden live abs-cwd check waits and qualify rail comment

* no-mistakes(review): Fix composer-lib relative path in OpenCode harness doc

* no-mistakes(test): Relax live check's DONE wait for wide OpenCode panes

* no-mistakes(document): Separate absolute-cwd verification output block from following prose

---------

Co-authored-by: Konrad Heimel <[email protected]>
…mpt (kunchenguid#6682)

* fix: name the Claude exit picker on existing stale wakes

A pane parked on that picker still read as healthy quiet after Enter was refused. The existing stale and wedge reports now carry the dialog name, including through away-mode escalation.

Refs kunchenguid#4754

* no-mistakes(review): fix: report exit picker on terminal-status away stales

* no-mistakes(document): docs: describe exit-picker reporting in stale supervision

* no-mistakes(review): fix: drop away stale marker when second-mate picker closes

* fix: keep the exit-picker name off paths main does not already run

A second mate stays exempt from stale capture, and a finished worker in away mode no longer ages into a wedge. The name remains on the stale and wedge wakes a worker already raises.

* no-mistakes(review): name the exit picker on wedge deferral reasons

* no-mistakes(review): limit exit-picker name to plain stale and wedge escalation
…uid#7308)

* feat(afk): Spend-Obergrenze beim Eintritt aus der lebenden Worker-Zahl

Ohne ausdrückliches --spend nimmt der Eintritt in den Away-Modus die Zahl der
gerade im Home stehenden gewöhnlichen Worker als Obergrenze, damit der Modus
laufende Parallelität nicht einengt. Der bisherige Default bleibt Untergrenze,
0 bleibt ausgeschlossen, und ein ausdrückliches --spend gewinnt weiterhin.

Die Zählung bekommt mit `live-workers` genau eine Implementierung in
bin/fm-afk-contract.sh. bin/fm-spawn.sh liest sie dort statt mit einer eigenen
Schleife, sodass Eintritt und spätere Sperre nicht auseinanderlaufen können.

* no-mistakes(document): Remove misplaced afk spend-cap plan

---------

Co-authored-by: ladwein <[email protected]>
…ion paths (kunchenguid#6965)

* fix(bin): guide supervision through completed-scout cleanup

* no-mistakes(document): Document completed-scout cleanup ownership and regression coverage

* no-mistakes(test): Allow confined lab overrides and verify live scout cleanup

* no-mistakes(test): Clarify per-task cleanup reporting and verify live outcomes
…o the job's timeout (kunchenguid#7240)

* fix: recheck a worker paused on its own background job

A worker that declares `paused:` on its own background job and then misses the job's completion stays idle until the long declared-wait recheck, because the first-sight alert spends the declaration's throttle and nothing else names when the job must have ended.
The worker pause instructions now say that `until` for such a job is its start plus its timeout, and the watcher already rechecks once when that time passes.
The recovery playbook now tells the supervisor to verify the condition a declared wait names before reporting the wait as healthy.

Fixes kunchenguid#7239

* test: give the background-job until test headroom over its quiet round

The first absorb round of the until test may take four poll cycles of up to 30 s each on a loaded runner.
With `until` only 15 s ahead, that time could pass during the round and fail the test although the watcher behaves correctly.
Set `until` 120 s ahead so the window covers those four cycles, as CONTRIBUTING asks of fixture windows.

* chore: retrigger CI

* chore: retrigger CI

* no-mistakes(review): Rebuild bg-job until test with passed until, no sleep

* no-mistakes(review): Restore bg-job absorb checks and assert due recheck marker

---------

Co-authored-by: pedromuller-del <[email protected]>
…dapter (kunchenguid#6679)

* feat: add Command Code crewmate and scout adapter

Add `commandcode` as a verified worker runtime for crewmate and scout work
only, so Firstmate can dispatch workers on Command Code models such as
deepseek/deepseek-v4.1-flash.

- Detection: the anchored `command-code` process title identifies the
  adapter in fm-harness.sh and the shared liveness classifier.
- Launch: fm-spawn passes --yolo, --trust, --skip-onboarding, the model, an
  effort only where the model's accepted set is verified, and the typed
  launch brief after --; taste-learning state is kept out of git.
- Busy state: a tracked mod, bin/fm-commandcode-mod.ts, is loaded per
  process with --mod and --mod-option, writing run_start/run_end/session
  end through fm-busy-event.sh; no user or project settings are edited
  (Command Code's --config persists globally, so it is never used).
- Control: one Escape interrupts; the idle double-Escape Rewind picker is a
  recognized hazard that exit refuses and interrupt dismisses; /quit exits.
- Composer: the bright truecolor placeholder is read with an
  identity-scoped ghost ceiling, and the tmux adapter supplies the identity
  for a cursor parked below the footer; Herdr reports it natively as `cmd`.
- Attribution: the fleet commit-msg strip removes the CommandCodeBot
  trailer.
- Docs, harness reference, verification record, portable regressions, and
  the FM_COMMANDCODE_SIGNALS_LIVE live guard.

* no-mistakes(review): Drop flash-fast effort pairs; correct identity-probe cost comments

* no-mistakes(ci): I fixed both Greptile findings the way you asked. Both new regression tests fail on the old code and pass now. The changes are not committed. **ci-1: Command Code on zellij, cmux and orca.** The rule that must hold is that a Command Code worker only runs on a backend that tells Firstmate the pane is Command Code. Without that, its idle placeholder never reads as an empty composer, so steering stalls. `bin/fm-spawn.sh` now refuses `--harness commandcode` unless the backend is tmux or herdr. The error reads: `commandcode is verified on the tmux and herdr backends only; backend=<b> cannot prove its composer empty. Select backend tmux or herdr.` - The check runs after both the harness and the backend are known, so it covers fresh spawns and `--relaunch`. - It runs before any pane, worktree, task record or busy state is created. - New test in `tests/fm-commandcode-harness.test.sh`: tries a scout spawn on each of zellij, cmux and orca (with a fake `orca` that reports ready). It checks for the refusal and that nothing was launched, no task record was written and busy state was not armed. It needs no real backend installed. - Documented in `docs/configuration.md`, the Command Code adapter reference and the `fm-spawn.sh` header. **ci-2: an old process signalling its replacement.** The rule is that the `turn-ended` notification may only be raised under the same generation check as the idle write. The mod used to touch the file itself after the writer returned, which left a gap for a relaunch to slip in. - `bin/fm-busy-event.sh apply` takes a new `--turn-ended` flag. It touches `state/<id>.turn-ended` while still holding the writer lock, after the generation check passes. A stale generation is refused with no touch, and the flag is rejected on any subcommand other than `apply`. - `bin/fm-commandcode-mod.ts` no longer touches files itself. On `run_end` it passes `--turn-ended` unless the turn was interrupted. - New test in `tests/fm-commandcode-harness.test.sh`: a fake writer accepts the idle write and then arms a replacement before the mod continues. It asserts no notification appears. - New test in `tests/fm-busy-state.test.sh`: the notification is raised for the current generation, not for a stale one, and not outside `apply`. **Checks run:** - Passing: `fm-commandcode-harness`, `fm-busy-state`, `fm-busy-adapter-wiring`, `fm-backend`, `fm-documentation-audiences`, and `bash -n` on the changed shell files. - `fm-bootstrap.test.sh` fails one case ("backend=herdr must fail closed on its own missing session CLI"). It fails the same way on an untouched copy of the branch, because herdr is installed at `/usr/bin/herdr` on this machine. - `bin/fm-lint.sh` could not run because ShellCheck 0.11.0 is not on PATH, so the changed shell files have not been linted. **Not changed:** Devin's hook does the same thing outside this PR: it runs `apply ... && touch` in `bin/fm-devin-config.sh`. That predates this PR and is not in the changed area, so I left it alone

* no-mistakes(ci): I fixed ci-sc2016. ShellCheck is not installed on this machine, so I could not confirm that the lint warning is gone. **The rule that was broken:** the repo lints with ShellCheck at its default severity, which also fails on info-level notes. Any single-quoted `$` that is meant to stay literal needs a scoped disable comment that says why. Only one place in the changed area needed this: the racing-writer `printf` in `tests/fm-commandcode-harness.test.sh`. Its format string writes `"$2" "$3"` on purpose, so the generated fake writer reads its own arguments when it runs. **The fix:** I added one line just above that `printf`: `# shellcheck disable=SC2016 # positional params expand in the generated writer.` The repo already does this the same way, for example in `tests/fm-afk-launch.test.sh` and `tests/fm-ask-user-authority.test.sh`. Nothing else changed, so the test behaves exactly as before. **Checks run:** - `bash -n tests/fm-commandcode-harness.test.sh` passes. - `bash tests/fm-commandcode-harness.test.sh` passes all six cases, including the busy-mod case with the racing writer. **Not run:** `bin/fm-lint.sh` stops with "ShellCheck not found" because ShellCheck 0.11.0 is not on PATH and there is no copy in the repo. I did not install it, since installs outside the worktree are off limits here. The upstream lint run will be the first ShellCheck pass on this change. The change is not committed

* no-mistakes(review): Hard-code Command Code ghost luma ceiling at 160

* no-mistakes(review): Test commandcode relaunch refusal off tmux/herdr before stop

* no-mistakes(document): Note Command Code fixed ghost luma ceiling in config docs
Claude spills a hook output over 10,000 characters and shows only the first
2,000 plus a saved-file path. The re-emit prints captain.md and learnings.md
last, so they never reached the session. Print a short cue first that names
the saved file and the memory files, and document the cap.

Refs kunchenguid#6303
…kunchenguid#7302)

* fix: retry transient contribution reads once

* fix: classify contribution read errors safely

Address review findings for kunchenguid#7262 by parsing only gh status forms, recognizing real DNS errors, refusing GraphQL not-found retries, clearing per-URL diagnostics, and restoring exit-137 handling.

* fix: recognize bare gh HTTP errors

Complete kunchenguid#7262 review fixes by accepting bodyless gh status lines and keeping all GraphQL errors out of transient network classification.

* no-mistakes(review): Classify gh network errors by Go error tokens

* no-mistakes(document): Note why contribution 404 reads are never retried

* no-mistakes(review): Retry message-less GraphQL HTTP 5xx on closing read

* fix: retry transient contribution reads once

* fix: classify contribution read errors safely

Address review findings for kunchenguid#7262 by parsing only gh status forms, recognizing real DNS errors, refusing GraphQL not-found retries, clearing per-URL diagnostics, and restoring exit-137 handling.

* fix: recognize bare gh HTTP errors

Complete kunchenguid#7262 review fixes by accepting bodyless gh status lines and keeping all GraphQL errors out of transient network classification.

* no-mistakes(review): Classify gh network errors by Go error tokens

* no-mistakes(document): Note why contribution 404 reads are never retried

* no-mistakes(review): Retry message-less GraphQL HTTP 5xx on closing read
…tion (kunchenguid#7338)

* fix(bin): let a backlog captain hold bound the watcher's wedge escalation

A stuck worker whose task was held for the captain through
bin/fm-captain-hold.sh kept wedge-escalating every STALE_ESCALATE_SECS,
because wedge_wait_evidence only read the status line. It now also reads
the open backlog captain call (task_captain_call_open) and defers to the
existing captain-facing long recheck, silent while the away record exists.

* no-mistakes(review): Publish no wait age for backlog captain holds

* no-mistakes(review): Let an elapsed paused-until line fall through to backlog hold

* no-mistakes(document): Document backlog captain hold in wedge wait-evidence contract
…guid#5404)

* fix(bin): parse Lavish list-form results and refuse unparsed blocks

Lavish emits its queued prompts in TOON list form instead of table form as
soon as the items stop being uniform, for example when some annotations carry
a nested target object or a message carries an attachments table. The adapter
only recognized the table header, so read reported a complete, empty result
and answers closed nothing.

Move the result parsing into one shared reader used by read, answers, and
reconciles that accepts both forms, keeps only column-zero headers, skips
nested structures only beneath the field that opened them, and counts
anything it cannot account for as malformed. An unrecognized header naming
the block is now malformed rather than an empty result, answers and
reconciles exit nonzero when the result is not fully accounted for, and the
queued-content check treats a list header as content.

Refs kunchenguid#4726

* no-mistakes(document): Document Lavish capture formats and incomplete-result handling

* test: expect captain_message_count for the open-board list-form capture
…uid#5835)

* fix(pi): let the supervision branch claim Orca stale wakes

The watcher keys Orca endpoints by terminal=, but the branch dispatcher
only indexed window=, so every Orca stale row vetoed the wake scan and
went to main. Index both endpoint fields.

Local hotfix ahead of upstream; refs kunchenguid#5623.

* test(pi): cover terminal-keyed Orca stale rows in branch dispatch

Pins the terminal= endpoint lookup: a terminal-keyed stale row queued with
another eligible row must resolve to its task in both routine and heartbeat
scans, instead of vetoing the wake to main.

* no-mistakes(document): Update supervision dispatch doc for Orca terminal-keyed stale rows

* fix(pi): reject conflicting wake endpoint ownership

Index task keys and window/terminal aliases through one ownership check.
Ambiguous records must leave the wake on MAIN instead of selecting the
last task and possibly bypassing another owner's open decision.

Cover duplicate terminals and collisions with window and task keys in
both record orders while preserving unique terminal routing.

* no-mistakes(document): Document conflicting alias ownership as scope corruption

* fix(pi): retain ownership claims from incomplete task records

Check endpoint and task alias ownership before project eligibility so a
projectless record cannot lose its open decision to another terminal owner.
Require project context before decision filtering can grant routing scope.

Cover missing and empty project fields in both record orders, and preserve
refusal for a uniquely mapped terminal without project context.

* no-mistakes(review): Fix canonical routing ownership and custom SDK event handling

* no-mistakes(review): Preserve dedicated custom processing run ownership

* no-mistakes(document): Clarify Pi event handling and fail-closed routing documentation
…anches (kunchenguid#7368)

* feat(bin): add a forge=external review rail that never pushes task branches

A project whose review tool uploads its own snapshot of the worker's local
commits can now be registered [direct-PR forge=external]. Workers on such a
project never need to push a branch to publish, and must never push a task
branch to the shared origin.

- fm-project-mode.sh: external joins the closed forge set; never detected,
  refused on local-only, and +yolo reports yolo=off with a refusal.
- fm-dod-lib.sh: external ships direct-PR only; its first rule forbids origin
  and task-prefixed pushes, its Definition of done renders the home's
  config/external-review.md adapter verbatim, and the ready-report gate
  accepts `done: review <url> uploaded for review` on the URL alone or, with a
  recorded backup remote, once HEAD is on the backup namespace.
- fm-git-push-guard.sh (new): per-task pre-push guard refusing pushes to
  origin or a URL matching origin's, task-branch and task-prefixed refs on any
  remote, and refs outside the backup prefix on the backup remote.
- fm-git-strip-ai-trailers.sh: install gains --push-guard and --no-strip.
- fm-spawn.sh: refuses yolo, a missing adapter, and an unusable backup
  remote before launch; installs the guard even under keep-ai-trailers; and
  records forge=external, backup_remote=, and backup_prefix=.
- fm-review-check.sh (new): records review= and review_head= with no merge
  watch, and publishes the child's ready line in a secondmate home.
- fm-promote.sh refuses promotion onto forge=external, because a scout
  launches without the guard.
- Docs: docs/external-review-forge.md (design), configuration.md's new
  "External review tool" section, scripts.md, and the ship-landing and
  project-management skills.

* no-mistakes(review): Drop string-grep hook assertion from external-review spawn test

* no-mistakes(document): Note forge=external contract token and direct-PR-only composition
…uid#7387)

Ein Lauf, den sendCustomMessage startet, traegt eine Custom-Nachricht und
keinen prompt. Das Lesen des prompt an dieser Stelle warf, womit jeder
solche Lauf mit einem Fehler auftauchte statt zu starten.

Die Verengung dagegen steht seit 8c9c67d im Zweig, ein Test, der sie
benennt, fehlte: die einzige Abdeckung lag beilaeufig in einem
Abbruch-Fall der Abwesenheits-Haltung und verschwindet mit ihm. Der neue
Fall erweitert den bestehenden Mirror-Test und prueft, dass ein solcher
Lauf weder wirft noch als Dialog gespiegelt wird.

Gegenprobe: ohne die Verengung wirft genau dieser Fall mit
"Cannot read properties of undefined (reading 'trim')".

Co-authored-by: thelad-dev <[email protected]>
…nchenguid#7409)

* fix(tmux): verify exact endpoint membership

* fix(tmux): preserve exact target forms

* test(tmux): align endpoint fixture lifecycles

* test(tmux): guard isolated cleanup and shell reader

* no-mistakes(review): Limit tmux .pane target split to window indexes
… plain row (kunchenguid#7395)

* fix(bin): stop misreading opencode's own footer as pending composer text

An idle OpenCode composer classified as `pending`, and that verdict gates every
typed-plane action firstmate owns: fm-send skips the doorbell, and fm-control
refuses both relaunch and exit. A firstmate operator lost a full session to it and
had to type into worker panes by hand three times.

Root cause: opencode 1.19 draws the mode/model footer's identifying cells
de-emphasised (mode word RGB 67;133;190, middle-dot separators 111;110;105,
luminances ~119.8 and ~109.7, both under fm_composer_strip_ghost's 128
threshold). That helper exists to answer "what did the human type?", so it
deleted exactly the cells that identify the footer. The `^(Build|Plan)` anchor
then became unreachable on every styled backend - tmux, Herdr, and Zellij - not
just one pane, because the unstyled row keeps its styling bytes everywhere.

The fix proves the footer from both forms of that row: the ghost-stripped
content and the ANSI-stripped plain row. Proving it on the form ghost stripping
cannot reach is the whole repair.

What makes that safe, and why the previous argument was not: the earlier draft
argued safety by noting that on a plain capture the two forms collapse to one
string, so the verdict is unchanged. That is true and carries no weight, because
styled=0 is the only configuration where the new proof does nothing. The
exemption is safe because a row reaches the plain form only when the
ghost-stripped row still fails the pattern, which means the stripped content is
non-empty while its own leading Build/Plan cell was deleted as ghost. Nothing
opencode draws de-emphasises a typed row's leading cells - only its furniture is
drawn dimmed - so the only rows the plain form admits beyond the stripped one
are de-emphasised furniture, and the mode footer is the only furniture opencode
draws that opens with a mode word. That is self-confirming rather than asserted,
and it is the argument to recheck when a new opencode release moves a colour.

A review also caught a second change riding along in the same diff: the footer
pattern had been widened from `[[:space:]]+` to `[[:space:]]*`, admitting
`Build ·x` and a bare `Build ·`. Both read as more typeable than the footer, so
they moved the verdict in exactly the direction this rule exists to prevent. No
recorded opencode footer ends at the dot, so the original `+` matches every real
capture and the widening is reverted.

Verification:
- fm-lint.sh exit 0 on pinned shellcheck 0.11.0 and actionlint 1.7.12.
- fm-doc-audience-check.sh ok across 119 surfaces and 757 local links.
- tests/fm-composer-lib.test.sh green via bin/fm-test-run.sh.
- The new regression case fails on exactly one assertion when this change is
  reverted: "opencode 1.19.0 de-emphasised footer row: expected empty, got
  'pending'", which is the reported symptom.
- Confirmed end to end against live panes rather than only fixtures: a real idle
  opencode 1.19.0 worker classified empty after the change and pending before,
  and firstmate reached the worker over the steer channel afterwards.

* no-mistakes(review): fix(bin): apply leftbar footer rule in content extractor; correct cursorless claim

* no-mistakes(document): document opencode 1.19 footer furniture and extractor coverage

* no-mistakes(document): document ghost-luma knob coupling to opencode footer furniture

* no-mistakes(document): document opencode de-emphasised footer recognition invariant

* no-mistakes(review): fix(docs,bin): correct ghost-luma knob direction, gate plain-row extraction

* no-mistakes(review): fix(docs,bin,tests): correct ghost-luma knob wording, share plain-content helper, cover Herdr/Zellij idle

* no-mistakes(document): narrow overstated backend coverage claim in runtime-backends.md

* no-mistakes(document): document leftbar footer override and opencode 1.19 pointer
…7406)

Der Kopf des Tests sagt, jedes Programm werde so gestartet, wie
bin/fm-spawn.sh es startet. Im codex-Zweig von launch_cmd fehlte dabei
--disable hooks, das fm-spawn im crewmate- und scout-Pfad setzt.

Ohne den Schalter parkt codex auf dem Hook-Vertrauensdialog ("N hooks
are new or changed"), dessen Auswahl auf "Review hooks" aufsetzt und der
mit der Tastenebene dieses Werkzeugs nicht beantwortbar ist. Der Lauf
meldet dann die Tuerklingel als nicht befolgt, obwohl er ueber die
Tuerklingel gar nichts ausgesagt hat - und das auf jedem Checkout, weil
schon die projekteigene .codex/hooks.json den Dialog aufzieht.

Dazu eine knappe Zusicherung am Startrezept, damit der Schalter beim
naechsten Umbau nicht wieder still ausfaellt.

Co-authored-by: ladwein <[email protected]>
…kunchenguid#7096)

* fix(bin): store only classified review fields in contribution records

A pull observation stored GitHub's raw reviews payload, so a PR with a few
hundred reviews wrote a record past the 1 MiB read cap and every pending,
verdict and ack read then refused the whole home. Project each stored review
to id, state, submitted_at, commit_id and user.login, the only fields the
classifier reads, and add a many-review regression.

* no-mistakes(document): clarify contribution record read cap in script header
…7216)

* fix(pi): retain custom-event handling and processing cancellation

* fix(pi): identify custom triggers before legacy prompt narrowing

* no-mistakes(test): Correct branch fixture retirement and verify real notification ownership

* no-mistakes(document): Clarify Pi event boundaries and verification scope

* fix(pi): retain custom-event handling and processing cancellation

* fix(pi): identify custom triggers before legacy prompt narrowing

* no-mistakes(test): Correct branch fixture retirement and verify real notification ownership

* no-mistakes(document): Clarify Pi event boundaries and verification scope

* no-mistakes(review): Fix SDK1.1 prompt staging and verify branch context

* no-mistakes(document): Clarify SDK prompt compatibility and branch-context verification

* no-mistakes(test): Require dual-SDK compiler checks; execution remains pending

* no-mistakes(document): Correct SDK typecheck documentation and stale dependency claims

* no-mistakes(document): Correct stale Pi typecheck documentation and ownership pointers

* no-mistakes(ci): Fixed SC2329 in tests/fm-pi-primary-types.test.sh by inlining EXIT cleanup. Also fixed a reproduced macOS npm-prefix/lockfile path failure without changing dependency pins or assertions. Canonical targeted lint, strict TypeScript 5.9.3 checks against Pi 1.1.0 and 1.2.0, and success/failure cleanup checks pass. Both behavior-shard failures were upstream npm ETARGET errors in workflow steps unchanged from base; no workflow/runtime changes warranted. Hosted CI remains for the outer executor

* fix(test): reconcile queued processing probes after rebase

* no-mistakes(document): Correct Pi compiler-phase documentation and stale CI comments
…guid#6380)

* fix(cursor): verify cursor-agent by running it, not by name

Cursor's installer writes its `cursor` IDE shim through the
~/.local/bin/cursor -> cursor-agent symlink, which can replace a versioned
cursor-agent with a script that only prints "No Cursor IDE installation
found" and exits non-zero. That file keeps Cursor's own name and install-tree
path, so the name shortcut (and the structural check alone) accepted it and
every Cursor spawn launched the broken file instead of the working agent alias.

A launch candidate now has to print Cursor's CLI identity under the bounded
probe, or carry the structural evidence and run --help successfully. Hosts
without a bounded runner keep the structural verdict, as before.

* no-mistakes(document): Align cursor launch-verify docs with runtime

* no-mistakes: apply CI fixes

* test: restore fm-watch-triage ack_stopped_cycle assertion

The CI fix round loosened ack_stopped_cycle so a drain that prints no
acknowledgement command and exits zero counts as success. That test is
unrelated to the Cursor executable verification this branch changes, so
restore its original assertion rather than mask a watcher failure here.

* no-mistakes: apply CI fixes

* no-mistakes: apply CI fixes

* no-mistakes: apply CI fixes

* fix(bin): restore fm-afk-contract clock sampling

A CI fix round changed how fm_afk_contract_cmd_enter samples its epoch.
That away-mode behavior is unrelated to the Cursor executable verification
this branch changes, so restore it here and leave any fix to its own change.

* fix(cursor): load the timeout library only when a probe runs

Sourcing bin/fm-timeout-lib.sh at load time made every consumer of
fm-cursor-lib.sh, including the session-lock and turn-end hook paths that
never probe, depend on that file being next to it. Load it lazily from the
probe instead.

* no-mistakes: apply CI fixes

* no-mistakes: apply CI fixes

* no-mistakes: apply CI fixes

* test: restore herdr focus-flash e2e test

A CI fix round edited this Herdr end-to-end test, which is unrelated to the
Cursor executable verification this branch changes. Restore it here and leave
any fix to its own change.

---------

Co-authored-by: ladwein <[email protected]>
…#7422)

* fix(dod): require a PR reference in CI-ready notes

* no-mistakes(review): Recognize Forgejo plural pull request URLs
…ts view (kunchenguid#7434)

* feat(herdr): opt-in project groups with status tags and a sorted agents view

Add config/herdr-project-groups (absent or off: unchanged behavior). When on,
Firstmate tags each Herdr task pane, and its own projected workspace, with
display-only fm_group/fm_state/fm_task/fm_sort tokens, sets a Herdr agents
view sorted by group then status (needs-captain, problem, running, done), and
places a new projected task at the end of its own group inside the parent
block with the same single verified move as before.

The watcher reconciles tags once per poll and a spawn tags its task at once;
bin/fm-herdr-groups.sh also previews (plan), clears, and prints or appends
suggested sidebar rows with a backup. The agents view helper needs python3.
The only test-runner change is the serial weight hint for the new suite.

* docs(herdr): record the live lab check of project groups

The four hand checks for tags, the sorted agents view, placement at the
end of the group, and clear passed against a real Herdr 0.9.5 server
(protocol 22) in a guarded lab session.

* docs(herdr): align project group verification notes with the live check
…guid#7410)

ps -o lstart= renders in the caller's locale, so a lock or claim owner
recorded under one locale (de_DE renders "Di Okt 13 ...") failed identity
verification under another, was declared dead, and a second worker split
the queue: two serve loops reclaimed and reaped each other's live jobs,
which vanished mid-claim and failed staged jobs with exit 125 and no
output. Pin LC_ALL=C in fm_remote_job_process_start and pin the
cross-locale invariant with a regression test.

Co-authored-by: researchworldwide2026 <[email protected]>
* Guard fm-crew-state overrides by task-name basename

bin/fm-crew-state.sh honours FM_CREW_STATE_META_OVERRIDE and FM_CREW_STATE_STATUS_OVERRIDE only when the override's basename is the requested task's own .meta or .status file name.
An override naming a different task, for example one inherited through a server started inside another task's snapshot child, falls through to the task's own records under the state directory.
A snapshot's own override, which names the task it was captured for, is still honoured.
This is complementary to kunchenguid#5622, which keeps the overrides out of the Herdr server launch: whatever path leaks an override, the reader never trusts one that names a different task.
Regression tests cover a mismatched override being ignored and a matching one being honoured.

* no-mistakes(review): Make metadata override tests behaviorally distinct
…kunchenguid#7415)

* fix(bin): re-anchor a Claude session's lock so /clear keeps ownership

A same-session confirmation over a live lock line 1 outside the current
harness ancestry now rewrites line 1 to the session's CLAUDE_PID anchor
under the claim lock, so a later /clear re-key in the same process is
still proven by ancestry instead of being refused as a foreign owner.

Fixes kunchenguid#6820

* fix(bin): move task leases with a session-lock re-anchor

A same-session re-anchor rewrote lock line 1 off a live pid while task
leases still named that pid, so a lease held by main or the supervision
branch read as stale and the other actor could claim the task. The
re-anchor now takes the lease-command lock after the claim lock and,
in the same critical section as the line-1 write, rewrites leases
recorded against the old pid to the new anchor (fm_lease_rekey_holder).
If the lease-command lock stays busy past a short bound, the
confirmation keeps line 1 as before and a later acquisition re-anchors.

The foreign-owner reproduction now asserts the re-anchor contract: the
same trusted id from a live process outside the owner's ancestry moves
line 1 onto that process's CLAUDE_PID, and a different id is refused
against it afterwards. The ancestry membership loop is shared through
one session-lock lib helper.

The earlier commit dropped the ancestry suite's dead-front-end reclaim
phase; that coverage lives in the existing reclaim tests
(test_verified_reclaim_keeps_new_sidecar and the Stop auto-arm's
test_reclaims_stale_session_lock_before_arming).

* fix(bin): record the lock holder for a lease pinned before a re-anchor

The supervision host pins FM_LEASE_HOLDER_PID to lock line 1 at the
start of each engine turn. A same-session re-anchor inside that turn
moved line 1 to a new pid while the pinned holder stayed alive, so a
later claim or same-actor refresh in the turn recorded the old pid and
the lease read stale, letting main claim the branch's task.

A claim now records the live line 1 when the pinned holder is alive but
is no longer line 1. Another session takes the lock only from a dead
owner, so that state comes from a re-anchor; a dead pin is still
recorded as before and its lease stays stale.

* no-mistakes(review): Move auto-arm rewake session pid with lock re-anchor

* no-mistakes(review): Align startup-network downgrade test and lock-rewrite comment

* no-mistakes(review): Correct lock takeover and re-anchor signal-window comments

* no-mistakes(review): Record re-anchor rewake and pinned-claim verification evidence

* no-mistakes(document): Update network-checks diagnostic for re-anchored lock holder
* feat(bin): watch a tool's published version through version_url

A watched tool whose CLI never announces its own updates can name a version_url; the document is fetched read-only inside the probe bound, its first dotted number is the published version, and an update is reported when that is newer than the version PATH resolves. Claude Code is the shipped example entry.

* no-mistakes(review): Compare published versions against newest installed tool copy

* no-mistakes(document): Clarify watched-tool version URL documentation
…mand loads them (kunchenguid#7287)

* fix(pi): keep a live session's extension markers when a nested Pi command loads them

A short-lived Pi command started from inside a live session, such as the
`pi --help` capability probe, auto-loads the two primary extensions. Both
treated the session lock as owned because an ancestor holds it, so the child
rewrote `.pi-watch-extension-loaded` and `.pi-turnend-extension-loaded` with
its own pid and exited. Session start then rejected the markers and printed a
false `PI_WATCH_EXTENSION: not loaded` alarm.

Before writing, each extension now reads the marker's pid and leaves the
marker untouched when that pid is a live strict ancestor of the current
process. A missing marker, a dead pid, the current pid, or a live pid outside
the ancestry still writes as before, so a fresh start and a relaunch over a
dead session bind unchanged. Lock ownership and the reader are untouched.

Fixes kunchenguid#5202.

* fix(tests): drop apostrophes from the nested-load marker heredocs so stock Bash 3.2 parses them
* fix(bin): supersede an orphaned Claude auto-arm claim after a session restart

An auto-arm claim is open only while its owner still descends from the session-lock pid.
A hook whose session exited mid-cycle stays alive with no parent to receive its exit 2, so deferring to its claim left the home unsupervised until the next session turn.
The replacement session's first Stop now takes the next generation, attaches to the running watcher, and delivers the wake itself, while the orphan goes silent.
A claim with no readable numeric session lock is never open.

* no-mistakes(review): accept pid-1 ancestor and session-id-matched autoarm claims

* no-mistakes(review): pin autoarm session-id claim signal to lock holder pid

* no-mistakes(review): exercise real lock recovery in orphan supersession tests

* no-mistakes(review): record lock-holder pid-identity instead of bare pid

* no-mistakes(document): complete autoarm claim-open coverage list

* no-mistakes(ci): Greptile finding ci-1 (hidden session-lock dependency in bin/fm-wake-lib.sh) fixed. Invariant: every function fm-wake-lib.sh calls must either be defined in that file or explicitly loaded by it before the call, so a caller sourcing only the wake library cannot silently degrade. Violating sites in the changed area: fm_autoarm_claim_open's fm_session_lock_recorded_session_id call, and the sibling writer fm_autoarm_claim_next's fm_session_lock_trusted_session_id call (which would otherwise silently omit the two new ledger fields). Both fixed at one shared boundary: a new lazy loader _fm_wake_require_session_lock (bin/fm-wake-lib.sh:38), matching the file's existing _fm_wake_require_classify/_fm_wake_require_timeout idiom, invoked immediately before each call. Lazy rather than top-level source so the ~40 scripts sourcing the wake library pay no harness-identity machinery cost; no circularity (fm-session-lock-lib.sh sources only fm-cursor-lib.sh). No new behaviour, state, or fallback. Verification: sourcing only fm-wake-lib.sh, a claim with broken ancestry plus matching sidecar id and matching recorded lock-holder identity now reads OPEN and the session-lock library is loaded on demand; ordinary descent path unaffected. Suites tests/fm-claude-stop-autoarm.test.sh, tests/fm-turnend-guard.test.sh, tests/fm-wake-queue.test.sh all pass; shellcheck -S warning reports only the pre-existing SC2034 present on HEAD. tests/fm-session-lock-ancestry.test.sh fails its final case ("the pty-host was not reparented to init after the daemon ended") identically with the change reverted, so that failure is a pre-existing WSL environment behaviour, not caused by this fix

* no-mistakes(document): Clarify auto-arm claim documentation
)

* wip: polytoken worker adapter (detection, launch, wiring, control, composer; tests mid-iteration)

* feat: verify the polytoken worker adapter (crewmate + scout)

Add polytoken 0.8.19 as a verified crewmate/scout adapter on the
captain-approved TUI-pane-plus-REST hybrid: the pane keeps inspection
and backend parity while the control verbs ride the session daemon's
typed REST API.

Detection is ancestry alone on the anchored polytoken comm (a tool
subprocess's parent is the session daemon, verified live), with the
launch boundary clearing every foreign ORCA_/FM_ marker plus the fixed
harness-identity set. The launch generates the per-task worker config
dir (mirrored operator config with the unattended permission posture
enforced, because a project config.yaml fully replaces the global
config), the worker role-contract facet (no model pin, delegation and
facet switching denied at the tool registry), and the worktree hook
layer binding the verified busy pair - pre_user_prompt and
pre_model_turn open, stop closes - to a no-argv generated writer. The
readiness gate binds the session id, port, and credential into task
metadata through sessions --format json and fails loudly on any
first-start dialog, because the license terms are a blocker by captain
decision and --accept-license-terms is never passed.

Interrupt is POST /turn/cancel with its typed settle (the TUI has no
interrupt chord, so no key is ever improvised), exit is /quit, and a
cancelled turn's busy close is written by the control plane because no
stop hook fires. The composer is the verified separated shape with
polytoken as its second owner, and Enter mid-turn queues, so the
busy-queued conversion applies. Crewmate and scout only: a secondmate
launch is refused, and a project's own .polytoken/hooks.json is refused
rather than clobbered.

* no-mistakes(review): Fix polytoken launch flag order, token argv, live guard

* no-mistakes(document): Correct polytoken REST doc comment and token-on-stdin invariant

* no-mistakes(lint): Silence intentional SC2016 in polytoken live guard treehouse shim

* no-mistakes(review): Retire polytoken pool wiring, drop FIFO config, test env clearing

* no-mistakes(review): Scope polytoken teardown wiring removal to untracked polytoken files

* no-mistakes(review): Refuse existing polytoken hook layer before writing any wiring

* no-mistakes(document): Note teardown as consumer of harness wiring-path table

* no-mistakes(review): Retire only firstmate-generated polytoken worktree wiring

* no-mistakes(review): Guard polytoken hook layer before relaunch cleanup arms

* no-mistakes(document): Note relaunch also skips git-tracked wiring paths

* test: stub polytoken in the refused-relaunch fixture

The refused relaunch onto polytoken resolves the polytoken binary before
its hook-layer refusal, so the case failed on CI hosts without the real
CLI installed. A no-op stub on the fixture PATH stands in; it is never
launched.

* no-mistakes(review): Guard polytoken interrupt close; refuse whitespace hook paths

* no-mistakes(review): Snapshot busy record after cancel settles before idle close

* no-mistakes(review): Guard interrupt close with pre-cancel snapshot and sync recheck

* no-mistakes(test): Clear inherited AGENT at the polytoken launch boundary

* no-mistakes(document): Document guarded polytoken interrupt close and whitespace refusal

* test: preserve Polytoken hook refusal coverage with explicit pins

* no-mistakes(review): Refuse invalid Polytoken relaunch profiles before stopping the worker

* no-mistakes(document): Document Polytoken relaunch refusals before stopping the worker

* fix: scope worker wiring cleanup to Polytoken

* fix(bin): point Polytoken workers away from tool_flow for the task directory

Polytoken 0.9.0 offers no launch-time path grant: tool_flow's file_read
refuses the Firstmate task directory while the direct file tools reach it
under the generated bypass matcher. The worker facet now says so, and the
verification record carries the live evidence.

* fix(bin): leave the pool as found when a fresh spawn fails

A fresh spawn that fails and leaves no task record now closes the endpoint
it opened before its launch was delivered, so the shell whose treehouse get
leases the slot ends and the pool gets the slot back. It also removes the
harness wiring, task temp root, and staged launch file it wrote, and drops
its slot claim under a retaken project lock after metadata publication.

* no-mistakes(review): Stop pre-launch refusals pointing at windows abort cleanup closes

* fix(bin): scope failed-spawn cleanup and the Running-for busy row to Polytoken

The failed-spawn pool cleanup and the Running-for busy row now apply only to
Polytoken, so every other harness keeps main's abort behavior, header text,
operator messages, and harness-less busy union. Tests prove the Polytoken
path cleans up and a non-Polytoken refused launch behaves as on main.

* no-mistakes(review): Scope submit-core busy reads to Polytoken pane identity

* no-mistakes(review): Stop polytoken treehouse isolation refusal pointing at closed window

* test: track the spawned window in the Polytoken harness tmux stand-in

Main now requires exact tmux window membership before sending keys
(aa9ab04), and the Polytoken harness stand-in listed no windows, so the
merged spawn could never deliver Enter. Record the created window, list
it, and forget it on kill, as tests/fixtures.sh does.

* no-mistakes(document): Scope fresh-endpoint abort comment to Polytoken spawns

* no-mistakes(ci): Lint 1 (ci-3) was caused by this PR, and I fixed it. Commit d18014e added the in_polytoken_submit_pane() subshell helper to tests/fm-polytoken-harness.test.sh. That helper sources bin/fm-tmux-lib.sh without the `# shellcheck source=/dev/null` line that every other source in the file carries (lines 55-63 and 200). With --external-sources, ShellCheck followed the library into the subshell and flagged `local pid=$!` at line 690 as SC2031. The fix is that one missing line, added above the source at line 318. After the fix, `shellcheck -x` reports nothing on the file, `bin/fm-lint.sh tests/fm-polytoken-harness.test.sh` passes with full extended analysis, and the Polytoken harness test passes. Behavior portable serial 2 (ci-1) and serial 5 (ci-2) failed in timing-sensitive tests this PR does not touch, so I made no code change for them. I reran both test files in full on this branch on macOS, and both passed (rc=0, no failures). tests/fm-supervision-host.test.sh passed, including the 'host-only transition veto changed Pi's existing offer rule' check that failed in CI. tests/fm-remote-secondmate-lifecycle-e2e.test.sh passed, including 'watch liveness: a dead remote secondmate is auto-relaunched on its own host with one wake'. Main's own recent CI runs (38950070853, 38719784765) also failed on different timing assertions in these serial shards. Together that points to runner flakes rather than a defect in this change

* no-mistakes(review): Retake per-id spawn lock before Polytoken abort deletions

* no-mistakes(document): Document per-id lock guard on Polytoken abort cleanup

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
jazz127 and others added 14 commits November 5, 2026 23:33
…uid#6330)

* fix: update green behind PR before merge

* no-mistakes(review): Update behind PRs for any method; await UNKNOWN

* no-mistakes(review): Cap update-branch wait under merge locks

* no-mistakes(review): Fix stale update-wait header comment

* docs: clarify branch update authority

* fix(merge): require branch-update consent and stop on failure

* no-mistakes(review): Await UNKNOWN after waivers; report unreadable post-update state

* fix(merge): pin branch update to checked head

Send expected_head_sha with the REST update so a concurrent push cannot
advance an unchecked replacement head.

Refuse a head mismatch without retrying against the new head.

* no-mistakes(document): Clarify branch-update consent, head pinning, and polling guidance

* fix(bin): stop waits on non-check refusals

Pending or missing checks must not mask draft, state, conflict, or required-check read refusals after a branch update.

* no-mistakes(review): Refuse blockers while awaiting updated pull request heads

* no-mistakes(document): Document immediate refusals during branch update polling
* fix: reap Perl timeout groups when callers are interrupted

* no-mistakes(review): Preserve caller signal handlers after timeout runner cleanup

* no-mistakes(review): Prevent startup interrupt loss and remove parent-death cancellation

* no-mistakes(document): Correct timeout fallback comments and remove stale duplication

* fix: preserve interruption status and use monotonic timeout clocks

* no-mistakes(document): Correct timeout contract references and document monotonic timing

* no-mistakes(review): Preserve active traps in Perl timeout cleanup

* no-mistakes(document): Clarify Perl timeout trap restoration
…#7923)

* Preserve independent watcher history for distinct endpoints

* no-mistakes(review): Complete shared watcher-marker key migration

* no-mistakes(document): Document shared watcher marker identity

* no-mistakes(ci): Fixed SC1091 by adding the daemon’s missing ShellCheck source annotation. Focused full-analysis lint, bash syntax validation, and git diff --check passed. Tier 2: the existing lint gate enforces this correction; no runtime redesign was needed

* no-mistakes(ci): Implemented bounded SHA-256 endpoint keys and a failing-first long-endpoint regression, which now passes. ci-1 remains unchanged as unrelated. Incomplete: focused lint reports SC2030/SC2031 in fixture setup. The command guard rejected focused testing as indirect execution. Stopped without bypassing or retrying. Pipeline must resolve lint and finish verification

* test: scope watcher fixture environment to child commands

* docs: explain watcher key upgrade reset and cache cleanup

* no-mistakes(test): Confirm six required scenarios pass; exclude optional Codex probe

* chore: remove accidental validation scratch

* no-mistakes(document): Replace obsolete watcher-key comment with owner pointer

* no-mistakes(review): Use shared keys in Pi-stream fixtures

* no-mistakes(document): Deduplicate watcher marker cleanup guidance
* test: wait for recovered orphan-readiness runners instead of a fixed marker poll

The lifecycle-orphan-readiness section polled each recovered source's
handled marker for a fixed 10s after reconcile. Reconcile only confirms
each launch; each runner then polls, captures, takes a silent verdict and
a terminal verdict, and the two runners take their verdicts in turn under
the home's extension lifecycle lock. On a CPU-starved host that chain of
short host and fixture processes can exceed 10s, so the section flaked.

Wait for the recorded runner process groups to exit, bounded by the
coordinator's section-lane deadline, then assert the handled markers,
retirement and claim release. On timeout, kill the recorded runner groups
and sweep the home before failing, and track the home so any exit sweeps
it.

* no-mistakes(review): Bound recovered-runner wait to coordinator deadline
… (kunchenguid#8192)

* test: cover TypeSafe dispatch base URL configuration

* test: compare the recorded TypeSafe endpoint argument

* feat: allow an explicit TypeSafe dispatch base URL

* no-mistakes(review): Use literal TypeSafe endpoint test expectations

* no-mistakes(document): Correct TypeSafe base URL documentation

* no-mistakes(ci): Implemented ci-2 and ci-3: malformed TypeSafe addresses fail before credential lookup, and both curl paths disable URL globbing. Added focused regressions. Tier 1 fixes address the shared boundaries. Configured local lint passed. Required ci-box tests and the documentation audience check remain unverified. The command guard rejected the inspection/preflight command as “Privilege escalation in chained command.” No retry or bypass was attempted

* fix: reject brackets in TypeSafe base paths

* no-mistakes(review): Narrow TypeSafe host validation

* no-mistakes(document): Clarify TypeSafe base URL documentation

* test: isolate dispatch base from exported settings
…rk (kunchenguid#8030)

* fix(teardown): refresh remote refs before refusing work as unlanded

Teardown read landed work from the task copy's remote-tracking refs, so work
pushed from another checkout was refused until someone fetched by hand. Refresh
each remote, bounded and without pruning, when the refs do not show the work.
A failed refresh leaves the refs as they were, still refuses, and names the
remote in the refusal.

* no-mistakes(review): Use fixed 30-second fetch bound, removing timeout override

* no-mistakes(ci): Final state, replacing the earlier reports: the fix is in the worktree, uncommitted. The full run of tests/fm-teardown.test.sh did NOT complete: it was stopped at the 20-minute background limit after about 126 of 156 tests. All 126 passed with no failures, including the new test. The remaining ~30 did not run, so the outer test phase must run the full file. Change: validate_worktree_teardown_safety re-runs the dirty check through read_worktree_dirt right after refresh_remote_refs and refuses the same way if it fails or finds work. Added one test, test_edit_saved_during_refresh_refuses, covering local-only, direct-PR and no-mistakes modes. Kept the timed-out agent's code change; removed its extra second test and fake-git hook, per the one-test instruction. Verified: the new test failed with the recheck removed and passed with it restored. bash -n on bin/fm-teardown.sh passed. Not verified: shellcheck is not on PATH, so it did not run. The path where the recheck itself cannot read the copy has no test, per the one-test instruction. Partial log: /tmp/fm-teardown-full.log
Take upstream through bf05a4f. Drop the six-column bearings board and its GitHub fleet-board sync. Keep Jobs page, away-mode, composer, Codex launch, treehouse lease, and stopped-helper behavior where upstream has not already replaced it.
Restore procevent_surface_queued and procevent_surface_after_output, and keep the inbox-row skip inside them.

Drop the stale supervision-host split selection test.
Give the single-pin account spawn its own worktree so the durable Treehouse lease on the first spawn does not block it.
Record duration hints for the three fork suites that pushed the serial unmeasured share over the coverage guard.
The spawn-slot suite's serial hint was 218000 ms, below its 284000 ms local sample.
With that measured weight, eleven serial shards pack every bin above the 1200000 ms budget.
Twelve shards bring the heaviest bin back under that budget, and the normal-tier job timeout stays the hang tripwire.
@peterOC26 peterOC26 closed this Nov 8, 2026
@peterOC26 peterOC26 reopened this Nov 8, 2026
…107-s1

# Conflicts:
#	.agents/skills/afk/SKILL.md
#	bin/fm-supervision-host.sh
#	docs/supervision-host.md
#	docs/supervision-protocols/supervision-host.md
#	tests/fm-remote-secondmate-lifecycle-e2e.test.sh
#	tests/fm-supervision-host.test.sh
Ordinary and Herdr spawns follow upstream treehouse get again, and the JSON lease preflight stays on t3code. Teardown matches the current task's slot claim to FM_HOME when its state directory is overridden.
The t3code CLI probe runs after the project-policy refusals, so a tracked config refusal still happens before any treehouse call. A herdr pool lease held by the same task satisfies a retained record that has no JSON lease. Teardown of an unclaimed t3code record still removes the env files it wrote and returns the slot. The test treehouse treats an unconditional return of an unlisted path as a no-op, and a conditional lease return of a missing path still fails.
Slot lease helpers and the spawn steps that acquire them move to bin/fm-treehouse-slot-lib.sh. Wake still loads them, and that file is its own lint root. Source-aware shellcheck of bin/fm-spawn.sh no longer parses that body, which crossed the 8G resident cap.
Herdr records the task id as the pool lease holder and writes no
treehouse_lease lines. Teardown treated that held copy as an
unverified reservation and refused. A holder that matches this task
is that reservation. A holder that does not match still refuses.
Queued-check delivery markers use process substitution. Parsing them
inside the source-aware check of bin/fm-spawn.sh crosses the 8G
resident cap. They now live in their own lint root, and the
reservation preflight lives with the other slot helpers.
The presentation abort fixture's treehouse get exits empty, so it takes no slot and leaves no allocation.json. Requiring that journal conflicts with the upstream lease. An orphaned herdr record likewise has no lease fields, and retiring it no longer demands them.
Herdr leases with treehouse get --lease and writes no acquisition journal. Abort cleanup was still calling the journal return, so a clean aborted lease stayed taken. It now uses treehouse return --force, which is what upstream does.
The 8G resident cap still kills the source-aware check of bin/fm-spawn.sh after the earlier splits. The fork-only brief pointer, lease probe, journal retain, and closing-epoch watch now live in their own lint roots. The followed graph is smaller than upstream, which passes this partition.
A bare call to the lease helper makes the source-aware check of bin/fm-spawn.sh exhaust the 8G resident cap. Repeating the path the helper already stored, through a command substitution, brings that check back in line with upstream.
A source-aware check of bin/fm-spawn.sh exhausts the 8G resident cap on this branch and on upstream.
Upstream passes because that memory failure is retried once without source following.
The merge kept the retry behind FM_LINT_MEMORY_FALLBACK, so the same exhaustion failed the lint partition.
The lint test and the portable-shard note now expect that default retry.
The 16 GiB address-space default stays.
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.