Repository navigation
feat(delegate): worker+auditor orchestration loop (piece #4 of 4) - #358
Conversation
Ties pieces #1-3 into one delegated step: 1. WORKER (resumable session) implements the step goal, editing files. 2. Capture + persist the worker session id (store). 3. AUDITOR (fresh, independent, read-only) reviews the git diff. 4. DECIDE — APPROVE -> accept; REVISE -> send the issues back to the SAME worker session and re-audit (up to maxRevisions); BLOCK -> stop. bin/delegate-loop.cjs: - decideNext(verdict, revisions, max) / buildRevisePrompt(issues, goal) — PURE. - gitDiff(cwd) — unified diff of the working tree (IMPURE). - runDelegatedStep(...) — the worker<->auditor cycle for one step; every subprocess/IO dependency is injectable, so the whole loop is unit-tested without a live model. - CLI entrypoint: node bin/delegate-loop.cjs --task-key X --goal "..." --worker codex --auditor claude --cwd . Proven end-to-end with REAL models: gave a codex worker a buggy sum.js (return a - b); the loop ran worker -> auditor(REVISE) -> worker RESUMED with the issues -> auditor (APPROVE) -> accepted. Final file: return a + b; independent claude auditor: "correctly changes add to return a + b with no unrelated changes or regressions." 12 unit tests (decide logic, revise-resumes-same-session, exhausted, block, worker-error), gated in test:ci. Task #49. Completes the worker+auditor delegation primitive; skill wiring (nf:quick --delegate / nf:solve) is the remaining last-mile integration. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Warning Review limit reached
Next review available in: 8 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Pull request overview
Completes the delegation “primitive” by adding a worker→auditor orchestration loop that can iterate revisions using the same worker session, plus unit tests and CI wiring so the loop can be tested without calling real models.
Changes:
- Add
bin/delegate-loop.cjsimplementingdecideNext,buildRevisePrompt,gitDiff, andrunDelegatedStep, plus a small CLI wrapper. - Add
bin/delegate-loop.test.cjscovering accept/block/revise/exhausted paths and “resume same session” behavior with injected fakes. - Include the new test in the
test:ciscript.
Reviewed changes
Copilot reviewed 1 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| package.json | Adds bin/delegate-loop.test.cjs to CI test run. |
| bin/delegate-loop.cjs | New worker+auditor orchestration loop and CLI entrypoint. |
| bin/delegate-loop.test.cjs | New unit tests for decision logic and revision/resume behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
What (piece #4 of 4 — completes the primitive)
Ties pieces #1–3 into one delegated step:
maxRevisions); BLOCK → stop.API (
bin/delegate-loop.cjs)decideNext(verdict, revisions, max),buildRevisePrompt(issues, goal)gitDiff(cwd),runDelegatedStep(...)— every subprocess/IO dep is injectable → the whole loop is unit-tested without a live model.node bin/delegate-loop.cjs --task-key X --goal "…" --worker codex --auditor claude --cwd .Proven end-to-end with REAL models
Gave a codex worker a buggy
sum.js(return a - b). The loop ran worker → auditor(REVISE) → worker RESUMED with the issues → auditor(APPROVE) → accepted. Final file:return a + b; the independent claude auditor's own words: "correctly changes add to return a + b with no unrelated changes or regressions." — i.e. the revise cycle itself fired live.Tests
12 unit tests (decide logic, revise-resumes-the-same-session, exhausted-at-cap, block, worker-error-skips-audit), gated in
test:ci.The delegation primitive is now complete
Pieces #1–4 give a runnable, tested long-running cross-LLM worker+auditor loop. The last mile — wiring it into
nf:quick --delegate/nf:solveremediation — is a follow-up skill integration.🤖 Generated with Claude Code