Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
fix: reap verified-superseded branches from /tmp worktrees instead of holding them forever
Adam Eivy2c53ab7912c9
diff --git a/server/lib/worktreeOwnership.js b/server/lib/worktreeOwnership.jsindex 19221adb3a..b5f0bce87e 100644--- a/server/lib/worktreeOwnership.js+++ b/server/lib/worktreeOwnership.js@@ -96,8 +96,18 @@ function normalizedRoots(roots) {* allowLiveClaim?: boolean,* ageMs?: number|null,* staleClaimIdleMs?: number,+ * unmanagedIdleMs?: number,* requireKnownLiveness?: boolean,* }} options+ * `unmanagedIdleMs` is the one way past the location gate: a tree outside every+ * configured root is admitted (to the remaining gates, not past them) once its+ * `ageMs` reaches the window. Off by default — the location hold is+ * unconditional for a caller whose only proof is "merged and clean", because a+ * checkout a live run just cut from the default branch looks exactly like that+ * (#10270). Name a window only with an INDEPENDENT proof the tree is unwanted;+ * the superseded reap has one (a verdict recorded against the tip and dirty+ * paths, plus a backup written before removal), and the idle floor is what+ * covers the one thing that proof cannot see — a process still standing in it.* @returns {string|null}*/export function worktreeOwnershipReason({@@ -110,13 +120,14 @@ export function worktreeOwnershipReason({allowLiveClaim = false,ageMs = null,staleClaimIdleMs,+ unmanagedIdleMs,requireKnownLiveness = false,} = {}) {if (!path) return 'worktree-missing-path';const configuredRoots = normalizedRoots(roots);const root = configuredRoots.find((candidate) => isPathInsideDir(candidate.path, path));- if (configuredRoots.length > 0 && !root) return 'worktree-unmanaged-location';+ if (configuredRoots.length > 0 && !root && !unmanagedTreeIdle(ageMs, unmanagedIdleMs)) return 'worktree-unmanaged-location';const agentId = worktreeAgentId(path);const mustBeAgentWorktree = root?.requireAgentId ?? requireAgentId;@@ -168,11 +179,27 @@ export function worktreeOwnershipReason({* @returns {string|null} ISO timestamp*/export function worktreeHoldExpiresAt({ nowMs = Date.now(), ...options } = {}) {- const { ageMs, staleClaimIdleMs, allowStaleClaim = false } = options;+ const { ageMs, staleClaimIdleMs, unmanagedIdleMs, allowStaleClaim = false } = options;+ const reason = worktreeOwnershipReason(options);+ // The location hold lapses only for a caller that named an idle window (the+ // gate above already admitted a tree past it, so this is always a future date).+ if (reason === 'worktree-unmanaged-location') {+ if (!Number.isFinite(ageMs) || !Number.isFinite(unmanagedIdleMs)) return null;+ // Dated only when the window is the LAST thing holding the tree: the location+ // gate runs first, so a lock or a live agent behind it is reported only once+ // the tree is idle — and those lift on a decision, not a clock.+ if (worktreeOwnershipReason({ ...options, ageMs: unmanagedIdleMs }) !== null) return null;+ return new Date(nowMs + (unmanagedIdleMs - ageMs)).toISOString();+ }+ if (reason !== 'worktree-human-claim') return null;// Without this caller's opt-in the window never lapses, so there is no date to// report even though the tree does read `worktree-human-claim`.if (!allowStaleClaim) return null;if (!Number.isFinite(ageMs) || !Number.isFinite(staleClaimIdleMs)) return null;- if (worktreeOwnershipReason(options) !== 'worktree-human-claim') return null;return new Date(nowMs + (staleClaimIdleMs - ageMs)).toISOString();}++/** True once a tree outside the managed roots has sat idle for the caller's window. */+function unmanagedTreeIdle(ageMs, unmanagedIdleMs) {+ return Number.isFinite(ageMs) && Number.isFinite(unmanagedIdleMs) && ageMs >= unmanagedIdleMs;+}diff --git a/server/lib/worktreeOwnership.test.js b/server/lib/worktreeOwnership.test.jsindex a8dd9bae9e..42461b3816 100644--- a/server/lib/worktreeOwnership.test.js+++ b/server/lib/worktreeOwnership.test.js@@ -55,6 +55,27 @@ describe('worktree ownership', () => {})).toBe('worktree-missing-agent-id');});+ it('admits a tree outside every configured root only through an explicit idle window', () => {+ // The unmanaged-location hold is unconditional by default (#10270: a release+ // worktree deleted a minute after a live run cut it). A caller that has an+ // independent proof the tree is unwanted — the superseded reap, whose branch+ // carries a recorded verdict and a backup — may name an idle window, after+ // which the tree is judged by the remaining gates like any managed one.+ const outside = { path: '/private/tmp/portos-elsewhere', roots: [{ path: COS_ROOT, requireAgentId: false }], activeAgentIds: new Set() };+ expect(worktreeOwnershipReason(outside)).toBe('worktree-unmanaged-location');+ expect(worktreeOwnershipReason({ ...outside, unmanagedIdleMs: 3_600_000, ageMs: 60_000 })).toBe('worktree-unmanaged-location');+ expect(worktreeOwnershipReason({ ...outside, unmanagedIdleMs: 3_600_000, ageMs: 3_600_000 })).toBeNull();+ // An unknown age never counts as idle.+ for (const ageMs of [null, undefined, NaN]) {+ expect(worktreeOwnershipReason({ ...outside, unmanagedIdleMs: 3_600_000, ageMs })).toBe('worktree-unmanaged-location');+ }+ // The window only replaces the LOCATION gate; every later hold still applies.+ expect(worktreeOwnershipReason({ ...outside, unmanagedIdleMs: 3_600_000, ageMs: 7_200_000, locked: true })).toBe('worktree-locked');+ expect(worktreeOwnershipReason({+ ...outside, path: `${outside.path}/agent-live`, unmanagedIdleMs: 3_600_000, ageMs: 7_200_000, activeAgentIds: new Set(['agent-live'])+ })).toBe('worktree-active-agent');+ });+it('fails closed when agent liveness is unknown and permits an explicitly non-agent root', () => {expect(worktreeOwnershipReason({path: `${COS_ROOT}/agent-unknown`,@@ -150,6 +171,19 @@ describe('worktreeHoldExpiresAt', () => {expect(claim({ staleClaimIdleMs: undefined })).toBeNull();});+ it('dates an unmanaged-location hold to the end of the caller\'s idle window', () => {+ const outside = {+ path: '/private/tmp/portos-elsewhere', roots: [{ path: COS_ROOT, requireAgentId: false }],+ activeAgentIds: new Set(), unmanagedIdleMs: 3_600_000, ageMs: 600_000, nowMs: NOW+ };+ expect(worktreeHoldExpiresAt(outside)).toBe(new Date(NOW + 3_000_000).toISOString());+ // No window from this caller, or no measured age: nothing to date.+ expect(worktreeHoldExpiresAt({ ...outside, unmanagedIdleMs: undefined })).toBeNull();+ for (const ageMs of [null, undefined, NaN]) expect(worktreeHoldExpiresAt({ ...outside, ageMs })).toBeNull();+ // A lock outlives the window and the gate reports it first, so no date.+ expect(worktreeHoldExpiresAt({ ...outside, locked: true })).toBeNull();+ });+it('gives no expiry to holds that are not the stale-claim window', () => {expect(worktreeHoldExpiresAt({ path: `${COS_ROOT}/agent-live`, activeAgentIds: new Set(['agent-live']), ageMs: 2_000, staleClaimIdleMs: 7_000 })).toBeNull();expect(worktreeHoldExpiresAt({ path: null })).toBeNull();diff --git a/server/services/branchReconcile.js b/server/services/branchReconcile.jsindex 383f24cf85..904db0452a 100644--- a/server/services/branchReconcile.js+++ b/server/services/branchReconcile.js@@ -122,6 +122,17 @@ export const STALE_CLAIM_IDLE_MS = 7 * 24 * 60 * 60 * 1000; // 7 days// teardown and still turns a week-long park into a single recheck.export const SHIPPED_CLAIM_IDLE_MS = 60 * 60 * 1000; // 1 hour+// The idle floor a verified-SUPERSEDED branch's worktree must clear before the+// reap may take it from OUTSIDE the managed roots (an agent's `/tmp` checkout —+// see reconcileWorktreeRoots for why merged cleanup never goes there). The+// superseded reap has what merged cleanup lacks: a verdict recorded against this+// exact tip and dirty set, and a backup written before anything is removed. The+// one thing neither proves is that no process is still standing in the tree, so+// the same hour SHIPPED_CLAIM_IDLE_MS uses covers that — without it the hold was+// permanent, and the coordinator was told "PortOS reaps it" about four branches+// PortOS never would.+export const SUPERSEDED_UNMANAGED_IDLE_MS = SHIPPED_CLAIM_IDLE_MS;+/*** A claim branch without an issue number is never a valid /claim deliverable.* It can be left behind when a scheduled claim run creates its worktree before@@ -336,7 +347,7 @@ async function getOpenPrsByHead(repoPath, providedOrigin, { forgeExec = null, fo* @param {{ path:string, locked?:boolean, activeAgentIds?:Set<string>, ageMs?:number, staleClaimIdleMs?:number, roots?:Array<{path:string, requireAgentId?:boolean}> }} input* @returns {string|null}*/-export function worktreeProtectionReason({ path, locked, activeAgentIds, ageMs, staleClaimIdleMs = STALE_CLAIM_IDLE_MS, allowLiveClaim = false, roots = [] }) {+export function worktreeProtectionReason({ path, locked, activeAgentIds, ageMs, staleClaimIdleMs = STALE_CLAIM_IDLE_MS, allowLiveClaim = false, roots = [], unmanagedIdleMs }) {if (!path) return null;return worktreeOwnershipReason({path,@@ -347,6 +358,7 @@ export function worktreeProtectionReason({ path, locked, activeAgentIds, ageMs,allowLiveClaim,ageMs,staleClaimIdleMs,+ unmanagedIdleMs,});}@@ -363,7 +375,9 @@ export function worktreeProtectionReason({ path, locked, activeAgentIds, ageMs,* Reconcile once deleted a release worktree a minute after a still-running* release run created it (#10270). So such a tree holds, at any age, with its* branch; the operator's explicit merged-branch cleanup (`deleteMergedBranches`,- * `includeUnmanagedTrees`) keeps its wider reach.+ * `includeUnmanagedTrees`) keeps its wider reach, and the superseded reap —+ * which carries a recorded verdict and a backup, not just "merged and clean" —+ * takes one after SUPERSEDED_UNMANAGED_IDLE_MS.** Arbitrary names are accepted INSIDE these roots on purpose: claim trees are* `claim-*`, not `agent-*`, and still need their stale/shipped retirement.@@ -388,7 +402,7 @@ function reconcileWorktreeRoots(repoPath) {* @param {{ path:string|null, locked?:boolean, activeAgentIds?:Set<string>, ageMs?:number|null, staleClaimIdleMs?:number, allowLiveClaim?:boolean }} input* @returns {string|null} ISO timestamp*/-export function worktreeProtectionExpiresAt({ path, locked, activeAgentIds, ageMs, staleClaimIdleMs = STALE_CLAIM_IDLE_MS, allowLiveClaim = false, roots = [] }) {+export function worktreeProtectionExpiresAt({ path, locked, activeAgentIds, ageMs, staleClaimIdleMs = STALE_CLAIM_IDLE_MS, allowLiveClaim = false, roots = [], unmanagedIdleMs }) {if (!path) return null;return worktreeHoldExpiresAt({path,@@ -397,6 +411,7 @@ export function worktreeProtectionExpiresAt({ path, locked, activeAgentIds, ageMroots,allowStaleClaim: true,allowLiveClaim,+ unmanagedIdleMs,ageMs,staleClaimIdleMs,});@@ -1165,7 +1180,12 @@ export async function reapSupersededBranches(repoPath, defaultBranch, supersededconst reaped = [];const held = [];const skipped = [];- const hold = (b, failure) => { held.push(b); skipped.push({ branch: b.branch, ...failure }); };+ // A held entry names its own hold (and when it lifts, if on a clock) so the+ // coordinator prompt and the park log can say WHY rather than "something".+ const hold = (b, failure) => {+ held.push({ ...b, holdReason: failure.reason, ...(failure.retryAt ? { holdRetryAt: failure.retryAt } : {}) });+ skipped.push({ branch: b.branch, ...failure });+ };for (const b of superseded || []) {const verdict = b.verdict || {};@@ -1186,6 +1206,10 @@ export async function reapSupersededBranches(repoPath, defaultBranch, superseded// verdict was recorded against these same paths (checked above) and// `prepare` copies them into the backup before anything is removed.requireCleanWorktree: false,+ // A worktree outside the managed roots is reachable here and nowhere else —+ // the verdict and the backup are the proof the location gate asks for, and+ // the idle floor covers a process still in the tree. See the constant.+ unmanagedIdleMs: SUPERSEDED_UNMANAGED_IDLE_MS,prepare: async () => {const backup = await backupSupersededBranch(repoPath, b, { defaultBranch, ...(cosDir ? { cosDir } : {}) }).catch((err) => ({ error: err.message }));@@ -1225,7 +1249,7 @@ export async function reapSupersededBranches(repoPath, defaultBranch, superseded** @param {string} repoPath* @param {object} b - a gathered branch entry- * @param {{ activeAgentIds?: Set<string>, staleClaimIdleMs?: number, allowLiveClaim?: boolean, label: string, requireCleanWorktree?: boolean, prepare?: () => Promise<any> }} opts+ * @param {{ activeAgentIds?: Set<string>, staleClaimIdleMs?: number, allowLiveClaim?: boolean, label: string, requireCleanWorktree?: boolean, unmanagedIdleMs?: number, prepare?: () => Promise<any> }} opts* `prepare` runs after every gate has passed and before the first irreversible* step, and aborts the retirement by resolving to `{ error }`. That is the only* place work like "write a recoverable backup" belongs: earlier it is paid for@@ -1238,6 +1262,10 @@ export async function reapSupersededBranches(repoPath, defaultBranch, superseded* tree is the branch's whole deliverable and it accounts for that tree twice* over — the verdict was recorded against exactly these paths, and `prepare`* copies them out before anything is removed. Never set it false without both.+ *+ * `unmanagedIdleMs` (default none) admits a worktree outside the managed roots+ * once it has sat idle that long. Same bar: only a caller with proof beyond+ * "merged and clean" may name it — see SUPERSEDED_UNMANAGED_IDLE_MS.* @returns {Promise<{ ok: true, prepared?: any } | { ok: false, reason: string, retryAt?: string }>}*/async function retireBranch(repoPath, b, opts) {@@ -1266,7 +1294,7 @@ async function retireBranch(repoPath, b, opts) {});}-async function retireBranchNow(repoPath, b, { activeAgentIds = new Set(), staleClaimIdleMs = STALE_CLAIM_IDLE_MS, allowLiveClaim = false, label, requireCleanWorktree = true, prepare }) {+async function retireBranchNow(repoPath, b, { activeAgentIds = new Set(), staleClaimIdleMs = STALE_CLAIM_IDLE_MS, allowLiveClaim = false, label, requireCleanWorktree = true, unmanagedIdleMs, prepare }) {if (b.worktreePath) {// Never tear down a worktree outside the managed roots (see// reconcileWorktreeRoots), one that's locked, a RECENT human /claim session,@@ -1281,6 +1309,7 @@ async function retireBranchNow(repoPath, b, { activeAgentIds = new Set(), staleCstaleClaimIdleMs,allowLiveClaim,roots: reconcileWorktreeRoots(repoPath),+ unmanagedIdleMs,};const protectedReason = worktreeProtectionReason(gate);if (protectedReason) {diff --git a/server/services/branchReconcile.test.js b/server/services/branchReconcile.test.jsindex daa5b1a7b8..8a5ed91ea1 100644--- a/server/services/branchReconcile.test.js+++ b/server/services/branchReconcile.test.js@@ -109,7 +109,7 @@ import {actionOn, filterActionable, desiredEndState, formatInFlightForPrompt, actionableSignature,limitBranchesForAgent,branchPriorityRank, prioritizeBranches, worktreeProtectionExpiresAt, describeIdleReconcilePark,- SHIPPED_CLAIM_IDLE_MS, STALE_CLAIM_IDLE_MS,+ SHIPPED_CLAIM_IDLE_MS, STALE_CLAIM_IDLE_MS, SUPERSEDED_UNMANAGED_IDLE_MS,isMalformedClaimBranch,listRemoteHeads, upstreamBranchName, parseRemoteHeads, partitionRemoteOrphans, reapOrphanedRemotes,reapSupersededBranches@@ -1605,6 +1605,51 @@ describe('reconcile — cached SUPERSEDED verdicts (#3842)', () => {expect(res.skipped.find((sk) => sk.branch === CLAIM)?.reason).toBe('worktree-locked');});+ // A verified-superseded branch whose worktree lives OUTSIDE the managed roots+ // (an agent's `/tmp` checkout) used to be held with+ // 'worktree-unmanaged-location' on every cycle — a hold nothing ever lifts,+ // so the coordinator was told "PortOS reaps it" about a branch PortOS never+ // would. The verdict and the backup are the independent proof #10270's+ // location gate lacks; a short idle floor covers a process still in the tree.+ it('reaps a superseded branch from an unmanaged location once its worktree has sat idle', async () => {+ const TMP_TREE = '/private/tmp/portos-deep-oversized-order';+ const verdict = {+ branch: BRANCH, repoPath: '/repo', verdict: 'SUPERSEDED', tip: 'aaaaaaa',+ dirtyPaths: [], collisionPaths: ['server/services/thing.js'], replacedBy: ['ffffff1']+ };+ const entry = (worktreeAgeMs) => ({ branch: BRANCH, tip: 'aaaaaaa', worktreePath: TMP_TREE, worktreeLocked: false, worktreeAgeMs, dirtyPaths: [], verdict });++ const young = await reapSupersededBranches('/repo', 'main', [entry(5 * 60 * 1000)], { activeAgentIds: new Set() });+ expect(wt.forceRemoveWorktreeDir).not.toHaveBeenCalled();+ expect(backupSupersededBranchMock).not.toHaveBeenCalled();+ expect(young.reaped).toEqual([]);+ const hold = young.skipped.find((sk) => sk.branch === BRANCH);+ expect(hold.reason).toBe('worktree-unmanaged-location');+ // The hold lifts on a clock, so the park can wake for it instead of waiting out a recheck.+ expect(Date.parse(hold.retryAt)).toBeGreaterThan(Date.now());+ expect(Date.parse(hold.retryAt)).toBeLessThanOrEqual(Date.now() + SUPERSEDED_UNMANAGED_IDLE_MS);+ // The held entry names its own hold, so the prompt and the park log can too.+ expect(young.held[0]).toMatchObject({ branch: BRANCH, holdReason: 'worktree-unmanaged-location', holdRetryAt: hold.retryAt });++ const idle = await reapSupersededBranches('/repo', 'main', [entry(SUPERSEDED_UNMANAGED_IDLE_MS)], { activeAgentIds: new Set() });+ expect(backupSupersededBranchMock).toHaveBeenCalledTimes(1);+ expect(wt.forceRemoveWorktreeDir).toHaveBeenCalledWith('/repo', TMP_TREE, expect.anything());+ expect(git.deleteBranch).toHaveBeenCalledWith('/repo', BRANCH, { local: true });+ expect(idle.reaped).toEqual([BRANCH]);+ expect(idle.held).toEqual([]);+ });++ it('keeps the unmanaged-location hold for merged cleanup, which has no verdict to lean on', async () => {+ git.hasBranchMergeEvidence.mockResolvedValue(true);+ execGit.mockResolvedValue({ stdout: '', exitCode: 0 });+ const res = await cleanupMerged('/repo', 'main', [{+ branch: 'next/issue-2190', worktreePath: '/private/tmp/portos-next-2190', worktreeAgeMs: 30 * 24 * 60 * 60 * 1000+ }]);+ expect(res.cleaned).toEqual([]);+ expect(res.skipped).toEqual([{ branch: 'next/issue-2190', reason: 'worktree-unmanaged-location' }]);+ expect(wt.forceRemoveWorktreeDir).not.toHaveBeenCalled();+ });+it('holds the reap of a superseded branch when an active CoS agent is running in it', async () => {const superseded = [{branch: BRANCH,diff --git a/server/services/cosTaskPreStepBlocks.js b/server/services/cosTaskPreStepBlocks.jsindex d6bd64fb0e..e0646b3c57 100644--- a/server/services/cosTaskPreStepBlocks.js+++ b/server/services/cosTaskPreStepBlocks.js@@ -488,7 +488,7 @@ export async function resolveBranchReconcileBlock(app, taskType, metadata, taskS// lock or a live agent — so name them rather than letting them// vanish into a quiet park; the invisibility is the same failure mode as a// lingering worktree reported as "cleaned 0".- const supersededSuffix = countSuffix(result.superseded, 'branch(es) verified superseded, reap held back');+ const supersededSuffix = countSuffix(result.superseded, 'branch(es) verified superseded, reap held back', (b) => b.holdReason);// Branches somebody is actively working in (a running CoS agent, a live human// /claim, a locked worktree) are classified WIP and never reach `inFlight` — the// reconcile is DONE when they are all that's left, not stuck. Named in the parkdiff --git a/server/services/supersededLedger.js b/server/services/supersededLedger.jsindex 47792b7c1f..c2a67afdfc 100644--- a/server/services/supersededLedger.js+++ b/server/services/supersededLedger.js@@ -190,7 +190,7 @@ export function formatSupersededForPrompt(superseded) {const lines = [`## Already verified SUPERSEDED — reap held back (${superseded.length}) — DO NOT ANALYZE`,'',- 'Each branch below was analyzed by an earlier run and confirmed superseded: the default branch already solves its problem, so merging it would REGRESS shipped work. The verdict is cached and still valid (branch tip, uncommitted change set, and collision paths all unchanged; the replacing commits are still on the default branch). PortOS reaps a verified-superseded branch itself, after backing it up — these are the ones this cycle could NOT take, because something still holds them: a locked worktree, a live CoS agent, or a tip that moved after the verdict was recorded. Do not read these worktrees, do not re-derive the verdict, do not commit, rebase, resolve, or merge anything on them. Report them; the next cycle reaps whatever has since been released.',+ 'Each branch below was analyzed by an earlier run and confirmed superseded: the default branch already solves its problem, so merging it would REGRESS shipped work. The verdict is cached and still valid (branch tip, uncommitted change set, and collision paths all unchanged; the replacing commits are still on the default branch). PortOS reaps a verified-superseded branch itself, after backing it up — these are the ones this cycle could NOT take, because something still holds them: a locked worktree, a live CoS agent, a worktree outside PortOS\'s managed roots that has not yet sat idle for an hour, or a tip that moved after the verdict was recorded. Each one names its hold below. Do not read these worktrees, do not re-derive the verdict, do not commit, rebase, resolve, or merge anything on them. Report them; the next cycle reaps whatever has since been released.',''];for (const b of superseded) {@@ -202,6 +202,7 @@ export function formatSupersededForPrompt(superseded) {if (b.worktreePath) {lines.push(`- Worktree still on disk: \`${b.worktreePath}\` — PortOS reaps it once its hold lifts. Do NOT run the removal yourself.`);}+ if (b.holdReason) lines.push(`- Held this cycle by: \`${b.holdReason}\`${b.holdRetryAt ? ` — lifts at ${b.holdRetryAt}` : ''}`);lines.push('');}return lines.join('\n');diff --git a/server/services/supersededLedger.test.js b/server/services/supersededLedger.test.jsindex d04a1dfe16..8f0c545a74 100644--- a/server/services/supersededLedger.test.js+++ b/server/services/supersededLedger.test.js@@ -243,6 +243,18 @@ describe('formatSupersededForPrompt', () => {expect(out).toContain('/repo/data/cos/worktrees/agent-dead');});+ it('names why the reap could not take the branch this cycle, and when that lifts', () => {+ const out = formatSupersededForPrompt([{+ ...branch(), verdict: entry(), holdReason: 'worktree-unmanaged-location', holdRetryAt: '2026-10-08T05:00:00.000Z'+ }]);+ expect(out).toContain('worktree-unmanaged-location');+ expect(out).toContain('2026-10-08T05:00:00.000Z');+ // A hold with no clock still names itself, without inventing a time.+ const locked = formatSupersededForPrompt([{ ...branch(), verdict: entry(), holdReason: 'worktree-locked' }]);+ expect(locked).toContain('worktree-locked');+ expect(locked).not.toMatch(/lifts at/);+ });+// The reap is PortOS's own deterministic step now (reapSupersededBranches), so// a branch reaching this block is one the reap could not take. Handing the// coordinator a copy-pasteable `worktree remove` would race that step and skip