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: surface a commission run whose history write was lost instead of reporting plain success (#7529)
[._.]/ Adam Eivye30cf269d734
diff --git a/client/src/components/creative-commission/runOutcomeToast.jsx b/client/src/components/creative-commission/runOutcomeToast.jsxnew file mode 100644index 0000000000..81f33b5c4e--- /dev/null+++ b/client/src/components/creative-commission/runOutcomeToast.jsx@@ -0,0 +1,89 @@+/**+ * The ONE place a manual "Run Now" outcome becomes user-visible copy (#7529).+ * Both consumers (the commission list and the detail page) call it so they can+ * never drift on the case that matters here: a fire whose run-history write+ * failed.+ *+ * That case used to be invisible. The scheduler returned `status: 'started'`+ * with `run: null` and both pages toasted an unconditional success promising the+ * render would show up — but the commission's render history is derived from+ * PERSISTED run ids, so nothing ever appeared there, no rating control existed,+ * and no notification was attempted (surfacing is gated on a real run). The+ * project was real and running the whole time; only its bookkeeping was lost.+ * `historyWarning` is the server saying exactly that, so the toast says it too+ * and hands over the project link, which is the only surviving route to the work.+ */++import { ExternalLink, TriangleAlert } from 'lucide-react';+import { Link } from 'react-router';++import toast from '../ui/Toast';++// Long enough to read two lines and click the link, matching the app's other+// actionable render-prop toasts.+const WARNING_DURATION_MS = 12000;++const WARNING_LABEL = 'Run history not saved';++/** The primary outcome line — the same information the plain toasts carry. */+function outcomeSummary(result, startedMessage) {+ if (result?.status === 'started') return startedMessage;+ if (result?.status === 'skipped') return `Run skipped: ${result.reason}`;+ return `Run failed: ${result?.error || 'unknown error'}`;+}++function HistoryWarningToast({ t, projectId, outcome }) {+ return (+ <div className="flex items-start gap-2">+ <TriangleAlert className="w-4 h-4 mt-0.5 shrink-0 text-amber-400" aria-hidden="true" />+ <div className="text-sm">+ <p className="font-medium text-gray-100">{WARNING_LABEL}</p>+ <p className="text-gray-400">+ {outcome === 'started'+ ? 'Generation started, but this run could not be written to the commission’s history, so it will not show up in the render history.'+ : `This run was ${outcome}, but the outcome could not be written to the commission’s history.`}+ </p>+ {projectId ? (+ <Link+ to={`/creative-director/${projectId}`}+ onClick={() => toast.dismiss(t.id)}+ className="inline-flex items-center gap-1 mt-1 text-port-accent hover:underline"+ >+ Open the project <ExternalLink className="w-3 h-3" aria-hidden="true" />+ </Link>+ ) : null}+ </div>+ </div>+ );+}++/**+ * Toast a manual-run outcome.+ *+ * With a `historyWarning` the warning REPLACES the normal line rather than+ * stacking beneath it: the success line's promise ("its render appears below")+ * is the precise thing that is no longer true, and two toasts for one click+ * would just race the dedup window. A degraded skip/fail still reports its+ * reason as a plain toast alongside — that information is independent of the+ * ledger and losing it would trade one blind spot for another.+ *+ * @param {object|null} result - the `/run` response body+ * @param {string} startedMessage - the success copy when history persisted+ */+export function toastRunOutcome(result, startedMessage) {+ const warning = result?.historyWarning;+ if (!warning) {+ if (result?.status === 'started') toast.success(startedMessage);+ else toast.error(outcomeSummary(result, startedMessage));+ return;+ }+ // The reason a skip/fail happened is not what the ledger lost — keep it.+ if (result?.status !== 'started') toast.error(outcomeSummary(result, startedMessage));+ toast((t) => (+ <HistoryWarningToast+ t={t}+ projectId={warning.projectId || result?.projectId || null}+ outcome={warning.outcome || result?.status || 'started'}+ />+ ), { duration: WARNING_DURATION_MS, icon: null, label: WARNING_LABEL });+}diff --git a/client/src/components/creative-commission/runOutcomeToast.test.jsx b/client/src/components/creative-commission/runOutcomeToast.test.jsxnew file mode 100644index 0000000000..27cf1a5a32--- /dev/null+++ b/client/src/components/creative-commission/runOutcomeToast.test.jsx@@ -0,0 +1,86 @@+/**+ * Manual "Run Now" outcome copy (#7529).+ *+ * The regression these pin: a fire whose run-history write failed still returns+ * `status: 'started'`, and both commission pages used to toast an unconditional+ * "its render appears below" for it. The gallery is derived from PERSISTED run+ * ids, so that promise was false — nothing ever appeared, and the only surviving+ * route to the work was the Creative Director project the user was never shown.+ */++import { describe, it, expect, vi, beforeEach } from 'vitest';+import { render, screen } from '@testing-library/react';+import { MemoryRouter } from 'react-router';++// vi.mock is hoisted above every const in this file, so the callable-toast+// double is built inside the factory and read back through the import.+vi.mock('../ui/Toast', () => ({+ default: Object.assign(vi.fn(), { success: vi.fn(), error: vi.fn(), dismiss: vi.fn() }),+}));++import toastMock from '../ui/Toast';+import { toastRunOutcome } from './runOutcomeToast.jsx';++// The warning toast is a render prop — render what it handed the toast stack.+const renderWarningToast = () => {+ expect(toastMock).toHaveBeenCalledTimes(1);+ const [content, opts] = toastMock.mock.calls[0];+ render(<MemoryRouter>{content({ id: 'toast-1' })}</MemoryRouter>);+ return opts;+};++describe('toastRunOutcome', () => {+ beforeEach(() => { vi.clearAllMocks(); });++ it('replaces the gallery-success promise with a warning and a project link when history was lost', () => {+ toastRunOutcome({+ status: 'started',+ projectId: 'cd-9',+ historyWarning: { code: 'run-history-unavailable', outcome: 'started', projectId: 'cd-9' },+ }, 'Run started — its render appears below once generation finishes');++ // The false promise is gone, not merely accompanied by a warning.+ expect(toastMock.success).not.toHaveBeenCalled();+ const opts = renderWarningToast();+ // A collapsible toast must name itself for the corner pill (a11y contract).+ expect(opts.label).toBeTruthy();+ expect(screen.getByText(/could not be written to the commission/i)).toBeInTheDocument();+ expect(screen.getByRole('link', { name: /open the project/i })).toHaveAttribute('href', '/creative-director/cd-9');+ });++ it('falls back to the outcome-level project id when the warning carries none', () => {+ toastRunOutcome({+ status: 'started',+ projectId: 'cd-fallback',+ historyWarning: { code: 'run-history-unavailable', outcome: 'started', projectId: null },+ }, 'ignored');+ renderWarningToast();+ expect(screen.getByRole('link', { name: /open the project/i })).toHaveAttribute('href', '/creative-director/cd-fallback');+ });++ it('warns without a link when no project was ever minted (a lost skip row)', () => {+ toastRunOutcome({+ status: 'skipped',+ reason: 'autonomy-off',+ historyWarning: { code: 'run-history-unavailable', outcome: 'skipped', projectId: null },+ }, 'ignored');+ renderWarningToast();+ expect(screen.queryByRole('link')).toBeNull();+ expect(screen.getByText(/this run was skipped, but the outcome could not be written/i)).toBeInTheDocument();+ // The skip REASON is independent of the lost ledger — it must survive.+ expect(toastMock.error).toHaveBeenCalledWith('Run skipped: autonomy-off');+ });++ it('keeps the normal success copy when history persisted', () => {+ toastRunOutcome({ status: 'started', projectId: 'cd-1', run: { id: 'run-1' } }, 'Run started — all good');+ expect(toastMock.success).toHaveBeenCalledWith('Run started — all good');+ expect(toastMock).not.toHaveBeenCalled();+ });++ it('reports a skip reason and a failure error unchanged', () => {+ toastRunOutcome({ status: 'skipped', reason: 'budget' }, 'unused');+ expect(toastMock.error).toHaveBeenCalledWith('Run skipped: budget');+ toastRunOutcome({ status: 'failed', error: 'planner exploded' }, 'unused');+ expect(toastMock.error).toHaveBeenCalledWith('Run failed: planner exploded');+ });+});diff --git a/client/src/pages/CreativeCommissionDetail.jsx b/client/src/pages/CreativeCommissionDetail.jsxindex edb32a86ce..d173bbdde3 100644--- a/client/src/pages/CreativeCommissionDetail.jsx+++ b/client/src/pages/CreativeCommissionDetail.jsx@@ -29,6 +29,7 @@ import { useAutoRefetch } from '../hooks/useAutoRefetch';import { timeAgo } from '../utils/formatters';import CommissionConfigForm from '../components/creative-commission/CommissionConfigForm.jsx';import RenderHistory from '../components/creative-commission/RenderHistory.jsx';+import { toastRunOutcome } from '../components/creative-commission/runOutcomeToast.jsx';import {toForm, toPayload, patchFormState, validateForm, describeSchedule, describeAssignment,COMMISSION_STOP_COPY,@@ -262,9 +263,7 @@ export default function CreativeCommissionDetail() {const fresh = result.commission;setCommission((prev) => (prev ? { ...prev, runs: fresh.runs, feedback: fresh.feedback } : fresh));}- if (result?.status === 'started') toast.success('Run started — its render appears below once generation finishes');- else if (result?.status === 'skipped') toast.error(`Run skipped: ${result.reason}`);- else toast.error(`Run failed: ${result?.error || 'unknown error'}`);+ toastRunOutcome(result, 'Run started — its render appears below once generation finishes');} catch (e) {toast.error(e?.message || 'Run failed');} finally {diff --git a/client/src/pages/CreativeCommissionDetail.test.jsx b/client/src/pages/CreativeCommissionDetail.test.jsxindex 89d6c85e39..8273d5b72e 100644--- a/client/src/pages/CreativeCommissionDetail.test.jsx+++ b/client/src/pages/CreativeCommissionDetail.test.jsx@@ -25,8 +25,12 @@ vi.mock('../services/api', async (importOriginal) => ({// The config form loads model catalogs on mount — out of scope here, and it// would put real requests behind the assertions about which projects load.vi.mock('../components/creative-commission/CommissionConfigForm.jsx', () => ({ default: () => null }));+// Callable: the degraded run-history warning (#7529) is a render-prop toast,+// so the double has to be a function with the named helpers hung off it.vi.mock('../components/ui/Toast', () => ({- default: { success: vi.fn(), error: vi.fn(), info: vi.fn(), warning: vi.fn() },+ default: Object.assign(vi.fn(), {+ success: vi.fn(), error: vi.fn(), info: vi.fn(), warning: vi.fn(), dismiss: vi.fn(),+ }),}));// ProjectPreview reaches into the media/job graph; the assertions here are about// which projects resolved (and, for #4149, which snapshot of a project is on@@ -233,6 +237,37 @@ describe('CreativeCommissionDetail live render refresh (#4149)', () => {expect(toast.success).toHaveBeenCalledWith(expect.stringContaining('appears below'));expect(toast.success).toHaveBeenCalledWith(expect.not.stringContaining('reload'));});++ // #7529: the started fire whose run-history write was lost. The project is+ // real and running, but nothing was persisted, so the gallery this page+ // derives from persisted run ids stays empty — promising a render 'appears+ // below' is the one thing the page must not do here.+ it('does not promise a gallery render when the run-history write was lost', async () => {+ api.getCommission.mockResolvedValue({ ...COMMISSION, runs: [] });+ api.runCommissionNow.mockResolvedValue({+ status: 'started',+ projectId: 'cd-orphan',+ run: null,+ historyWarning: {+ code: 'run-history-unavailable', outcome: 'started', trigger: 'manual',+ commissionId: 'cc-1', projectId: 'cd-orphan', detail: 'write-failed:ETIMEDOUT',+ },+ commission: { ...COMMISSION, runs: [] },+ });+ render(<MemoryRouter><CreativeCommissionDetail /></MemoryRouter>);+ await screen.findByRole('heading', { name: COMMISSION.name });++ await act(async () => {+ fireEvent.click(screen.getByRole('button', { name: /Run commission .* now/i }));+ });++ await waitFor(() => expect(toast).toHaveBeenCalled());+ expect(toast.success).not.toHaveBeenCalledWith(expect.stringContaining('appears below'));+ const [content] = toast.mock.calls[0];+ render(<MemoryRouter>{content({ id: 't1' })}</MemoryRouter>);+ expect(screen.getByRole('link', { name: /open the project/i }))+ .toHaveAttribute('href', '/creative-director/cd-orphan');+ });});describe('CreativeCommissionDetail stop controls', () => {diff --git a/client/src/pages/CreativeCommissions.jsx b/client/src/pages/CreativeCommissions.jsxindex bdb185ca07..0b2e88b506 100644--- a/client/src/pages/CreativeCommissions.jsx+++ b/client/src/pages/CreativeCommissions.jsx@@ -25,6 +25,7 @@ import ConfirmButtonPair from '../components/ui/ConfirmButtonPair';import { timeAgo } from '../utils/formatters';import { useConfirmDelete } from '../hooks/useConfirmDelete';import CommissionConfigForm from '../components/creative-commission/CommissionConfigForm.jsx';+import { toastRunOutcome } from '../components/creative-commission/runOutcomeToast.jsx';import {blankForm, toPayload, patchFormState, validateForm, describeSchedule, describeAssignment,COMMISSION_STOP_COPY,@@ -101,9 +102,7 @@ export default function CreativeCommissions() {const fresh = result.commission;setCommissions((prev) => prev.map((c) => (c.id === fresh.id ? { ...c, runs: fresh.runs, feedback: fresh.feedback } : c)));}- if (result?.status === 'started') toast.success('Run started — open the commission to watch the render');- else if (result?.status === 'skipped') toast.error(`Run skipped: ${result.reason}`);- else toast.error(`Run failed: ${result?.error || 'unknown error'}`);+ toastRunOutcome(result, 'Run started — open the commission to watch the render');} catch (err) {toast.error(err?.message || 'Run failed');} finally {diff --git a/server/services/creativeCommissions/scheduler.js b/server/services/creativeCommissions/scheduler.jsindex a0d504c967..669f7ec656 100644--- a/server/services/creativeCommissions/scheduler.js+++ b/server/services/creativeCommissions/scheduler.js@@ -220,6 +220,62 @@ function classifyPrefireReadError(err) {return 'read-failed';}+// The machine-readable code every degraded-history outcome carries. A caller+// branches on this, never on prose.+export const HISTORY_UNAVAILABLE = 'run-history-unavailable';++// Same bounded classification as classifyPrefireReadError, for the opposite+// direction: a WRITE that failed. Never the raw driver message — it can quote+// record contents, and a history warning travels to the client.+function classifyHistoryWriteError(err) {+ if (typeof err?.code === 'string' && err.code) return `write-failed:${err.code}`;+ if (typeof err?.name === 'string' && err.name) return `write-failed:${err.name}`;+ return 'write-failed';+}++/**+ * Persist one run entry, separating three outcomes that a bare+ * `.catch(() => null)` used to collapse into one (#7529, AGENTS.md's+ * sentinel + validate rule):+ *+ * - written → { run, historyWarning: null }+ * - commission gone → { run: null, historyWarning: null } (honest absence)+ * - write FAILED → { run: null, historyWarning: {...} } (degradation)+ *+ * The third case is the one that used to disappear: generation had already+ * started, the project existed, and the caller still got `run: null` — which+ * reads exactly like "the commission was deleted mid-fire". The commission's+ * gallery is derived from persisted run ids, so a lost write leaves a project+ * running with no history row, no rating control, and no surfaced notification+ * (surfacing is gated on a real run), with nothing anywhere saying so.+ *+ * Never throws: every caller is outside the Express request lifecycle. The+ * console.error IS the scheduled path's diagnostic — it does not depend on the+ * ledger that just failed. It carries only local ids and a bounded class, never+ * names, prompts or feedback.+ */+async function persistRun(commissionId, entry, trigger) {+ try {+ const run = await recordCommissionRun(commissionId, entry);+ return { run, historyWarning: null };+ } catch (err) {+ const detail = classifyHistoryWriteError(err);+ const projectNote = entry.projectId ? ` — project ${entry.projectId} is running unrecorded` : '';+ console.error(`❌ Creative commission ${commissionId} ${trigger} ${entry.status} run history write failed (${detail})${projectNote}`);+ return {+ run: null,+ historyWarning: {+ code: HISTORY_UNAVAILABLE,+ outcome: entry.status,+ trigger,+ commissionId,+ projectId: entry.projectId || null,+ detail,+ },+ };+ }+}+/*** A scheduled cron tick. Runs outside the Express request lifecycle. A* confirmed deletion (ERR_NOT_FOUND), a paused commission, or a schedule that@@ -330,8 +386,8 @@ async function fireCommission(commission, trigger) {let startedTasteRecipe = null;let startedMusicGeneration = null;const skip = async (reason) => {- const run = await recordCommissionRun(commissionId, { status: 'skipped', reason, trigger }).catch(() => null);- return { status: 'skipped', reason, run };+ const { run, historyWarning } = await persistRun(commissionId, { status: 'skipped', reason, trigger }, trigger);+ return { status: 'skipped', reason, run, ...(historyWarning ? { historyWarning } : {}) };};try {// Gate on creative autonomy mode + daily cos budget BEFORE spawning anything@@ -431,14 +487,14 @@ async function fireCommission(commission, trigger) {});startedProjectId = project.id;- const run = await recordCommissionRun(commissionId, {+ const { run, historyWarning } = await persistRun(commissionId, {status: 'started',trigger,projectId: project.id,promptUsed: directive.goal,...(startedTasteRecipe ? { tasteRecipe: startedTasteRecipe } : {}),...(startedMusicGeneration ? { musicGeneration: startedMusicGeneration } : {}),- }).catch(() => null);+ }, trigger);// A taste-aware audio enqueue resolves its authoritative prompt/renderer// from this local run. If the write failed, advancing would make that lookup// look legitimately absent and silently release planner defaults instead.@@ -454,15 +510,18 @@ async function fireCommission(commission, trigger) {// Kick the planner → plan → execute loop. Fire-and-forget within this// try/catch (already outside the request lifecycle).await advanceAfterPlanStepSettled(project.id);- return { status: 'started', projectId: project.id, run };+ // The project IS running and its id is authoritative — the warning says only+ // that this fire's bookkeeping was lost, so a caller reports degraded history+ // instead of promising the render will appear in the commission's gallery.+ return { status: 'started', projectId: project.id, run, ...(historyWarning ? { historyWarning } : {}) };} catch (err) {console.error(`❌ Creative commission ${commissionId} ${trigger} fire failed: ${err?.message || err}`);const error = err?.message || String(err);- const run = await recordCommissionRun(commissionId, {+ const { run, historyWarning } = await persistRun(commissionId, {status: 'failed', error, trigger, projectId: startedProjectId,...(startedTasteRecipe ? { tasteRecipe: startedTasteRecipe } : {}),...(startedMusicGeneration ? { musicGeneration: startedMusicGeneration } : {}),- }).catch(() => null);- return { status: 'failed', error, projectId: startedProjectId, run };+ }, trigger);+ return { status: 'failed', error, projectId: startedProjectId, run, ...(historyWarning ? { historyWarning } : {}) };}}diff --git a/server/services/creativeCommissions/scheduler.test.js b/server/services/creativeCommissions/scheduler.test.jsindex 10d6f32241..4c42d7c1bd 100644--- a/server/services/creativeCommissions/scheduler.test.js+++ b/server/services/creativeCommissions/scheduler.test.js@@ -1,4 +1,4 @@-import { describe, it, expect, vi, beforeEach } from 'vitest';+import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';import { EventEmitter } from 'events';// eventScheduler is mocked so no real timers arm and isValidCron is deterministic.@@ -92,6 +92,7 @@ const {stopCommissionScheduler,runScheduledCommission,runCommissionNow,+ HISTORY_UNAVAILABLE,} = await import('./scheduler.js');const videoCommission = (over = {}) => ({@@ -546,3 +547,95 @@ describe('runCommissionNow (manual "Run Now")', () => {await expect(runCommissionNow('missing')).rejects.toMatchObject({ code: 'NOT_FOUND' });});});++// A lost run-history write is the failure mode that used to be invisible (#7529):+// the run row never landed, so the commission's gallery (derived from persisted+// run ids) stayed empty, no rating control appeared, and surfacing — gated on a+// real run — never fired. The outcome still said `started` with `run: null`,+// which is byte-identical to "the commission was deleted mid-fire".+describe('run-history write failures are observable (#7529)', () => {+ let consoleErrorSpy;+ beforeEach(() => {+ getCommissionMock.mockResolvedValue(videoCommission());+ consoleErrorSpy = vi.spyOn(console, 'error').mockImplementation(() => {});+ });+ afterEach(() => { consoleErrorSpy.mockRestore(); });++ it('reports a started fire whose history write failed, keeping the created project id', async () => {+ recordRunMock.mockRejectedValueOnce(Object.assign(new Error('write timeout'), { code: 'ETIMEDOUT' }));+ const outcome = await runCommissionNow('commission-1');+ // Generation genuinely started — the project id stays authoritative.+ expect(outcome).toMatchObject({ status: 'started', projectId: 'cd-xyz', run: null });+ expect(outcome.historyWarning).toEqual({+ code: HISTORY_UNAVAILABLE,+ outcome: 'started',+ trigger: 'manual',+ commissionId: 'commission-1',+ projectId: 'cd-xyz',+ detail: 'write-failed:ETIMEDOUT',+ });+ // No duplicate project and no replayed provider work to "repair" history.+ expect(createProjectMock).toHaveBeenCalledTimes(1);+ expect(advanceMock).toHaveBeenCalledWith('cd-xyz');+ });++ it('does NOT warn when the commission was deleted mid-fire (an honest absent run, not a degraded write)', async () => {+ recordRunMock.mockResolvedValueOnce(null);+ const outcome = await runCommissionNow('commission-1');+ expect(outcome).toMatchObject({ status: 'started', projectId: 'cd-xyz', run: null });+ expect(outcome.historyWarning).toBeUndefined();+ });++ it('omits the warning entirely on a clean fire', async () => {+ recordRunMock.mockResolvedValueOnce({ id: 'run-1', status: 'started' });+ const outcome = await runCommissionNow('commission-1');+ expect(outcome.historyWarning).toBeUndefined();+ });++ it('emits a scheduled diagnostic naming trigger and local ids, never the prompt or the raw driver message', async () => {+ recordRunMock.mockRejectedValueOnce(Object.assign(new Error('relation "commissions" does not exist'), { code: '42P01' }));+ await runScheduledCommission('commission-1');+ const line = consoleErrorSpy.mock.calls.map(([l]) => l).find((l) => l.includes('run history write failed'));+ expect(line).toContain('commission-1');+ expect(line).toContain('cd-xyz');+ expect(line).toContain('schedule');+ expect(line).toContain('write-failed:42P01');+ // Bounded classification only — no record contents, prompts or feedback.+ expect(line).not.toContain('relation "commissions" does not exist');+ expect(line).not.toContain('surreal');+ });++ it('reports a SKIPPED outcome whose history write failed', async () => {+ creativeModeMock.mockReturnValue('off');+ recordRunMock.mockRejectedValueOnce(new Error('disk full'));+ const outcome = await runCommissionNow('commission-1');+ expect(outcome).toMatchObject({ status: 'skipped', reason: 'autonomy-off', run: null });+ expect(outcome.historyWarning).toMatchObject({+ code: HISTORY_UNAVAILABLE, outcome: 'skipped', trigger: 'manual', projectId: null, detail: 'write-failed:Error',+ });+ });++ it('reports a FAILED outcome whose history write failed, still naming the orphaned project', async () => {+ advanceMock.mockRejectedValueOnce(new Error('advance kick failed'));+ recordRunMock+ .mockResolvedValueOnce({ id: 'run-1', status: 'started' }) // the started row landed+ .mockRejectedValueOnce(new Error('write timeout')); // the failure row did not+ const outcome = await runCommissionNow('commission-1');+ expect(outcome).toMatchObject({ status: 'failed', error: 'advance kick failed', projectId: 'cd-xyz', run: null });+ expect(outcome.historyWarning).toMatchObject({+ code: HISTORY_UNAVAILABLE, outcome: 'failed', trigger: 'manual', projectId: 'cd-xyz',+ });+ });++ it('still refuses to advance a taste-aware fire whose authoritative run was lost to a write failure', async () => {+ recordRunMock.mockRejectedValueOnce(new Error('write timeout'));+ getCommissionMock.mockResolvedValue(videoCommission({+ targetAbility: 'music',+ brief: { intent: 'ambient', musicTaste: { source: 'digital-twin' } },+ generation: { lengthSeconds: 45 },+ }));+ const outcome = await runCommissionNow('commission-1');+ expect(outcome).toMatchObject({ status: 'failed', error: 'taste-run-persistence-unavailable' });+ expect(advanceMock).not.toHaveBeenCalled();+ });+});