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
address review (claude): anchor review-loop markers to rendered banner shapes
Adam Eivy2e52253bca41
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.mdindex fcf0abe557..673f3cbaf3 100644--- a/.changelog/NEXT.md+++ b/.changelog/NEXT.md@@ -2,4 +2,4 @@## Fixed-- **CoS TUI agents running `/do:release`/`/do:pr`/`/do:rpr` no longer get prematurely reaped as "done" while a reviewer is still working** — the idle-timeout reaper only special-cased the `/do:next --swarm` merge-queue wait (#2074); a slow multi-reviewer pass (e.g. codex reading a large diff) could go silent past the default 3-minute idle window and get finalized as a false `idle-complete` success before the release ever reached the merge gate, leaving the PR open with the task dashboard showing "completed" (observed on agent-61508f36, PR #2084, which sat open+unmerged for hours). Added a `createReviewLoopTracker` (`server/lib/tuiHandshake.js`) that latches on multi-reviewer-loop chrome ("Review plan:", "Review pass", "Multi-Reviewer", "review loop") and extends the idle reaper's grace to 15 minutes while active — mirroring the merge-queue fix exactly, including surfacing a timeout as a needs-manual-finish failure (`reason: 'review-loop-idle-timeout'`) instead of a silent success.+- **CoS TUI agents running `/do:release`/`/do:pr`/`/do:rpr` no longer get prematurely reaped as "done" while a reviewer is still working** — the idle-timeout reaper only special-cased the `/do:next --swarm` merge-queue wait (#2074); a slow multi-reviewer pass (e.g. codex reading a large diff) could go silent past the default 3-minute idle window and get finalized as a false `idle-complete` success before the release ever reached the merge gate, leaving the PR open with the task dashboard showing "completed" (observed on agent-61508f36, PR #2084, which sat open+unmerged for hours). Added a `createReviewLoopTracker` (`server/lib/tuiHandshake.js`) that latches on multi-reviewer-loop chrome — the literal `Review plan: [...]` banner, a `Review pass N/M` counter, or the `Multi-Reviewer Summary` report heading — and extends the idle reaper's grace to 15 minutes while active — mirroring the merge-queue fix exactly, including surfacing a timeout as a needs-manual-finish failure (`reason: 'review-loop-idle-timeout'`) instead of a silent success.diff --git a/server/lib/tuiHandshake.js b/server/lib/tuiHandshake.jsindex 50dbb3c853..137efb8e7b 100644--- a/server/lib/tuiHandshake.js+++ b/server/lib/tuiHandshake.js@@ -396,26 +396,23 @@ export const REVIEW_LOOP_IDLE_TIMEOUT_MS = 900000;// once it starts waiting on a reviewer pass. Detection is deliberately// conservative, same rationale as MERGE_QUEUE_MARKERS above: a false POSITIVE// only extends the (bounded) idle window, and a false NEGATIVE just preserves-// prior behavior. Matched against ANSI-stripped output, lower-cased.+// prior behavior. Matched against ANSI-stripped output.//-// Kept narrower than a bare 'review pass' / 'review loop' substring match:-// this project's own CLAUDE.md convention text is "run a simplify/self-review-// pass before committing", whose substring "review pass" would otherwise-// latch this tracker for ANY CoS agent's ordinary self-review narration, not-// just a do:release/do:pr/do:rpr run — and this very repo's bundled slashdo-// docs contain the literal phrase "review loop" in prose (e.g. this file's-// own doc references), which a docs-editing agent could echo. The banner is-// matched by REVIEW_PASS_BANNER_PATTERN instead, which requires the digit/-// slash shape ("Review pass 1/2") that only the real banner has.-const REVIEW_LOOP_MARKERS = [- 'review plan:',- 'multi-reviewer',-];--// Matches the literal `--- Review pass {n}/{N}: {REVIEW_AGENT} ---` banner the-// multi-reviewer wrapper prints at the start of each reviewer pass. Anchored-// on the digit/slash shape so it can't match prose like "self-review pass".+// All three patterns are anchored to the literal RENDERED shape rather than a+// bare substring, because this repo bundles the slashdo docs that DESCRIBE+// these banners in prose — `lib/slashdo/lib/multi-reviewer-loop.md` alone+// contains the word "multi-reviewer" dozens of times and the literal phrase+// "Review plan:" once (inside its own instruction text), and this project's+// CLAUDE.md convention text is "run a simplify/self-review pass before+// committing", whose substring "review pass" would otherwise latch on ANY+// CoS agent's ordinary narration or docs-editing — not just an actual+// do:release/do:pr/do:rpr run. Anchoring on the shape only the runtime output+// actually has (a rendered `[...]` agent list, a digit/slash pass counter, or+// the literal report heading) keeps the false-positive rate low without+// weakening true-positive detection of the real banners.+const REVIEW_PLAN_PATTERN = /review plan:\s*\[/i;const REVIEW_PASS_BANNER_PATTERN = /review pass\s+\d+\s*\/\s*\d+/i;+const REVIEW_SUMMARY_PATTERN = /multi-reviewer summary/i;/*** True when a chunk of ANSI-stripped TUI output shows the multi-reviewer loop@@ -427,8 +424,9 @@ const REVIEW_PASS_BANNER_PATTERN = /review pass\s+\d+\s*\/\s*\d+/i;*/export function isReviewLoopSignal(strippedText) {if (typeof strippedText !== 'string' || !strippedText) return false;- const lower = strippedText.toLowerCase();- return REVIEW_LOOP_MARKERS.some((marker) => lower.includes(marker)) || REVIEW_PASS_BANNER_PATTERN.test(strippedText);+ return REVIEW_PLAN_PATTERN.test(strippedText)+ || REVIEW_PASS_BANNER_PATTERN.test(strippedText)+ || REVIEW_SUMMARY_PATTERN.test(strippedText);}/**diff --git a/server/lib/tuiHandshake.test.js b/server/lib/tuiHandshake.test.jsindex 935ed881b3..3861aef5af 100644--- a/server/lib/tuiHandshake.test.js+++ b/server/lib/tuiHandshake.test.js@@ -319,16 +319,20 @@ describe('tuiHandshake — review-loop idle suppression', () => {expect(isReviewLoopSignal(undefined)).toBe(false);});- // Regression for a false-positive latch found in local review: the bare- // substrings 'review pass' / 'review loop' would match this project's own- // CLAUDE.md convention ("run a simplify/self-review pass before committing")- // and this repo's bundled slashdo docs ("Local Agent Code Review Loop"),- // latching the tracker for ANY CoS agent's ordinary narration — not just a- // do:release/do:pr/do:rpr run.+ // Regression for false-positive latches found across two rounds of local+ // review: bare substrings ('review pass', 'review loop', 'multi-reviewer')+ // would match this project's own CLAUDE.md convention ("run a simplify/+ // self-review pass before committing") and this repo's bundled slashdo docs+ // (which say "review loop" and "multi-reviewer" dozens of times, including+ // the literal instruction text "Review plan: {REVIEW_AGENTS}..."), latching+ // the tracker for ANY CoS agent's ordinary narration or docs-editing — not+ // just an actual do:release/do:pr/do:rpr run.it('isReviewLoopSignal does NOT match ordinary self-review narration or doc prose', () => {expect(isReviewLoopSignal('running the self-review pass before committing')).toBe(false);expect(isReviewLoopSignal('## Local Agent Code Review Loop')).toBe(false);expect(isReviewLoopSignal('You are a Copilot review loop agent.')).toBe(false);+ expect(isReviewLoopSignal('the multi-reviewer wrapper dispatches each listed agent')).toBe(false);+ expect(isReviewLoopSignal('Print the resolved plan before starting: `Review plan: {REVIEW_AGENTS} (mode: ...)`')).toBe(false);});it('createReviewLoopTracker latches on first signal and stays active through silence', () => {