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
Finished outside PortOS: count only with a final render, and start clones without it
[._.]/ Adam Eivyf74da7ff101c
diff --git a/client/src/components/musicVideo/ProjectOptionsPanel.jsx b/client/src/components/musicVideo/ProjectOptionsPanel.jsxindex 4dc592ceff..21ea449764 100644--- a/client/src/components/musicVideo/ProjectOptionsPanel.jsx+++ b/client/src/components/musicVideo/ProjectOptionsPanel.jsx@@ -10,7 +10,7 @@ import { normalizeMusicVideoProductionPolicy } from '../../../../server/lib/musiimport { MUSIC_VIDEO_AUTOMATION_TOOLS, automationDraftFrom, automationFromDraft } from '../../lib/musicVideoAutomation.js';import { musicVideoMediaMode } from '../../../../server/lib/musicVideoMediaPolicy.js';import { formatUsd } from '../../utils/formatters.js';-import { finishedOutside } from '../../../../server/lib/musicVideoFinishedOutside.js';+import { finishedOutsideBlocker } from '../../../../server/lib/musicVideoFinishedOutside.js';import { setMusicVideoFinishedOutside } from '../../services/apiMusicVideo.js';const TOOL_GROUPS = [['image', 'Image'], ['video', 'Video'], ['code', 'Code']];@@ -32,7 +32,9 @@ const headCls = 'pt-1.5 text-xs font-medium text-port-text-muted';export default function ProjectOptionsPanel({project, videoSettings, generatingVideos = false, onMediaMode, onRenderStyle, onSaveAutomation, onSavePolicy, onProjectUpdated,}) {- const external = finishedOutside(project);+ // The stored marker, even while it does not count (no final render yet), so it can still be cleared.+ const external = project.finishedOutside?.markedAt ? project.finishedOutside : null;+ const outsideBlocker = external ? null : finishedOutsideBlocker(project);const [outsideNote, setOutsideNote] = useState('');const [outsideSaving, setOutsideSaving] = useState(false);const toggleFinishedOutside = () => {@@ -137,14 +139,14 @@ export default function ProjectOptionsPanel({<div className={rowCls}><span className={headCls}>Finished outside PortOS</span><div className="flex min-w-0 flex-wrap items-center gap-2">- <ToggleChip+ {!outsideBlocker && <ToggleChipid="mv-setup-finished-outside"label={external ? 'Marked finished' : 'Mark finished'}hint="Song, Look, Storyboard and Make count as done; Final render and Publish still need the real render and posts"checked={!!external}onToggle={toggleFinishedOutside}- />- {!external && (+ />}+ {!external && !outsideBlocker && (<inputtype="text"aria-label="Where it was made (optional)"@@ -156,9 +158,9 @@ export default function ProjectOptionsPanel({/>)}<p className="w-full text-xs text-port-text-muted">- {external+ {outsideBlocker || (external? `Marked ${new Date(external.markedAt).toLocaleDateString()}${external.note ? `: ${external.note}` : ''}. No approval is recorded; unmark to bring the step checks back.`- : 'For a video made elsewhere: Song through Make count as done without recording approvals. Final render and Publish still need the real render and posts.'}+ : 'For a video made elsewhere: Song through Make count as done without recording approvals. Final render and Publish still need the real render and posts.')}</p></div></div>diff --git a/client/src/components/musicVideo/ProjectOptionsPanel.test.jsx b/client/src/components/musicVideo/ProjectOptionsPanel.test.jsxindex 13b4e112e5..cbc54c2974 100644--- a/client/src/components/musicVideo/ProjectOptionsPanel.test.jsx+++ b/client/src/components/musicVideo/ProjectOptionsPanel.test.jsx@@ -42,13 +42,19 @@ describe('ProjectOptionsPanel', () => {const saved = { id: 'mv1', finishedOutside: { markedAt: '2026-10-05T00:00:00.000Z', note: 'Studio' } };setMusicVideoFinishedOutside.mockResolvedValueOnce(saved);const onProjectUpdated = vi.fn();- open({}, undefined, onProjectUpdated);+ open({ renderHistoryId: 'final-1' }, undefined, onProjectUpdated);fireEvent.change(screen.getByLabelText('Where it was made (optional)'), { target: { value: ' Studio ' } });fireEvent.click(screen.getByLabelText('Mark finished'));await waitFor(() => expect(onProjectUpdated).toHaveBeenCalledWith(saved));expect(setMusicVideoFinishedOutside).toHaveBeenCalledWith('mv1', { finished: true, note: 'Studio' });});+ it('explains that marking needs the final render first', () => {+ open({ renderHistoryId: null });+ expect(screen.queryByLabelText('Mark finished')).toBeNull();+ expect(screen.getByText(/Bring the finished video in as the final render first/)).toBeInTheDocument();+ });+it('shows an existing marker and clears it', async () => {setMusicVideoFinishedOutside.mockResolvedValueOnce({ id: 'mv1', finishedOutside: null });open({ finishedOutside: { markedAt: '2026-10-05T12:00:00.000Z', note: 'Studio' } });diff --git a/client/src/lib/musicVideoStages.js b/client/src/lib/musicVideoStages.jsindex a12499bf9c..64c0104790 100644--- a/client/src/lib/musicVideoStages.js+++ b/client/src/lib/musicVideoStages.js@@ -13,7 +13,7 @@ import { isNonBlankStr } from './textUtils';import { modeLabel } from './imageGenModes.js';import { falSceneTake } from './musicVideoShotTiming.js';import { latestMusicVideoReviewDraft } from '../../../server/lib/musicVideoReviewDraft.js';-import { finishedOutside, finishedOutsideCovers } from '../../../server/lib/musicVideoFinishedOutside.js';+import { FINISHED_OUTSIDE_RERENDER_NOTE, finishedOutside, finishedOutsideCovers } from '../../../server/lib/musicVideoFinishedOutside.js';/*** The six steps of a music video, in the order the director decides them. The@@ -639,7 +639,7 @@ export function stageChecklist(stageId, project, readiness = project?.productioncase 'review':return [{id: 'final', label: 'Final video rendered', done: !!project.renderHistoryId && !isFinalRenderStale(project),- detail: isFinalRenderStale(project) ? `${STALE_RENDER_MESSAGE}.` : null,+ detail: isFinalRenderStale(project) ? `${STALE_RENDER_MESSAGE}.${finishedOutside(project) && !readiness?.readyForProduction ? ` ${FINISHED_OUTSIDE_RERENDER_NOTE}` : ''}` : null,action: project.renderHistoryId && !isFinalRenderStale(project) ? null : { label: project.renderHistoryId ? 'Re-render' : 'Render', anchor: 'mv-final-video' },}];case 'publish': {diff --git a/client/src/lib/musicVideoStages.test.js b/client/src/lib/musicVideoStages.test.jsindex 7df48e91e5..c63b8039d4 100644--- a/client/src/lib/musicVideoStages.test.js+++ b/client/src/lib/musicVideoStages.test.js@@ -613,11 +613,24 @@ describe('finished outside PortOS', () => {expect(summarizeMusicVideoProject(marked, unapproved).stage).toBe('publish');});- it('still asks for the final render and the posts it never had', () => {+ it('still asks for the posts it never had', () => {+ const unposted = { ...marked, publishKit: {} };+ expect(deriveStages(unposted, unapproved).current).toBe('publish');+ expect(summarizeMusicVideoProject(unposted, unapproved).stage).toBe('publish');+ });++ it('does not count without a final render, so the approvals that rendering needs are still asked for', () => {const unrendered = { ...marked, renderHistoryId: null, publishKit: {} };- expect(deriveStages(unrendered, unapproved).current).toBe('review');- expect(summarizeMusicVideoProject(unrendered, unapproved).stage).toBe('review');- expect(stageChecklist('review', unrendered, unapproved)[0]).toMatchObject({ id: 'final', done: false });+ expect(deriveStages(unrendered, unapproved).current).toBe('setup');+ expect(summarizeMusicVideoProject(unrendered, unapproved).stage).toBe('setup');+ expect(deriveNextAction(unrendered, { readiness: unapproved })).toMatchObject({ id: 'review-production' });+ expect(stageChecklist('board', unrendered, unapproved)[0].id).not.toBe('finished-outside');+ });++ it('says a stale render can only be redone here with the approvals', () => {+ const stale = { ...marked, renderDependencyState: { status: 'stale' } };+ expect(deriveStages(stale, unapproved).current).toBe('review');+ expect(stageChecklist('review', stale, unapproved)[0].detail).toMatch(/needs the Song through Make approvals; unmark Finished outside PortOS/);});});diff --git a/server/lib/README.md b/server/lib/README.mdindex dd6c9ed3ef..0e91e0870c 100644--- a/server/lib/README.md+++ b/server/lib/README.md@@ -849,7 +849,7 @@ The barrel `server/lib/index.js` is a machine-checkable enumeration of every pub| `musicVideoMediaPolicy.js` | Whole-workflow media modes, legacy intent, selection admission and independent document renderer choice. |-| `musicVideoFinishedOutside.js` | `finishedOutside(project)`, `finishedOutsideCovers(project, stageId)` and `FINISHED_OUTSIDE_STAGE_IDS`: the director's explicit "finished outside PortOS" marker, which counts Song through Make as done without recording any approval. Read by the client's stage derivation and `musicVideoSummary.js`. |+| `musicVideoFinishedOutside.js` | `finishedOutside(project)`, `finishedOutsideCovers(project, stageId)`, `finishedOutsideBlocker(project)`, `FINISHED_OUTSIDE_STAGE_IDS` and `FINISHED_OUTSIDE_RERENDER_NOTE`: the director's explicit "finished outside PortOS" marker, which counts Song through Make as done without recording any approval, only while the project holds a final render. Read by the client's stage derivation and `musicVideoSummary.js`. || `musicVideoSummary.js` | `summarizeMusicVideoProject(project, readiness)` bounded index/picker projection (stage, run status, spend, preview/poster, card badges) and `compareMusicVideoProjectsNewestFirst` for `GET /api/music-video?summary=1` (#10169). || `sandboxDelegation.js` | Bounded tool-free worker context, route configuration, and fidelity evaluation schemas. |diff --git a/server/lib/musicVideoFinishedOutside.js b/server/lib/musicVideoFinishedOutside.jsindex a8a37a8de6..ce934c634e 100644--- a/server/lib/musicVideoFinishedOutside.js+++ b/server/lib/musicVideoFinishedOutside.js@@ -7,14 +7,26 @@* forging review evidence it never saw: the marker counts those four steps as* done, while Final render and Publish still read the real render and posts.* It records nothing in `productionReview`, so clearing it restores the gates.+ *+ * The marker stands for "the finished video already exists", so it only counts+ * while the project holds a final render: without one, Final render could never+ * be reached (rendering here needs the approvals the marker skips), so the+ * approval prompts stay. It belongs to one record; a clone starts without it.*/export const FINISHED_OUTSIDE_STAGE_IDS = Object.freeze(['setup', 'cast-sets', 'board', 'produce']);-/** The marker (`{ markedAt, note? }`) when the project was finished outside PortOS, else null. */+/** The marker (`{ markedAt, note? }`) when the project was finished outside PortOS and holds its final render, else null. */export const finishedOutside = (project) => {const marker = project?.finishedOutside;- return marker && typeof marker.markedAt === 'string' && marker.markedAt ? marker : null;+ return marker && typeof marker.markedAt === 'string' && marker.markedAt && project.renderHistoryId ? marker : null;};+/** Why the marker can't be set yet, or null when it can. */+export const finishedOutsideBlocker = (project) => (project?.renderHistoryId+ ? null : 'Bring the finished video in as the final render first; rendering here needs the step approvals.');++/** The Final render note for a marked project whose render went out of date: re-rendering here needs the approvals. */+export const FINISHED_OUTSIDE_RERENDER_NOTE = 'Re-rendering here needs the Song through Make approvals; unmark Finished outside PortOS in Project settings to bring them back.';+/** Whether the marker covers `stageId`. */export const finishedOutsideCovers = (project, stageId) => !!finishedOutside(project) && FINISHED_OUTSIDE_STAGE_IDS.includes(stageId);diff --git a/server/routes/musicVideo.js b/server/routes/musicVideo.jsindex 44961ca6d9..fa0a96bd7b 100644--- a/server/routes/musicVideo.js+++ b/server/routes/musicVideo.js@@ -14,6 +14,7 @@ import { pipeline } from 'stream/promises';import { Router } from 'express';import { musicVideoProjectListQuerySchema, musicVideoFinishedOutsideSchema, musicVideoProductionDraftSchema, musicVideoProductionApprovalSchema, musicVideoProductionProofSchema, musicVideoProductionImportSchema, musicVideoProductionFeedbackSchema, musicVideoProductionFeedbackResolutionSchema, musicVideoProductionReviseSchema, musicVideoProductionRevertSchema } from '../lib/musicVideoValidation.js';import { productionReadiness } from '../services/musicVideo/productionReview.js';+import { finishedOutsideBlocker } from '../lib/musicVideoFinishedOutside.js';import { getProductionReview, saveProductionDraft, prepareProductionReview, approveProductionReview, renderProductionProof, requireProductionReviewer, importProductionPlanning, bindProductionShot, addProductionFeedback, closeProductionFeedback, reviseProductionFromFeedback, revertProductionInput } from '../services/musicVideo/productionReviewService.js';import { asyncHandler, ServerError } from '../lib/errorHandler.js';import {@@ -320,6 +321,10 @@ router.patch('/:id', asyncHandler(async (req, res) => {// Finished outside PortOS: the earlier steps count as done without forging approvals.router.put('/:id/finished-outside', asyncHandler(async (req, res) => {const { finished, note } = validateRequest(musicVideoFinishedOutsideSchema, req.body);+ if (finished) {+ const blocker = finishedOutsideBlocker(await getProject(req.params.id));+ if (blocker) throw new ServerError(blocker, { status: 409, code: 'MUSIC_VIDEO_NO_FINAL_RENDER' });+ }const finishedOutside = finished ? { markedAt: new Date().toISOString(), ...(note ? { note } : {}) } : null;await updateProject(req.params.id, { finishedOutside });res.json(presentProjectForRead(await getProject(req.params.id)));diff --git a/server/routes/musicVideo.test.js b/server/routes/musicVideo.test.jsindex b5ecd6bc12..4c9440737b 100644--- a/server/routes/musicVideo.test.js+++ b/server/routes/musicVideo.test.js@@ -133,7 +133,7 @@ describe('musicVideo routes', () => {});it('PUT /:id/finished-outside stamps the marker server-side, and clears it, without touching approvals', async () => {- svc.getProject.mockResolvedValue({ id: 'mv-1', name: 'A' });+ svc.getProject.mockResolvedValue({ id: 'mv-1', name: 'A', renderHistoryId: 'final-1' });const r = await request(app).put('/api/music-video/mv-1/finished-outside').send({ finished: true, note: 'Made in another editor' });expect(r.status).toBe(200);const patch = svc.updateProject.mock.calls[0][1];@@ -150,6 +150,16 @@ describe('musicVideo routes', () => {expect(forged.status).toBe(400);});+ it('PUT /:id/finished-outside refuses to mark a project with no final render, but still clears one', async () => {+ svc.getProject.mockResolvedValue({ id: 'mv-1', name: 'A', renderHistoryId: null });+ const r = await request(app).put('/api/music-video/mv-1/finished-outside').send({ finished: true });+ expect(r.status).toBe(409);+ expect(svc.updateProject).not.toHaveBeenCalled();+ const cleared = await request(app).put('/api/music-video/mv-1/finished-outside').send({ finished: false });+ expect(cleared.status).toBe(200);+ expect(svc.updateProject).toHaveBeenCalledWith('mv-1', { finishedOutside: null });+ });+it('GET /midi-sources returns only the newest transcription per track, trimmed (#10203)', async () => {const mk = (id, trackId, createdAt) => ({id, name: id, trackId, scenes: [{ big: true }],diff --git a/server/services/musicVideo/projectsLogic.js b/server/services/musicVideo/projectsLogic.jsindex 2258fa5fee..531d0f3e3f 100644--- a/server/services/musicVideo/projectsLogic.js+++ b/server/services/musicVideo/projectsLogic.js@@ -285,6 +285,8 @@ export function cloneProjectRecord(source, {renderDependencies: null,// Publishing outputs and posted URLs belong to the source final render....(source.publishKit ? { publishKit: null } : {}),+ // Finished outside PortOS describes the source's video; the new version is made here.+ ...(source.finishedOutside ? { finishedOutside: null } : {}),// #9010: the source's in-flight render mark is not the clone's.renderingOn: null,renderPartialFilename: null,diff --git a/server/services/musicVideo/projectsLogic.test.js b/server/services/musicVideo/projectsLogic.test.jsindex e1c51e9a03..9d00b0b7eb 100644--- a/server/services/musicVideo/projectsLogic.test.js+++ b/server/services/musicVideo/projectsLogic.test.js@@ -121,6 +121,13 @@ describe('cloneProjectRecord', () => {]);});+ it('starts a clone without the source\'s finished-outside marker, since the new version is made here', () => {+ const clone = cloneProjectRecord({ ...baseProject(), renderHistoryId: 'final-1', finishedOutside: { markedAt: '2026-01-01T00:00:00.000Z' } },+ { id: 'mv-2', now: '2026-01-02T00:00:00.000Z' });+ expect(clone.finishedOutside).toBeNull();+ expect(cloneProjectRecord(baseProject(), { id: 'mv-3', now: '2026-01-02T00:00:00.000Z' })).not.toHaveProperty('finishedOutside');+ });+it('starts a clone with no auto-review runs, and adds no field when the source has none', () => {const withRuns = cloneProjectRecord({...baseProject(),