Worker-pool controller: queue client, worker, backlog, local review gate (phases 1,3,7)#1
Merged
Merged
Conversation
Worktree-per-worker pool over existing hyperpanes control primitives only (no core/Rust changes): a plain control-API client reusing this repo's ControlClient. Per task: git worktree add an isolated checkout, open_pane a worker cwd'd there, mint a pane-scoped token handed over a short-lived handshake file, dispatch on the message bus, poll liveness (explicit DONE/FAIL else pane 'exited', never activity:'idle'), collect RESULT.md, tear down pane-first-then-directory. Bounded concurrency, failure/cleanup matrix, meta-based orphan reconciliation, and a --dry-run planner. - kinds.ts: canonical Task schema (doc 05), zod loader, pure helpers - git.ts: git worktree add/remove/prune/list wrapper - controller.ts: planTask + lifecycle + bounded pool + reconcile - worker.ts: handshake → scoped client → bus task → mock work → DONE - cli.ts: arg parsing, --dry-run smoke path, sample backlog - kinds.test.ts: unit tests for the pure planning logic Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Worker: replace the mock RESULT.md with a real agent run gated behind an injectable AgentRunner. The default spawnAgentRunner shells out to a configurable command (default 'claude --permission-mode acceptEdits -p <prompt>', overridable via HP_WORKER_AGENT_CMD) in the task worktree, captures stdout/exit code with a wall-clock timeout, and returns a structured outcome (success on exit 0, failed/timeout otherwise) so the controller can ack/nack. runTask is pure of process/exit concerns and unit-tested with a FAKE runner (success + timeout + failed paths) that never spawns claude. main() is now guarded by an entry-point check so importing the module in tests is side-effect free. Backlog (phase 7): new src/backlog/ generator that produces canonical Tasks (kinds.ts shape) and enqueues them via the existing QueueClient.enqueue route. Sources: a TODO/FIXME code scan (git grep, scanner injectable) and an explicit list/JSON input, with a failing-test source seam ready to drop in. --dry-run prints the Tasks without POSTing; a CLI entry (dist/backlog/cli.js) wires the flags. Vitest covers dry-run, task shape, dedupe, and enqueue. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Add a runtime RawTaskSchema in kinds.ts (Task is now inferred from it) so the queue wire shape is validated, not just type-asserted, and pin it against the Rust-derived golden fixture. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Eyalm321
added a commit
that referenced
this pull request
Jun 15, 2026
Patch bump 0.1.6 -> 0.1.7. Ships the worker-pool controller (src/worker-pool/, src/backlog/) merged in #1. Co-authored-by: Eyalm321 <eyal@sunsationsusa.com> Co-authored-by: Claude Opus 4.8 <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.
The worker-pool controller (phases 1, 3, 7) + a local subscription review gate. Branches off
main(2451931);mainuntouched.Included
src/worker-pool/): per task →git worktree add→open_paneworker → mint subtree-scoped token → dispatch → poll → teardown, with a concurrency cap and--dry-run.queue-client.tsrepoints dispatch onto the Rust queue's HTTP routes;kinds.tscarries a strict zodRawTaskSchemabyte-matching the Rust wire shape (camelCase / epoch-ms / flattened lease), pinned by a vendoredtask-wire.golden.jsoncontract test.src/backlog/): TODO/FIXME scan + list sources → enqueue, with a--dry-runCLI.worker.tsruns a real agent viaclaude -p(Claude Code subscription) behind an injectable runner.review.ts: after a worker succeeds, the controller reviews the diff withclaude -p(subscription) and only merges onapprove;block→ nackreview-blocked→ failed. Fail-closed on missing/unauthclaude, timeout, or unparseable output. Toggle via--no-review/HP_REVIEW.Verification
tsc+vitestgreen (144 tests).claude -p: a clean diff → approve (risk 3), a diff that guts a security test + exfiltrates a token → block (risk 10).Notes
ANTHROPIC_API_KEY, no metered API call anywhere.🤖 Generated with Claude Code