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
Resume waits for the director to finish a handed-off final revision
Claude6affb90e7546
diff --git a/docs/features/music-video-autonomous.md b/docs/features/music-video-autonomous.mdindex 008764438f..7fe784dc63 100644--- a/docs/features/music-video-autonomous.md+++ b/docs/features/music-video-autonomous.md@@ -104,7 +104,7 @@ Choose **Who reviews each step → Orchestrator** in the start drawer to let a m| Art direction | **Produce** | Reads the cast, environments, visual and motion guides (and the guide sheet when it is an image and the model can see), approves or rewrites fields || Lyric timing | **Produce** | Verifies the aligned timings when every line carries bounded word timings, alignment ran without error and the recognizer heard at least half of the words; otherwise leaves them for a director || Storyboard | **Produce** | Anchors shots to the lyric lines they overlap, fills blank fields, approves or files change requests that re-plan the named shots, then resolves them |-| Final video | after the final render | Looks at 24 frames sampled across the film (when the model can see). A `revise` with timecoded issues sends those sections back while revisions remain: a code or document film is re-authored with the issues as change requests on the film; footage gets an auto-review over the scenes the issues fall in, judged by the orchestrator and limited to the generations production left (not run when a dollar budget is set, which only production can enforce). The film is rendered again and reviewed again (`stages.produce.step: 'final-revision'`, `output.finalAutoReviewId`). Stop, Cancel and Resume carry through to that auto-review; one that hands off to a director (or fails) parks the run with its reason (`FINAL_REVISION_NEEDS_HUMAN`), and Resume, once it is finished, renders and reviews the film again |+| Final video | after the final render | Looks at 24 frames sampled across the film (when the model can see). A `revise` with timecoded issues sends those sections back while revisions remain: a code or document film is re-authored with the issues as change requests on the film; footage gets an auto-review over the scenes the issues fall in, judged by the orchestrator and limited to the generations production left (not run when a dollar budget is set, which only production can enforce). The film is rendered again and reviewed again (`stages.produce.step: 'final-revision'`, `output.finalAutoReviewId`). Stop, Cancel and Resume carry through to that auto-review; one that hands off to a director (or fails) parks the run with its reason (`FINAL_REVISION_NEEDS_HUMAN`), and Resume renders and reviews the film again once that revision is finished or cancelled (pressed earlier, the run stays parked) |Production's plate and draft reviews use the orchestrator too. Each decision lands in `run.orchestration.reviews` (`checkpoint`, `verdict` of `approve`/`revise`/`retake`/`noted`, `score`, `notes`, `changes`, `issues`, `route`), which the run panel shows as a decision log. When the revision limit is reached the latest version is accepted and the note says so. Each revision is stored with its log entry (`output.lyricsForReview`, `output.styleDraft`), so a Retry after a failed review judges the latest revision rather than the first draft. A storyboard re-plan that fails fails the stage (`ORCHESTRATOR_REVISION_FAILED`) instead of approving the unchanged shot; Retry asks the orchestrator again. A readiness problem the orchestrator cannot fix still parks the run for a human, with the problem named. The orchestrator never publishes.diff --git a/server/services/musicVideo/autoReview.js b/server/services/musicVideo/autoReview.jsindex 58e5a823e3..7b94c1bf8d 100644--- a/server/services/musicVideo/autoReview.js+++ b/server/services/musicVideo/autoReview.js@@ -357,14 +357,21 @@ export function resumeAutoReviewOnProject(project, runId, { limits } = {}, now =}, now);}+/** The revision a run's current attempt left open (or rendering), if any — work a director still has to finish or cancel. */+export function openAttemptRevisionId(project, runId) {+ const run = projectAutoReviews(project).find((r) => r.id === runId);+ const revisionId = run ? currentAttempt(run).revisionId : null;+ const revision = revisionId ? projectRevisions(project).find((r) => r.id === revisionId) : null;+ return revision && (revision.status === 'open' || revision.status === 'rendering') ? revision.id : null;+}+/** Cancel (terminal). Returns the open revision the caller must cancel too, if any. */export function cancelAutoReviewOnProject(project, runId, now = new Date().toISOString()) {const run = findRun(project, runId);if (!RESUMABLE.has(run.status)) throw autoReviewError(409, 'AUTO_REVIEW_CLOSED', `This run is already ${run.status}`);- const revisionId = currentAttempt(run).revisionId;- const revision = revisionId ? projectRevisions(project).find((r) => r.id === revisionId) : null;+ const revisionId = openAttemptRevisionId(project, runId);const out = haltAutoReview(project, runId, { status: 'canceled', reason: 'Cancelled by the director' }, now);- return { ...out, revisionId: revision && (revision.status === 'open' || revision.status === 'rendering') ? revision.id : null };+ return { ...out, revisionId };}/**diff --git a/server/services/musicVideo/autonomousService.js b/server/services/musicVideo/autonomousService.jsindex 0280c0b0c9..93a03d8a7e 100644--- a/server/services/musicVideo/autonomousService.js+++ b/server/services/musicVideo/autonomousService.js@@ -1278,6 +1278,12 @@ export async function resumeAutonomousVideo(projectId, edits = {}, { autoApproveconst parked = await park(projectId, 'needs-human', { error: trimTo(`The final revision could not resume: ${failure.message}`, 500), errorCode: failure.code || null });return { project: parked.project, run: presentAutonomousRun(parked.run) };}+ // A hand-off the director has not finished yet still holds its revision open.+ const { openAttemptRevisionId } = await import('./autoReview.js');+ if (openAttemptRevisionId(await getProject(projectId), out.run.output.finalAutoReviewId)) {+ const parked = await park(projectId, 'needs-human', { error: 'Finish or cancel the open revision of the final video first, then Resume.', errorCode: 'FINAL_REVISION_NEEDS_HUMAN' });+ return { project: parked.project, run: presentAutonomousRun(parked.run) };+ }const { run } = await patchRun(projectId, () => ({ output: { finalAutoReviewId: null } }));await startFinalRender(projectId, run);const latest = await getProject(projectId);diff --git a/server/services/musicVideo/autonomousService.test.js b/server/services/musicVideo/autonomousService.test.jsindex 01ae633d48..dfad1c4464 100644--- a/server/services/musicVideo/autonomousService.test.js+++ b/server/services/musicVideo/autonomousService.test.js@@ -1380,7 +1380,18 @@ describe('orchestrated mode (brief.orchestrator)', () => {expect(runOf()).toMatchObject({ status: 'needs-human', errorCode: 'FINAL_REVISION_NEEDS_HUMAN',error: expect.stringContaining('cannot be generated automatically'), output: { finalAutoReviewId: 'mvar-fix', renderJobId: 'render-1' } });- doubles.resumeAutoReview.mockRejectedValueOnce(Object.assign(new Error('This run is needs-human'), { code: 'AUTO_REVIEW_CLOSED' }));+ // Resume before the director finished the revision keeps the run parked.+ const closed = () => Object.assign(new Error('This run is needs-human'), { code: 'AUTO_REVIEW_CLOSED' });+ Object.assign(store.get('mv-auto'), { autoReviews: [{ id: 'mvar-fix', status: 'needs-human', attempts: [{ n: 1, revisionId: 'rev-1' }] }],+ revisions: [{ id: 'rev-1', status: 'open' }] });+ doubles.resumeAutoReview.mockRejectedValueOnce(closed());+ await service.resumeAutonomousVideo('mv-auto');+ expect(runOf()).toMatchObject({ status: 'needs-human', errorCode: 'FINAL_REVISION_NEEDS_HUMAN',+ error: expect.stringContaining('Finish or cancel the open revision'), output: { finalAutoReviewId: 'mvar-fix' } });+ expect(doubles.renderVideo).toHaveBeenCalledOnce();++ store.get('mv-auto').revisions[0].status = 'complete';+ doubles.resumeAutoReview.mockRejectedValueOnce(closed());await rendersAgain();await service.resumeAutonomousVideo('mv-auto');expect(runOf()).toMatchObject({ status: 'running', output: { renderJobId: 'render-2', finalAutoReviewId: null } });