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
test: fail CI when a server failure line logs through console.log (#7945)
[._.]/ Adam Eivy10489b6ca226
diff --git a/AGENTS.md b/AGENTS.mdindex 72d82b7e01..4f559d9b99 100644--- a/AGENTS.md+++ b/AGENTS.md@@ -199,6 +199,7 @@ This complements the Security Model (the deployed product) — this section goveconsole.log(`🚀 Server started on port ${PORT}`);console.error(`❌ Failed to connect: ${err.message}`);```+ **The marker picks the stream.** A failure line (`❌`/`⛔`) goes to `console.error`, a deliberate refusal or skip to `console.warn`, and only progress/success stays on `console.log` — a failure on stdout is invisible to every stderr-based monitor. For a mixed status line, choose the sink first (`const log = ok ? console.log : console.error;`) rather than branching the emoji alone. `server/logLevelConventions.test.js` scans the whole server tree for this and carries no allowlist.- **LLM response merging — distinguish absent vs intentionally empty.** "Key absent" preserves the original; "key present with empty value" applies the clear. Don't use `.length` truthiness as the signal. Strings: `null`/`undefined` = absent, `""` = a clear (server helpers like `universeBuilderExpand.trimField` return `null` for non-strings). Arrays/objects: gate on `Array.isArray(parsed?.field)` / `parsed?.field !== null && typeof parsed?.field === 'object' && !Array.isArray(parsed.field)` before falling back. Keep server-side merges and the client's `pick` helpers mirrored.- **Sentinel + validate to distinguish "not set / failed" from "present-but-empty / valid".** Never let *absent*, *failed-to-fetch*, or *invalid* collapse into the same value as *fetched-and-legitimately-empty* or *valid*; use an explicit sentinel and validate before falling through, not `x.length` or `x || fallback`. Canonical examples in the local-LLM backends: model-list caches use `null = not fetched` vs `[] = cached-empty` (`ollamaManager.js` `installedModels`, `lmStudioManager.js` `availableModels`); `getBackend()` validates the `.env` marker before falling back to `process.env` (`server/services/localLlm.js`); a reachable-but-list-failed backend surfaces an explicit `modelsError` rather than `0 models` (`lmStudioManager.js` `getLastListError`).diff --git a/scripts/ci-test-plan.js b/scripts/ci-test-plan.jsindex 8710e158fe..9349b3b1bb 100644--- a/scripts/ci-test-plan.js+++ b/scripts/ci-test-plan.js@@ -242,6 +242,9 @@ export const ALWAYS_RUN_TESTS = ['server/lib/qwenAgentParsers.test.js','server/lib/testDataIsolation.guards.test.js','server/lib/testHelper.test.js',+ // Whole-tree scanner: any server file can log a failure through+ // `console.log`, and the guard only ever sees it as a path string.+ 'server/logLevelConventions.test.js','server/services/imageGen/renderTargets.guard.test.js','server/services/taskPromptDefaults.test.js','server/timerCallbackConventions.test.js',diff --git a/server/cos-runner/index.js b/server/cos-runner/index.jsindex 8d035e7353..dab5ee544c 100644--- a/server/cos-runner/index.js+++ b/server/cos-runner/index.js@@ -591,7 +591,11 @@ app.post('/spawn', async (req, res) => {const output = agent?.outputBuffer || '';const paused = agent?.paused === true;- console.log(`${paused ? '⏸️' : code === 0 ? '✅' : '❌'} Agent ${agentId} exited with code ${code}${paused ? ' after pause' : ''}`);+ // A non-zero exit is a failure line, so it belongs on stderr where a+ // stderr-based monitor can see it (#7945). A pause or a clean exit is+ // ordinary progress and stays on stdout.+ const logExit = !paused && code !== 0 ? console.error : console.log;+ logExit(`${paused ? '⏸️' : code === 0 ? '✅' : '❌'} Agent ${agentId} exited with code ${code}${paused ? ' after pause' : ''}`);// Save output to agent directoryconst agentDir = join(AGENTS_DIR, agentId);diff --git a/server/logLevelConventions.test.js b/server/logLevelConventions.test.jsnew file mode 100644index 0000000000..dfb8af026f--- /dev/null+++ b/server/logLevelConventions.test.js@@ -0,0 +1,231 @@+/**+ * Repo-wide guard: a failure line may not be logged through `console.log`.+ *+ * ## The bug class+ *+ * console.log(`FAILMARK npm install exit=${code}: ${output}`);+ *+ * `console.log` writes to stdout. Every stderr-based monitor — PM2's error log,+ * a `2>` redirect, a log shipper splitting streams, a human running+ * `npm start 2>errors.log` — is blind to that line, so the one message that+ * explains a failure is filed next to ordinary progress chatter.+ *+ * The defect kept coming back because every fix so far was file-scoped:+ * #6935 converted the media-generation pipeline, and by the time it merged the+ * same shape was live again in other domains (#7945). Nothing failed CI when+ * the next one landed. This scan is what makes the rule hold without anyone+ * remembering it.+ *+ * ## The rule+ *+ * A `console.log(…)` call whose ARGUMENT TEXT carries a failure marker is a+ * violation. Route it by what actually happened:+ *+ * - a genuine failure → `console.error`+ * - a deliberate refusal/skip → `console.warn`+ * - a mixed success/failure line (a ternary status message) → pick the sink+ * first and log through it: `const log = ok ? console.log : console.error;`+ *+ * Only the two FAILURE markers are scanned. The warning marker is deliberately+ * out of scope: plenty of its uses are legitimate information (an intentional+ * version-refusal notice in `services/sharing/importer.js`, for one), and+ * re-leveling those is per-domain judgment, not a tree-wide rule.+ *+ * ## Allowlist+ *+ * There is none, on purpose. Every site in the tree passes; a new violation is+ * a bug to fix, not an entry to add. If you are reading this because the scan+ * just failed, change `console.log` to `console.error` (or `console.warn` for a+ * refusal) on the named line.+ *+ * ## What this guard CANNOT see+ *+ * It is a lexer-assisted source scan, not a scope-aware AST pass. It reads the+ * ARGUMENT TEXT of a literal `console.log(` call, which means:+ *+ * - A message built into a variable first (`const line = `FAILMARK …`;+ * console.log(line);`) is invisible. That is the same shape the mixed-sink+ * fix produces on purpose, so the guard cannot distinguish the fix from an+ * evasion — it is a convention backstop, not a sandbox.+ * - An aliased logger (`const log = console.log; log(…)`) is invisible.+ * - A failure phrased without a marker emoji is invisible. The markers are+ * the repo's own single-line-logging convention (root `AGENTS.md`), so they+ * are the signal available to a text scan.+ *+ * Widening any of these means an AST pass plus a semantic notion of "this+ * message describes a failure", which no scan can have. The shapes above are+ * rare, and the marker convention is what makes the cheap version worth having.+ */++import { describe, it, expect } from 'vitest';+import { execFileSync } from 'child_process';+import { readFileSync } from 'fs';+import { dirname, join } from 'path';+import { fileURLToPath } from 'url';+import { blankLiterals, matchBracket } from './lib/sourceScan.js';++const SERVER_ROOT = dirname(fileURLToPath(import.meta.url));++// Built from code points so this file's own prose cannot be mistaken for a+// violating call site by a future grep-shaped guard, and so the literals stay+// legible in an editor that renders emoji at inconsistent widths.+const CROSS_MARK = String.fromCodePoint(0x274c); // cross mark+const NO_ENTRY = String.fromCodePoint(0x26d4); // no entry+const FAILURE_MARKERS = [CROSS_MARK, NO_ENTRY];++const CONSOLE_LOG_OPEN = /\bconsole\s*\.\s*log\s*\(/g;++/**+ * Every `console.log(…)` call in `src`, as `{ line, args }` where `args` is the+ * RAW argument text (literals intact — the markers live inside template+ * strings, which `blankLiterals` would erase). Call boundaries come from the+ * BLANKED copy so a `)` inside a string cannot end the span early and a+ * multi-line call is captured whole rather than by a fixed line window.+ */+export function consoleLogCalls(src) {+ const blanked = blankLiterals(src);+ const calls = [];+ for (const match of blanked.matchAll(CONSOLE_LOG_OPEN)) {+ const open = blanked.indexOf('(', match.index);+ const close = matchBracket(blanked, open);+ if (close === -1) continue;+ calls.push({+ line: src.slice(0, match.index).split('\n').length,+ // `close` is one past the matching `)`, so `close - 1` drops it.+ args: src.slice(open + 1, close - 1),+ });+ }+ return calls;+}++/** `line N: <excerpt>` for every console.log carrying a failure marker. */+export function findMislabeledFailureLogs(src) {+ return consoleLogCalls(src)+ .filter(({ args }) => FAILURE_MARKERS.some((marker) => args.includes(marker)))+ .map(({ line, args }) => `line ${line}: ${args.replace(/\s+/g, ' ').trim().slice(0, 120)}`);+}++const trackedServerSources = () => execFileSync('git', ['ls-files', '*.js'], {+ cwd: SERVER_ROOT,+ encoding: 'utf8',+ maxBuffer: 64 * 1024 * 1024,+}).split('\n').filter((f) => f && !f.includes('.test.'));++describe('failure lines log at error level (#7945)', () => {+ it('scans the server tree', () => {+ // A broken `git ls-files` (wrong cwd, detached checkout) would otherwise let+ // every assertion below pass by scanning nothing at all.+ expect(trackedServerSources().length).toBeGreaterThan(200);+ });++ it('finds the console.log calls it is meant to read', () => {+ // Proves the extractor still recognizes real call sites — without this the+ // scan below could go vacuously green if `consoleLogCalls` stopped matching.+ const withLogs = trackedServerSources().filter((file) => (+ consoleLogCalls(readFileSync(join(SERVER_ROOT, file), 'utf8')).length > 0+ ));+ expect(withLogs.length).toBeGreaterThan(100);+ });++ it('has no console.log carrying a failure marker', () => {+ const violations = [];+ for (const file of trackedServerSources()) {+ const src = readFileSync(join(SERVER_ROOT, file), 'utf8');+ if (!src.includes('console.log')) continue;+ if (!FAILURE_MARKERS.some((marker) => src.includes(marker))) continue;+ for (const hit of findMislabeledFailureLogs(src)) violations.push(`server/${file} ${hit}`);+ }++ expect(+ violations,+ 'These failure lines go to stdout, where every stderr-based monitor (PM2 error log, '+ + 'a `2>` redirect, a stream-splitting log shipper) is blind to them. The level keeps '+ + 'regressing because each past fix was file-scoped (#6935 → #7945).\n'+ + 'Fix: use `console.error` for a genuine failure, `console.warn` for a deliberate '+ + 'refusal or skip. For a mixed success/failure status line, choose the sink first — '+ + '`const log = ok ? console.log : console.error;` — see services/appBuilder.js.\n'+ + `Offenders:\n ${violations.join('\n ')}`,+ ).toEqual([]);+ });+});++// Guards the guard: if the recognizer stops seeing the broken shape, the scan+// above goes green and the bug class walks straight back in.+describe('the failure-log recognizer', () => {+ const log = (body) => `console.log(\`${body}\`);`;++ it('flags a failure marker in a console.log', () => {+ expect(findMislabeledFailureLogs(log(`${CROSS_MARK} build failed`)))+ .toEqual([`line 1: \`${CROSS_MARK} build failed\``]);+ expect(findMislabeledFailureLogs(log(`${NO_ENTRY} refused: no consent`)))+ .toEqual([`line 1: \`${NO_ENTRY} refused: no consent\``]);+ });++ it('flags a marker reached only through a ternary', () => {+ // The mixed status line — the shape that hides a failure behind a success+ // message and the reason the fix is "choose the sink first".+ expect(findMislabeledFailureLogs(+ 'console.log(`${ok ? "OK" : "' + CROSS_MARK + '"} Build done`);',+ )).toHaveLength(1);+ });++ it('flags a marker on a continuation line of a multi-line call', () => {+ // A per-line grep sees `console.log(` and the marker on different lines and+ // misses this entirely — the whole reason the span is bracket-matched.+ expect(findMislabeledFailureLogs(`+ console.log(+ \`${CROSS_MARK} render failed [\${jobId}]: \${reason}\`,+ );+ `)).toEqual([`line 2: \`${CROSS_MARK} render failed [\${jobId}]: \${reason}\`,`]);+ });++ it('accepts console.error and console.warn', () => {+ expect(findMislabeledFailureLogs(`console.error(\`${CROSS_MARK} build failed\`);`)).toEqual([]);+ expect(findMislabeledFailureLogs(`console.warn(\`${NO_ENTRY} skipping fallback\`);`)).toEqual([]);+ });++ it('leaves non-failure markers alone', () => {+ // Success, progress and warning lines are all legitimate on stdout; the+ // warning marker in particular is deliberately out of scope.+ expect(findMislabeledFailureLogs(log('✅ build complete'))).toEqual([]);+ expect(findMislabeledFailureLogs(log('\u{1f680} deploy started'))).toEqual([]);+ expect(findMislabeledFailureLogs(log('⚠️ version refused — older peer'))).toEqual([]);+ });++ it('is not skewed by a paren or quote inside a literal', () => {+ // An unbalanced `)` in a string would end the span early and hide the+ // marker after it; a quote inside a regex character class would swallow+ // code as if it were a string.+ expect(findMislabeledFailureLogs(`+ console.log(cleaned.replace(/["')]/g, ''), \`${CROSS_MARK} failed\`);+ `)).toHaveLength(1);+ // A neighbouring call must not be absorbed into this one's span.+ expect(findMislabeledFailureLogs(`+ console.log('fine');+ console.error(\`${CROSS_MARK} failed\`);+ `)).toEqual([]);+ });++ it('ignores a marker that only appears in a comment or in unrelated code', () => {+ expect(findMislabeledFailureLogs(`+ // console.log(\`${CROSS_MARK} do not do this\`)+ const marker = '${CROSS_MARK}';+ console.log('fine');+ `)).toEqual([]);+ });++ // Bypass probe: the scan is only worth its runtime if a reintroduced+ // violation in a REAL tracked file actually turns it red. Mutate a file's+ // source in memory and assert the same predicate the tree-wide scan uses.+ it('would flag a reintroduced violation in a real server file', () => {+ const file = 'services/appBuilder.js';+ const src = readFileSync(join(SERVER_ROOT, file), 'utf8');+ expect(findMislabeledFailureLogs(src)).toEqual([]);+ const regressed = src.replace(+ /console\.error\(`❌ npm install/,+ 'console.log(`❌ npm install',+ );+ expect(regressed).not.toBe(src);+ expect(findMislabeledFailureLogs(regressed)).toHaveLength(1);+ });+});diff --git a/server/services/appBuilder.js b/server/services/appBuilder.jsindex 89aeb261a8..3478251c10 100644--- a/server/services/appBuilder.js+++ b/server/services/appBuilder.js@@ -122,14 +122,16 @@ export async function buildApp(app) {console.log(`📦 Installing ${label} dependencies for ${app.name}`);const installResult = await runNpmInstall(subDir);if (!installResult.success) {- console.log(`❌ npm install (${label}) exit=${installResult.exitCode}: ${installResult.output.slice(-300)}`);+ console.error(`❌ npm install (${label}) exit=${installResult.exitCode}: ${installResult.output.slice(-300)}`);return { success: false, failure: 'install', label, exitCode: installResult.exitCode, output: installResult.output, buildCommand };}}}const result = await runBuild(cmd, args, app.repoPath);- console.log(`${result.success ? '✅' : '❌'} Build ${result.success ? 'complete' : 'failed'} for ${app.name}`);+ // A failed build is an error line (#7945); a successful one is progress.+ const logBuild = result.success ? console.log : console.error;+ logBuild(`${result.success ? '✅' : '❌'} Build ${result.success ? 'complete' : 'failed'} for ${app.name}`);if (!result.success) {return { success: false, failure: 'build', code: result.code, signal: result.signal, output: result.output, buildCommand };diff --git a/server/services/appDeployer.js b/server/services/appDeployer.jsindex 1bf0e14fc8..b84b1357cb 100644--- a/server/services/appDeployer.js+++ b/server/services/appDeployer.js@@ -149,7 +149,9 @@ export async function runDeployFlow(console.log(`🚀 Deploy started for ${app.name} [${flags.join(', ') || 'default'}]`);const result = await runDeploy(app, flags, onOutput || (() => {}));- console.log(`${result.success ? '✅' : '❌'} Deploy ${result.success ? 'complete' : 'failed'} for ${app.name}`);+ // A failed deploy is an error line (#7945); a successful one is progress.+ const logDeploy = result.success ? console.log : console.error;+ logDeploy(`${result.success ? '✅' : '❌'} Deploy ${result.success ? 'complete' : 'failed'} for ${app.name}`);return { ok: true, success: result.success, code: result.code };}diff --git a/server/services/creative/toolRegistry.js b/server/services/creative/toolRegistry.jsindex 7c328423a0..2279b5108b 100644--- a/server/services/creative/toolRegistry.js+++ b/server/services/creative/toolRegistry.js@@ -300,7 +300,7 @@ export async function dispatchCreativeTool(name, args = {}, ctx = {}) {if (BUDGETED_COST_CLASSES.has(tool.costClass) && !tool.selfBudgeted) {const status = await getDomainBudgetStatus(BUDGET_DOMAIN);if (!status.withinBudget) {- console.log(`⛔ creative dispatch ${name} over budget (${BUDGET_DOMAIN} ${status.exceeded})`);+ console.warn(`⛔ creative dispatch ${name} over budget (${BUDGET_DOMAIN} ${status.exceeded})`);await recordLedger(ctx, { ...base, outcome: 'budget-exceeded', timingMs: 0, exceeded: status.exceeded });return { ok: false, rejected: true, reason: 'budget', exceeded: status.exceeded, mode, tool: name };}diff --git a/server/services/creativeDirector/sceneEvaluator.js b/server/services/creativeDirector/sceneEvaluator.jsindex a473d435ed..017285f0d5 100644--- a/server/services/creativeDirector/sceneEvaluator.js+++ b/server/services/creativeDirector/sceneEvaluator.js@@ -321,7 +321,7 @@ export async function applySceneVerdict(project, scene, verdict, llm = null, run}await updateScene(project.id, scene.sceneId, { ...(project.workspace === 'video' ? { expectedWorkRevision: scene.workRevision || 0 } : {}), status: 'failed', evaluation });- console.log(`⛔ CD scene ${scene.sceneId} failed by vision — retries exhausted`);+ console.error(`⛔ CD scene ${scene.sceneId} failed by vision — retries exhausted`);return advance();}diff --git a/server/services/musicVideo/render.js b/server/services/musicVideo/render.jsindex 11cc3b6b9d..0a5862bc7b 100644--- a/server/services/musicVideo/render.js+++ b/server/services/musicVideo/render.js@@ -350,7 +350,7 @@ export async function renderMusicVideo(projectId) {job.status = 'error';const reason = `Failed to spawn ffmpeg: ${err.message}`;job.lastError = reason;- console.log(`❌ Music-video render spawn error [${jobId.slice(0, 8)}]: ${reason}`);+ console.error(`❌ Music-video render spawn error [${jobId.slice(0, 8)}]: ${reason}`);broadcastSse(job, { type: 'error', error: reason });projectRenders.delete(projectId);await updateProject(projectId, { status: 'failed' }).catch(() => {});@@ -363,7 +363,9 @@ export async function renderMusicVideo(projectId) {job.status = canceled ? 'canceled' : 'error';const reason = canceled ? 'Render cancelled' : signal ? `Killed by signal ${signal}` : `ffmpeg exit ${code}`;job.lastError = reason;- console.log(`${canceled ? '🛑' : '❌'} Music-video render ${canceled ? 'cancelled' : 'failed'} [${jobId.slice(0, 8)}]: ${reason}`);+ // A cancel is a user action (stdout); a non-zero exit is a failure (#7945).+ const logClose = canceled ? console.log : console.error;+ logClose(`${canceled ? '🛑' : '❌'} Music-video render ${canceled ? 'cancelled' : 'failed'} [${jobId.slice(0, 8)}]: ${reason}`);await unlink(outputPath).catch(() => {});broadcastSse(job, { type: canceled ? 'canceled' : 'error', error: reason });projectRenders.delete(projectId);diff --git a/server/services/privacySubjects.js b/server/services/privacySubjects.jsindex 92304e51ae..dbf3e6874e 100644--- a/server/services/privacySubjects.js+++ b/server/services/privacySubjects.js@@ -232,7 +232,7 @@ export async function hasActiveConsent(subjectId) {export async function assertSubjectConsent(subjectId, { action = 'this action' } = {}) {const subject = await assertSubject(subjectId);if (await hasActiveConsent(subject.id)) return subject;- console.log(`⛔ Refused ${action} for privacy subject ${subject.id}: no consent on file`);+ console.warn(`⛔ Refused ${action} for privacy subject ${subject.id}: no consent on file`);throw new ServerError(`Privacy subject ${subject.id} has no recorded consent — ${action} refused`,{ status: 403, code: 'SUBJECT_CONSENT_REQUIRED' },diff --git a/server/services/providerPrerequisites.js b/server/services/providerPrerequisites.jsindex 1a7fb46f8c..1f9ee12092 100644--- a/server/services/providerPrerequisites.js+++ b/server/services/providerPrerequisites.js@@ -264,7 +264,7 @@ export function prerequisitesMetForRouting(provider, providers) {const runtimes = runtimeSnapshotFor([providerRuntimeKey(provider)]);const { missing } = forProvider(provider, runtimes, gatewayKeyState(providers));if (!blocksRouting(missing)) return true;- console.log(`⛔ Skipping fallback ${provider?.id || 'provider'}: ${describeMissingPrerequisites(missing)}`);+ console.warn(`⛔ Skipping fallback ${provider?.id || 'provider'}: ${describeMissingPrerequisites(missing)}`);return false;}diff --git a/server/services/providerPrerequisites.test.js b/server/services/providerPrerequisites.test.jsindex 394f8d7948..4cda1d5844 100644--- a/server/services/providerPrerequisites.test.js+++ b/server/services/providerPrerequisites.test.js@@ -43,6 +43,7 @@ beforeEach(() => {getProviderRuntimeStatus.mockResolvedValue(null);getProviderRuntimeStatuses.mockResolvedValue({});vi.spyOn(console, 'log').mockImplementation(() => {});+ vi.spyOn(console, 'warn').mockImplementation(() => {});vi.spyOn(console, 'error').mockImplementation(() => {});});@@ -327,12 +328,16 @@ describe('prerequisitesMetForRouting', () => {expect(prerequisitesMetForRouting(wrapper, { orcarouter: { id: 'orcarouter' } })).toBe(false);});- it('logs one line naming what is missing when it skips a provider', () => {+ it('warns one line naming what is missing when it skips a provider', () => {peekProviderRuntimeStatuses.mockReturnValue({ codex: CODEX_ABSENT });prerequisitesMetForRouting(codex(), {});- expect(console.log).toHaveBeenCalledWith(expect.stringContaining('Codex CLI is not installed'));+ // A skipped fallback is a deliberate refusal, so it belongs on stderr where+ // a stderr-based monitor sees it — not on stdout with progress chatter+ // (#7945, enforced tree-wide by server/logLevelConventions.test.js).+ expect(console.warn).toHaveBeenCalledWith(expect.stringContaining('Codex CLI is not installed'));+ expect(console.log).not.toHaveBeenCalledWith(expect.stringContaining('Codex CLI is not installed'));});});diff --git a/server/services/videoGen/generateVideo.js b/server/services/videoGen/generateVideo.jsindex 45b8b93d7d..2888150924 100644--- a/server/services/videoGen/generateVideo.js+++ b/server/services/videoGen/generateVideo.js@@ -337,7 +337,7 @@ export async function generateVideo({ pythonPath, prompt, negativePrompt = '', m// (requiresPreDownload). icLoraArgs turns that into the user-facing 400; log// the reason here so the server log explains WHY there's no auto-download.if (!resolved.path) {- console.log(`⛔ IC-LoRA weight for ${mode} needs an explicit download (auto-fetch would snapshot ${resolved.spec.mirrorRepo || resolved.spec.repo})`);+ console.warn(`⛔ IC-LoRA weight for ${mode} needs an explicit download (auto-fetch would snapshot ${resolved.spec.mirrorRepo || resolved.spec.repo})`);}}diff --git a/server/services/videoTimeline/local.js b/server/services/videoTimeline/local.jsindex ff339bc8aa..82c5a4696d 100644--- a/server/services/videoTimeline/local.js+++ b/server/services/videoTimeline/local.js@@ -709,7 +709,7 @@ export async function renderProject(projectId) {job.status = 'error';const reason = `Failed to spawn ffmpeg: ${err.message}`;job.lastError = reason;- console.log(`❌ Timeline render spawn error [${jobId.slice(0, 8)}]: ${reason}`);+ console.error(`❌ Timeline render spawn error [${jobId.slice(0, 8)}]: ${reason}`);broadcastSse(job, { type: 'error', error: reason });projectRenders.delete(projectId);closeJobAfterDelay(jobs, jobId);@@ -729,7 +729,9 @@ export async function renderProject(projectId) {? 'Render cancelled': signal ? `Killed by signal ${signal}` : `ffmpeg exit ${code}`;job.lastError = reason;- console.log(`${canceled ? '🛑' : '❌'} Timeline render ${canceled ? 'cancelled' : 'failed'} [${jobId.slice(0, 8)}]: ${reason}`);+ // A cancel is a user action (stdout); a non-zero exit is a failure (#7945).+ const logClose = canceled ? console.log : console.error;+ logClose(`${canceled ? '🛑' : '❌'} Timeline render ${canceled ? 'cancelled' : 'failed'} [${jobId.slice(0, 8)}]: ${reason}`);await unlink(outputPath).catch(() => {});broadcastSse(job, { type: canceled ? 'canceled' : 'error', error: reason });projectRenders.delete(projectId);