Repository navigation
Keep the server running when a job's state write fails with ENOSPC - #85
Merged
Merged
Conversation
The spawn handler (pid), the stdout line handler (session id) and the job's stdout/stderr write streams ran outside any try. On a full disk their ENOSPC reached the daemon's uncaught-exception handler; launchd restarted the server and every restart interrupted the running jobs (18 restarts, 29 interrupted jobs on 2026-11-11 03:49-06:00Z). Log those failures and keep the job going; skip end() on a stream that already failed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
On 2026-11-11 the operator Mac ran out of disk. Between 03:49 and 06:00Z the main skillhook daemon (0.15.2) restarted 18 times, and each restart marked the jobs it was running as interrupted: 29 jobs in total. The service log has 8
daemon uncaught exception ... ENOSPCtraces. They come from:JobStore.update→writeJsonFile, called from thechild.once("spawn")handler (queue.js:747, recording the pid);feedLinehandler (queue.js:679/690, recording the session id);Error: ENOSPC ... write, which matches an un-listened'error'event on the job's stdout/stderrcreateWriteStream.All three run in event handlers outside any
try, so the error reaches the process-level handler and the server restarts.Change
recordInHandlerwraps those twostore.updatecalls. On failure it keeps the patch in memory, logscould not record job state, and still emitsjob.updated.'error'listeners (could not write job output).end()is skipped on a stream that has already been destroyed, so the attempt can't hang.Tests
JobQueue when the disk is full: the pid write throws ENOSPC and the job still succeeds, with the warning logged. It fails onmainwith the unhandled ENOSPC error.pnpm typecheckis clean.The disk itself (other products' CI caches) is tracked separately in the operator's reliability backlog (RA-013).
🤖 Generated with Claude Code