docs(rules): add Delegation Completion Contract to agent orchestration rules#2471
Conversation
…n rules The 'Parallel Task Execution' rule encourages agents to spawn subagents, but defines no completion contract. Observed failure mode: subagents followed the rule, spawned their own children, and returned 'waiting for background agents' as their final answer. All children completed successfully, but their results were orphaned because a parent whose turn has ended cannot receive completion notifications - leaving zombie 'running' tasks and lost work. Adds three rules that apply at every delegation depth: 1. Your final message IS the deliverable (never end with 'waiting') 2. If you delegate, you own collection (no fire-and-forget) 3. Decompose only when work cannot fit in one context
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (1)
📜 Recent review details⏰ Context from checks skipped due to timeout. (1)
🧰 Additional context used📓 Path-based instructions (1){skills,commands,agents,rules}/**⚙️ CodeRabbit configuration file
Files:
🔇 Additional comments (1)
📝 WalkthroughSummary by CodeRabbit
WalkthroughAdds a "Delegation Completion Contract" section to rules/common/agents.md, specifying that delegating agents must own result collection, prohibiting fire-and-forget returns while child tasks run, and adding a rule against re-delegating single-agent-scoped work, with supporting rationale. ChangesDelegation Completion Contract
Estimated code review effort: 1 (Trivial) | ~3 minutes Related PRs: None identified. Suggested labels: documentation Suggested reviewers: None identified. 🐰 A hop, a rule, a tidy line — 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ 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 |
| 1. **Your final message IS the deliverable.** Never end your turn with "waiting for background agents" — a spawned task is not a completed task. Ending your turn while children are running orphans their results (completed children cannot notify a parent whose turn has ended). | ||
| 2. **If you delegate, you own collection.** Wait for results, integrate them, then return. Fire-and-forget delegation is forbidden. | ||
| 3. **Decompose only when the work cannot fit in one context.** Do not re-delegate a task already sized for a single agent — depth is an outcome, not a plan. | ||
|
|
||
| > Rationale: observed failure mode — research agents followed "Parallel Task Execution" above, spawned children, and returned "waiting" as their final answer. All children completed successfully but their results were orphaned. The parallel rule without a completion contract produces zombie tasks. |
There was a problem hiding this comment.
Root AGENTS.md still missing the completion guardrail
The root-level AGENTS.md contains its own parallel-execution directive ("Use parallel execution for independent operations — launch multiple agents simultaneously.") but has no corresponding completion contract. Agents that are initialized only from AGENTS.md — or that cache it independently — will get the parallel mandate without the collection requirement, recreating exactly the failure mode this PR fixes. A brief note in AGENTS.md (e.g., "agents that delegate must collect and return all results before completing their turn") would close that gap.
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
daltino
left a comment
There was a problem hiding this comment.
DECISION: APPROVE
This PR adds a clear and well-articulated "Delegation Completion Contract" rule to the agent orchestration documentation, emphasizing proper message handling and result integration for delegated tasks. The guidance aligns well with the repo's goal of improving agent workflows and is concise. No issues found; the additions enhance clarity.
Summary
rules/common/agents.mdtells agents to "ALWAYS use parallel Task execution for independent operations", but defines no completion contract for delegation. This PR adds a Delegation Completion Contract section right after the parallel-execution rule.The failure mode this prevents
Observed in practice with parallel research agents:
The root cause is not delegation itself (the grandchildren's output quality was fine) and not task decomposition (the same 4-way split succeeded when re-run with a completion constraint). It is the missing lifecycle contract: a subagent's final message IS its return value, so "waiting" is an abandoned return value.
What this adds
Three rules that apply at every delegation depth:
With this contract in place, the same parallel research fan-out completed with zero orphaned tasks.
Changes
rules/common/agents.md: +10 lines (new "Delegation Completion Contract" section between "Parallel Task Execution" and "Multi-Perspective Analysis")