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: log halt failures when a background auto-review step fails (#11451)
[._.]/ Adam Eivy2cc6af303d6f
diff --git a/server/services/musicVideo/autoReviewService.halt.test.js b/server/services/musicVideo/autoReviewService.halt.test.jsnew file mode 100644index 0000000000..9181fc4a8e--- /dev/null+++ b/server/services/musicVideo/autoReviewService.halt.test.js@@ -0,0 +1,41 @@+import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';++// A background advance fails (getProject rejects), then the halt write fails+// too. The halt failure must be logged, not swallowed (#11451).+const h = vi.hoisted(() => ({ getProject: vi.fn(), mutate: vi.fn() }));++vi.mock('./projects.js', async (importOriginal) => ({+ ...(await importOriginal()),+ getProject: h.getProject,+ mutateProjectRecord: h.mutate,+}));++const { resumeAutoReview, __testing } = await import('./autoReviewService.js');++describe('background auto-review halt failure logging (#11451)', () => {+ let errorSpy;++ beforeEach(() => {+ errorSpy = vi.spyOn(console, 'error').mockImplementation(() => {});+ h.getProject.mockReset().mockRejectedValue(new Error('primary boom'));+ // First write is the resume itself; the second is the halt, which fails.+ h.mutate.mockReset()+ .mockResolvedValueOnce({ project: { id: 'proj-1' }, run: { id: 'run-1' } })+ .mockRejectedValueOnce(new Error('halt boom'));+ });++ afterEach(() => {+ errorSpy.mockRestore();+ });++ it('logs the primary step failure and the secondary halt failure with ids', async () => {+ await resumeAutoReview('proj-1', 'run-1');+ await __testing.settleBackground();++ const lines = errorSpy.mock.calls.map((args) => args.join(' '));+ expect(lines.some((l) => l.startsWith('❌') && l.includes('step failed: primary boom'))).toBe(true);+ expect(lines.some((l) =>+ l.startsWith('❌') && l.includes('halt after step failure failed')+ && l.includes('projectId=proj-1') && l.includes('runId=run-1') && l.includes('halt boom'))).toBe(true);+ });+});diff --git a/server/services/musicVideo/autoReviewService.js b/server/services/musicVideo/autoReviewService.jsindex df00b3e72b..c40d87a445 100644--- a/server/services/musicVideo/autoReviewService.js+++ b/server/services/musicVideo/autoReviewService.js@@ -428,7 +428,7 @@ function advanceInBackground(projectId, runId) {console.error(`❌ Music Video auto-review ${short(runId)} step failed: ${err.message}`);await halt(projectId, runId, { status: 'stopped', reason: `A step failed: ${err.message}`, error: err.message }).then((out) => publish(projectId, out.project, out.run, { type: 'idle' }))- .catch(() => {});+ .catch((haltErr) => console.error(`❌ Music Video auto-review halt after step failure failed (projectId=${projectId}, runId=${runId}): ${haltErr.message}`));}));}