Skip to content

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

address review (claude): tighten review-loop markers to avoid false-positive latch

Adam Eivy27826990bb42
diff --git a/server/lib/tuiHandshake.js b/server/lib/tuiHandshake.js
index 2d316b07c4..50dbb3c853 100644
--- a/server/lib/tuiHandshake.js
+++ b/server/lib/tuiHandshake.js
@@ -397,13 +397,26 @@ export const REVIEW_LOOP_IDLE_TIMEOUT_MS = 900000;
// 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.
+//
+// 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:',
- 'review pass',
'multi-reviewer',
- 'review loop',
];
+// 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".
+const REVIEW_PASS_BANNER_PATTERN = /review pass\s+\d+\s*\/\s*\d+/i;
+
/**
* True when a chunk of ANSI-stripped TUI output shows the multi-reviewer loop
* (do:release/do:pr/do:rpr) has started a reviewer pass. Callers MUST pass
@@ -415,7 +428,7 @@ const REVIEW_LOOP_MARKERS = [
export function isReviewLoopSignal(strippedText) {
if (typeof strippedText !== 'string' || !strippedText) return false;
const lower = strippedText.toLowerCase();
- return REVIEW_LOOP_MARKERS.some((marker) => lower.includes(marker));
+ return REVIEW_LOOP_MARKERS.some((marker) => lower.includes(marker)) || REVIEW_PASS_BANNER_PATTERN.test(strippedText);
}
/**
diff --git a/server/lib/tuiHandshake.test.js b/server/lib/tuiHandshake.test.js
index 301109489c..935ed881b3 100644
--- a/server/lib/tuiHandshake.test.js
+++ b/server/lib/tuiHandshake.test.js
@@ -309,7 +309,6 @@ describe('tuiHandshake — review-loop idle suppression', () => {
expect(isReviewLoopSignal('Review plan: [claude, codex] (mode: series, stop-mode: all)')).toBe(true);
expect(isReviewLoopSignal('--- Review pass 1/2: codex ---')).toBe(true);
expect(isReviewLoopSignal('## Multi-Reviewer Summary')).toBe(true);
- expect(isReviewLoopSignal('You are a COPILOT REVIEW LOOP agent.')).toBe(true);
});
it('isReviewLoopSignal ignores ordinary implementation/output chrome', () => {
@@ -320,6 +319,18 @@ 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.
+ 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);
+ });
+
it('createReviewLoopTracker latches on first signal and stays active through silence', () => {
const tracker = createReviewLoopTracker();
expect(tracker.active).toBe(false);