feat: plan-gate PR chunking — >500-line plans must decompose (#9)#10
Conversation
Add CHUNKING_POLICY block to dispatch prompt requiring agents to project diff size and provide a chunk plan (ordered sub-PRs with dependencies) for any plan exceeding 500 lines. Includes stacked-PR --delete-branch safety note. README documents the policy with rationale and example chunk plan. Closes #9
…ing tests - Fix test_prompt_includes_chunking_policy to check CHUNKING_POLICY constant directly (was passing via TLDR coincidence) - Fix test_prompt_structure_includes_marker_contract to check AGENTS_MARKER_CONTRACT (was passing via AC_HEADER substring) - Fix --delete-branch wording: 'pushing' -> 'merging' (it's a gh pr merge flag) - Add test_prompt_section_ordering: AC < contract < chunking < body - Add test_pr_prompt_excludes_chunking_policy: negative test for build_pr_prompt
Context
Consensus (≥2 reviewers)
reviewer (deepseek-v4-pro)
reviewer-m3 (MiniMax-M3)
reviewer-fast (Claude Sonnet, Max sub)
DivergencesNone — unanimous agreement that the change is correct and the fixup addresses all concerns. SummaryClean, well-scoped prompt-injection change. CHUNKING_POLICY is correctly isolated to <<REVIEW-VERDICT: PASS sha=91b3b5f52f2a97286a93c2d78753b21491321b0b rounds=2 panel=deepseek-v4-pro,minimax-m3,claude-sonnet(max-sub)>> |
Merge note — dispatcher verification + process flagsVerification (independent, this dispatcher): read full diff (160 add / 0 del, 3 files), ran Process flags (recorded, not blocking):
Merging on dispatcher verification per the above. |
Summary
Enforce PR chunking at the plan gate: when a dispatched agent's plan projects a diff >500 lines, the plan must decompose the work into a sequence of ≤500-line PRs (stacked or independent) before approval.
What changed
src/tmq/prompt.py— NewCHUNKING_POLICYblock injected into every dispatch prompt:--delete-branchsafety notetests/test_prompt.py(new) — 5 tests covering chunking clause presence, threshold, stacked-PR gotcha, and existing prompt invariantsREADME.md— Chunking policy section with rationale, example chunk plan, and stacked-PR safety rulesOut of scope
Test plan
Test output
Full suite: 70 passed, 0 failed
Verification
Follow-ups
None.
Closes #9