Background service: daemonize the worker + durable pause/resume switch - #13
Merged
Merged
Conversation
…e 1: CLI control surface" passed gates Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NGgfho2J6YfRSQN1bSDhj6
…e 2: Worker robustness" passed gates Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NGgfho2J6YfRSQN1bSDhj6
…e 3: Deploy artifacts" passed gates Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NGgfho2J6YfRSQN1bSDhj6
…e 4: Docs + spec lockstep" passed gates Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NGgfho2J6YfRSQN1bSDhj6
…worker-daemon-pause-resume # Conflicts: # README.md # worker/src/start.mjs # worker/test/start-wiring.test.mjs
…er PI_DISPATCH_REQUIRE_WORKER_TESTS A VALKEY_TEST_URL-only skip let the durability tests silently no-op in CI if the env var were ever dropped -- "skipped = unverified". Match cron.integration: throw when required-but-unconfigured so the pause-survives-restart guarantee cannot pass green while unrun. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NGgfho2J6YfRSQN1bSDhj6
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.
Daemonizes the worker across Linux/macOS/Windows and adds a durable pause/resume switch built on BullMQ's own
queue.pause()(a durable Valkey key), exposed aspi-dispatch pause|resume|status. "Off" stops the worker draining without rejecting enqueues, and the paused state survives a worker restart — verified live. Also hardens the daemon path: a WindowsSIGBREAKhandler, a boot-time reaper for orphanedpi-job-*containers, a config-error exit-code fix so systemd can't hot-loop, and cross-platform service artifacts (systemd unit, launchd plist, nssm installer) with secrets sourced from.envat runtime (never committed).What's in it
worker/src/cli.mjs):pause/resume/statusonqueue.pause()/resume()/isPaused()(reads onlyVALKEY_URL, failFast);entryExitCode()+.catch()maps a config error to exit 2 (non-retryable).index.mjs,start.mjs): win32SIGBREAK→ existing graceful shutdown; injectable boot reaper (docker ps/rm -fof strays, never throws, awaited before draining);reasonon the completion log so a restart-dropped job is visible.deploy/): launchd plist + POSIX/Windows.envwrappers + nssm installer;worker.servicegainsStartLimit*+RestartPreventExitStatus=2and is relabeled TEMPLATE; newdeploy-lint.ymlCI (xmllint/sh -n/systemd-analyze).DES-CONCURRENCY-3records the single-worker-per-daemon reaper invariant;REQ-LOCAL-JOB-VISIBILITYnote amended for the daemon's persistent captured log.Verification
Closes #6
🤖 Generated with Claude Code