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: name the signal when a fine-tuning trainer is killed instead of exiting (#6268)
[._.]/ Adam Eivy2836f6ba9bc4
diff --git a/server/services/voice/fineTuning.js b/server/services/voice/fineTuning.jsindex 042904306c..0026223b0e 100644--- a/server/services/voice/fineTuning.js+++ b/server/services/voice/fineTuning.js@@ -288,11 +288,15 @@ export async function startFineTuningJob({finalizeJob(jobState);};- child.on('close', (code) => {+ child.on('close', (code, signal) => {if (code === 0) return settle({ status: 'completed', progress: 100 });- settle(abortController.signal.aborted- ? CANCELLED_OUTCOME- : { status: 'failed', error: `Process exited with code ${code}` });+ if (abortController.signal.aborted) return settle(CANCELLED_OUTCOME);+ // A killed child reports a null code — an OOM reap during a long training+ // run is the likely cause, so name the signal rather than "code null".+ settle({+ status: 'failed',+ error: code === null ? `Process terminated by signal ${signal}` : `Process exited with code ${code}`,+ });});child.on('error', (err) => {diff --git a/server/services/voice/fineTuning.test.js b/server/services/voice/fineTuning.test.jsindex c6aa0a6387..a4c372bf31 100644--- a/server/services/voice/fineTuning.test.js+++ b/server/services/voice/fineTuning.test.js@@ -100,7 +100,7 @@ const createScriptedChild = ({ signal } = {}) => {child.stdout.emit('data', Buffer.from(`${JSON.stringify(frame)}\n`));}};- child.exit = (code = 0) => child.emit('close', code, null);+ child.exit = (code = 0, signal = null) => child.emit('close', code, signal);signal?.addEventListener('abort', () => {child.kill('SIGTERM');process.nextTick(() => {@@ -150,7 +150,7 @@ const drainJobRecord = async (jobId, { timeout = 5_000 } = {}) => {return parsed;}, { timeout, interval: 20 });- let previous = null;+ let previous = await readFile(jobRecordPath(jobId), 'utf8');await vi.waitFor(async () => {const bytes = await readFile(jobRecordPath(jobId), 'utf8');const prior = previous;@@ -245,17 +245,26 @@ describe('fineTuning', () => {expect((await getFineTuningJobStatus(startRes.jobId, PROFILE.id)).status).toBe('cancelled');});- it('records a non-zero exit as failed with its exit code', async () => {+ it('reports an abnormal exit by its code, or by the signal that killed it', async () => {queryMock.mockResolvedValue({ rows: [{ data: PROFILE }] });await seedSourceAudio();const scripted = useScriptedRunner();- const { jobId } = await startFineTuningJob({ profileId: PROFILE.id, epochs: 2 });+ const exited = await startFineTuningJob({ profileId: PROFILE.id, epochs: 2 });scripted().exit(3);+ expect(await drainJobRecord(exited.jobId)).toMatchObject({+ status: 'failed',+ error: 'Process exited with code 3',+ });- const record = await drainJobRecord(jobId);- expect(record.status).toBe('failed');- expect(record.error).toBe('Process exited with code 3');+ // A killed child reports a null code; "exited with code null" tells the+ // operator nothing about an OOM reap partway through a long run.+ const killed = await startFineTuningJob({ profileId: PROFILE.id, epochs: 2 });+ scripted().exit(null, 'SIGKILL');+ expect(await drainJobRecord(killed.jobId)).toMatchObject({+ status: 'failed',+ error: 'Process terminated by signal SIGKILL',+ });});it('persists a job.json sidecar beside the checkpoints when the run finishes', async () => {