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

fix: authorize music video revision dispatch

Adam Eivy1a8359e1ff99
diff --git a/server/lib/hostControlRoutes.js b/server/lib/hostControlRoutes.js
index 51ac286032..f13c1846fe 100644
--- a/server/lib/hostControlRoutes.js
+++ b/server/lib/hostControlRoutes.js
@@ -483,6 +483,10 @@ export const HOST_CONTROL_ROUTES = Object.freeze([
// directly, by fallback or after a checkpoint (#9869). Gate each operation
// uniformly, including deterministic plan/compile options. Creative approval
// and toolFree authoring flags do not grant network execution authority.
+ // Revision entry points reach the same authoring runners, including fallback.
+ // Song-revision /scenes gates only action=replan in the body registry; remove and
+ // dismiss remain record-only operations.
+ 'POST /api/music-video/:id/production-review/revise',
'POST /api/music-video/:id/plan',
'POST /api/music-video/:id/treatment/compile',
'POST /api/music-video/:id/publish-kit/copy',
@@ -925,6 +929,9 @@ const bodyKeys = (body) => (body && typeof body === 'object' && !Array.isArray(b
// `hostControlBodyGate` in services/authGate.js applies these after the body
// parser, since `hostControlRouteGate` runs before it.
const COMPILED_BODY_ROUTES = [
+ // Song revision replanning uses the tool-capable shot planner. The other
+ // actions (remove/dismiss) edit records without dispatching a provider.
+ ['POST /api/music-video/:id/song-revision/scenes', (body) => body?.action === 'replan' ? ['action'] : []],
// Enabling this feature now launches its registered host executable.
['PUT /api/settings/features/eidoverse', (body) => bodyKeys(body)],
['POST /api/local-llm/capability-tests/run', (body) => body?.testId === 'sandbox-repair' ? ['testId'] : []],
diff --git a/server/routes/hostControlMediaAuthoring.test.js b/server/routes/hostControlMediaAuthoring.test.js
index 4f237ed496..5c2e8766a6 100644
--- a/server/routes/hostControlMediaAuthoring.test.js
+++ b/server/routes/hostControlMediaAuthoring.test.js
@@ -108,6 +108,12 @@ vi.mock('../services/musicVideo/productionService.js', () => ({
startProduction: vi.fn(async () => ({ status: 'running' })),
resumeProduction: vi.fn(async () => ({ status: 'running' })),
}));
+vi.mock('../services/musicVideo/songRevision.js', () => ({
+ resolveSongRevisionScenes: vi.fn(async () => ({ project: {} })),
+}));
+vi.mock('../services/musicVideo/productionReviewService.js', () => ({
+ reviseProductionFromFeedback: vi.fn(async () => ({ project: {} })),
+}));
vi.mock('../services/musicVideo/planner.js', () => ({
planProject: vi.fn(async () => ({ project: {}, promptsSeeded: false })),
}));
@@ -134,7 +140,7 @@ vi.mock('../services/musicVideo/castAndSetsService.js', () => ({
applyCastAndSetsFeedback: vi.fn(async () => ({ status: 'running' })),
}));
-import { authGate, hostControlRouteGate } from '../services/authGate.js';
+import { authGate, hostControlRouteGate, hostControlBodyGate } from '../services/authGate.js';
import codeAnimationRoutes from './codeAnimation.js';
import musicRoutes from './music.js';
import tracksRoutes from './tracks.js';
@@ -147,6 +153,8 @@ import { writeMusicCode } from '../services/musicCode.js';
import { startAutonomousVideo, resumeAutonomousVideo } from '../services/musicVideo/autonomousService.js';
import { createSession, revokeSessionById } from '../services/auth.js';
+import { resolveSongRevisionScenes } from '../services/musicVideo/songRevision.js';
+import { reviseProductionFromFeedback } from '../services/musicVideo/productionReviewService.js';
import { planProject } from '../services/musicVideo/planner.js';
import { compileTreatment } from '../services/musicVideo/treatmentService.js';
import { draftPublishKitCopy } from '../services/musicVideo/publishKit.js';
@@ -172,6 +180,8 @@ const authoring = [
[`/api/music-video/${id}/autonomous/resume`, {}, resumeAutonomousVideo, 200],
];
const musicVideoAuthoring = [
+ [`/api/music-video/${id}/song-revision/scenes`, { revisionId: 'example-revision', action: 'replan', ...picker }, resolveSongRevisionScenes, 200, 'post'],
+ [`/api/music-video/${id}/production-review/revise`, { stage: 'storyboard', ...picker }, reviseProductionFromFeedback, 200, 'post'],
[`/api/music-video/${id}/plan`, { ...picker }, planProject, 200, 'post'],
[`/api/music-video/${id}/treatment/compile`, { baseRevision: 0, ...picker }, compileTreatment, 200, 'post'],
[`/api/music-video/${id}/publish-kit/copy`, { notes: 'Example copy', ...picker }, draftPublishKitCopy, 200, 'post'],
@@ -197,7 +207,7 @@ const appFor = (address = '192.0.2.10') => {
Object.defineProperty(req.socket, 'remoteAddress', { value: address });
next();
});
- app.use(authGate, hostControlRouteGate, express.json());
+ app.use(authGate, hostControlRouteGate, express.json(), hostControlBodyGate);
app.use('/api/code-animation', codeAnimationRoutes);
app.use('/api/music', musicRoutes);
app.use('/api/tracks', tracksRoutes);
@@ -275,6 +285,16 @@ describe('media authoring operator authority (#9512, #9869)', () => {
}
});
+ it('keeps song-revision remove and dismiss available without host authority', async () => {
+ for (const action of ['remove', 'dismiss']) {
+ const body = { revisionId: 'example-revision', action };
+ const response = await request(appFor()).post(`/api/music-video/${id}/song-revision/scenes`).send(body);
+ expect(response.status).toBe(200);
+ expect(resolveSongRevisionScenes).toHaveBeenLastCalledWith(id, body);
+ }
+ expect(reviseProductionFromFeedback).not.toHaveBeenCalled();
+ });
+
it('preserves pinned and default authoring/reviewer choices for delegated agents', async () => {
auth.enabled = true;
const session = await createSession({ label: 'agent' });