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: address review — a failed background pass must not report ready/done (#4108)
[._.]/ Adam Eivycd3e2e9703cb
diff --git a/client/src/lib/seriesReviewProgress.js b/client/src/lib/seriesReviewProgress.jsindex 8a42328d00..8f418d0422 100644--- a/client/src/lib/seriesReviewProgress.js+++ b/client/src/lib/seriesReviewProgress.js@@ -37,7 +37,9 @@ export function reviewFrameLabel(f) {switch (f.type) {case 'start': return 'Starting review…';case 'step:start': return `${stepLabel(f.kind)}…`;- case 'step:complete': return `${stepLabel(f.kind)} done`;+ // `failed: true` marks a pass that errored / never ran — it forces the+ // verdict to 'issues', so the frame log must not read "done".+ case 'step:complete': return `${stepLabel(f.kind)} ${f.failed ? 'failed' : 'done'}`;case 'check:start': return `Editorial check: ${f.label || f.checkId}…`;case 'check:complete': return `Editorial check: ${f.label || f.checkId} — ${f.count ?? 0} finding(s)`;case 'complete': return 'Review complete';diff --git a/client/src/lib/seriesReviewProgress.test.js b/client/src/lib/seriesReviewProgress.test.jsindex 2ecccd4259..6c299ccdaa 100644--- a/client/src/lib/seriesReviewProgress.test.js+++ b/client/src/lib/seriesReviewProgress.test.js@@ -7,6 +7,11 @@ describe('reviewFrameLabel', () => {expect(reviewFrameLabel({ type: 'step:complete', kind: 'canon' })).toBe('Checking canon descriptions done');});+ it('marks a failed pass as failed, not done', () => {+ expect(reviewFrameLabel({ type: 'step:complete', kind: 'canon', failed: true })).toBe('Checking canon descriptions failed');+ expect(reviewFrameLabel({ type: 'step:complete', kind: 'canon', failed: false })).toBe('Checking canon descriptions done');+ });+it('falls back to the raw kind for an unknown step', () => {expect(reviewFrameLabel({ type: 'step:start', kind: 'mystery' })).toBe('mystery…');});diff --git a/server/services/pipeline/seriesReview.js b/server/services/pipeline/seriesReview.jsindex 971992ff19..625f4c9707 100644--- a/server/services/pipeline/seriesReview.js+++ b/server/services/pipeline/seriesReview.js@@ -236,6 +236,9 @@ export async function runSeriesReview(seriesId, {feedback, providerOverride, modelOverride, force = false, readinessGate, signal, onProgress = () => {},} = {}) {assertValidSeriesId(seriesId);+ // Already canceled before we started — bail before spending an LLM round-trip+ // on a run whose verdict would be discarded anyway.+ if (signal?.aborted) return null;// Three independent reads — resolve concurrently.const [series, settings, issues] = await Promise.all([getSeries(seriesId),@@ -272,7 +275,7 @@ export async function runSeriesReview(seriesId, {let failed = false;const value = await judgeFoundation(seriesId, { providerId: providerOverride, model: modelOverride, force }).catch((err) => { console.error(`⚠️ series-review foundation judge failed — series=${seriesId.slice(0, 12)} ${err.message}`); failed = true; return null; });- onProgress({ type: 'step:complete', kind: 'foundation', weightedScore: value?.weightedScore ?? null });+ onProgress({ type: 'step:complete', kind: 'foundation', weightedScore: value?.weightedScore ?? null, failed });return { value, failed };});@@ -284,7 +287,10 @@ export async function runSeriesReview(seriesId, {let failed = false;const value = await checkSeriesCanonReadiness(seriesId).catch((err) => { console.error(`⚠️ series-review canon readiness failed — series=${seriesId.slice(0, 12)} ${err.message}`); failed = true; return null; });- onProgress({ type: 'step:complete', kind: 'canon', ready: value?.ready !== false });+ // `failed` must gate `ready`: on a throw `value` is null, and a bare+ // `value?.ready !== false` would announce `ready: true` for a pass that never+ // produced a result. Mirrors how the verdict fails closed on the same signal.+ onProgress({ type: 'step:complete', kind: 'canon', ready: !failed && value?.ready !== false, failed });return { value, failed };});diff --git a/server/services/pipeline/seriesReview.run.test.js b/server/services/pipeline/seriesReview.run.test.jsindex add76293b1..16776d423f 100644--- a/server/services/pipeline/seriesReview.run.test.js+++ b/server/services/pipeline/seriesReview.run.test.js@@ -144,8 +144,20 @@ describe('runSeriesReview — SSE frames under interleaving', () => {it('carries the settled values on the background step:complete frames', async () => {const frames = [];await run({ onProgress: (e) => frames.push(e) });- expect(frames.find((f) => f.type === 'step:complete' && f.kind === 'foundation')).toMatchObject({ weightedScore: 9 });- expect(frames.find((f) => f.type === 'step:complete' && f.kind === 'canon')).toMatchObject({ ready: true });+ expect(frames.find((f) => f.type === 'step:complete' && f.kind === 'foundation')).toMatchObject({ weightedScore: 9, failed: false });+ expect(frames.find((f) => f.type === 'step:complete' && f.kind === 'canon')).toMatchObject({ ready: true, failed: false });+ });++ // A failed canon pass produced NO result, so its frame must not announce+ // `ready: true` — `null?.ready !== false` is true, which would tell the UI the+ // opposite of what the verdict concludes.+ it('never reports a failed background pass as ready/scored', async () => {+ judgeFoundation.mockRejectedValue(new Error('provider down'));+ checkSeriesCanonReadiness.mockRejectedValue(new Error('canon blew up'));+ const frames = [];+ await run({ onProgress: (e) => frames.push(e) });+ expect(frames.find((f) => f.type === 'step:complete' && f.kind === 'canon')).toMatchObject({ ready: false, failed: true });+ expect(frames.find((f) => f.type === 'step:complete' && f.kind === 'foundation')).toMatchObject({ weightedScore: null, failed: true });});});@@ -169,6 +181,16 @@ describe('runSeriesReview — failure and cancellation paths', () => {expect(result.canon).toMatchObject({ ready: true });});+ it('spends nothing when the run is already canceled at entry', async () => {+ const controller = new AbortController();+ controller.abort();+ const result = await run({ signal: controller.signal });+ expect(result).toBeNull();+ expect(judgeFoundation).not.toHaveBeenCalled();+ expect(checkSeriesCanonReadiness).not.toHaveBeenCalled();+ expect(runEditorialChecks).not.toHaveBeenCalled();+ });+it('returns null on a canceled run only after the background passes have settled', async () => {const controller = new AbortController();runEditorialChecks.mockImplementation(async () => {