daemon: batched dequeue per tick + SIGHUP config hot-reload#13
Open
mrap wants to merge 1 commit into
Open
Conversation
- Add spawns_per_tick config field (default 4) to cap workers spawned per tick - Rewrite daemon dequeue loop: drain up to spawns_per_tick per tick with 50-150ms jitter - SIGHUP handler: live-reload max_workers/spawns_per_tick/claude_bin without restart - Add `boi daemon reload` subcommand (sends SIGHUP to daemon.pid) - Add try_load()/try_load_from() for fallible config parsing (bad config = no-op) - docs/daemon.md: tick cadence, spawns_per_tick semantics, hot-reload behavior - 14 new tests: daemon_batch (8) + daemon_hotreload (6), all passing Co-Authored-By: Claude Sonnet 4.6 <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.
Motivation
Problem 1 — 40s ramp time
The daemon loop dequeued one spec per tick with a ~5s sleep. Starting from 0 workers with
max_workers=8took ~40s before all slots were filled. During that window specs sat idle in the queue.Problem 2 — restart orphans in-flight workers
Bumping
max_workersrequiredboi daemon restart, which kills every running worker mid-task. This was the primary disruption path for live tuning.What changed
spawns_per_tick(T2AD4 + T47CE)spawns_per_tick: Option<u32>field inConfig(default 4).to_spawn = cap_remaining.min(spawns_per_tick)per tick and drains up to that many queue entries.batch slot 1/4) for easy telemetry correlation.boi config set spawns_per_tick Nnow works.SIGHUP hot-reload (T7AFE)
signal_hook::flag::register(SIGHUP, reload_flag)in the daemon.config::try_load()→ updatewc.max_workers,wc.spawns_per_tick,wc.claude_bin. Parse failure = no-op + loud log.WorkerConfig.boi daemon reloadsubcommand sends SIGHUP to~/.boi/pids/daemon.pid. Typical path:boi config set max_workers 10 && boi daemon reload.Mitigations
spawns_per_tickgit worktree addindex contentiontry_loadreturnsErron parse failure; old values keptTests
Covered scenarios:
apply_reloadupdates only hot fieldswcretained, error loggedCold-start behavior (smoke run)
Not yet run against live Anthropic API — no smoke data yet. Once this merges to main and a batch of 6+ specs are queued, observe batch slot logs and API 429 rate.
Docs
docs/daemon.md: tick cadence,spawns_per_ticksemantics, SIGHUP reload, what does/doesn't reload.README.md:boi daemon reloadadded to command list.SKILL.md:boi config set max_workers N && boi daemon reloadis now the live-bump path.🤖 Generated with Claude Code