feat(commands): add output format constraints and task budgets#1786
Conversation
- Add invocation_limits to pr-review-config.yaml: all_open_max_prs (5), completion_gate_max_retries (3) with escalation actions - Add output_constraints to pr-review-config.yaml: per-PR token cap (4096), summary format and required columns - Update pr-review.md to enforce PR cap, retry limits, output constraints, and structured summary format - Add Completion Criteria and Stop Condition sections to context-hub-setup.md Addresses #1668
There was a problem hiding this comment.
Code Review
This pull request updates the PR review and Context Hub setup workflows by introducing invocation limits, output constraints, and explicit completion criteria. Key changes include capping the number of open PRs processed at once and implementing retry logic for completion gates. A logic flaw was identified in the overflow action for open PRs, which could cause a processing loop; the feedback suggests modifying the instruction to have users specify PR numbers for subsequent runs.
There was a problem hiding this comment.
Pull request overview
Adds explicit budgets and output constraints to the PR review command configuration and documentation, preventing unbounded multi-PR work and runaway retry loops.
Changes:
- Introduces
invocation_limitsinpr-review-config.yaml(capall-openPR count, limit completion gate retries, define escalation actions). - Introduces
output_constraintsinpr-review-config.yaml(per-PR response token cap and structured summary requirements). - Updates command docs to enforce these limits and adds completion and stop criteria to context hub setup.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
.claude/commands/pr-review.md |
Documents PR cap, per-PR output budget, summary format requirements, and completion gate retry limit. |
.claude/commands/pr-review-config.yaml |
Adds config-driven invocation limits and output constraints referenced by the PR review command. |
.claude/commands/context-hub-setup.md |
Adds explicit completion criteria and a stop condition to prevent open-ended setup guidance. |
PR Validation ReportNote ✅ Status: PASS Description Validation
PR Standards
QA Validation
⚡ Warnings
Powered by PR Validation workflow |
AI Quality Gate ReviewTip ✅ Final Verdict: PASS WalkthroughThis PR was reviewed by six AI agents in parallel, analyzing different aspects of the changes:
Review Summary
💡 Quick Access: Click on individual agent jobs (e.g., "🔒 security Review", "🧪 qa Review") in the workflow run to see detailed findings and step summaries. Security Review DetailsSecurity Review: PR #1786PR Type Classification
AnalysisCONFIG file review (pr-review-config.yaml):
DOCS file review (context-hub-setup.md, pr-review.md):
Findings
RecommendationsNone required. The changes are configuration values and documentation. Verdict{
"verdict": "PASS",
"message": "CONFIG and DOCS changes only. No secrets, no injection vectors, no executable code paths affected.",
"agent": "security",
"timestamp": "2026-04-26T20:18:02.108Z",
"findings": []
}QA Review DetailsNow let me check if there are any tests related to these files: Based on the diff provided in the PR description, I have all the information needed to complete the QA review. QA Review: PR #1786PR Type ClassificationAnalysisChanged Files:
Test Coverage Assessment
Rationale: This PR adds:
Neither contains executable code paths that require unit tests. The pr-review.md and context-hub-setup.md files are command documentation consumed by Claude Code agents at runtime, not executable scripts. Code Quality Assessment
Quality Concerns
Regression Risk Assessment
Pre-executed Test Results
{
"verdict": "PASS",
"message": "Configuration and documentation changes are internally consistent with no executable code requiring tests.",
"agent": "qa",
"timestamp": "2026-04-26T20:18:45Z",
"findings": [
{
"severity": "low",
"category": "code-quality",
"description": "Comment documents summary_format constraint but enforcement relies on agent compliance rather than schema validation",
"location": ".claude/commands/pr-review-config.yaml:127",
"recommendation": "Consider adding JSON schema validation for allowed_values in future iteration"
}
]
}Analyst Review DetailsNow I have the full context of the files. Let me analyze the PR changes. PR #1786 Analysis: Output Format Constraints and Task BudgetsCode Quality Score
Overall: 4.75/5 Impact Assessment
Findings
Positive Observations
Recommendations
Verdict{
"verdict": "PASS",
"message": "Clean addition of execution limits and output constraints with proper documentation coupling.",
"agent": "analyst",
"timestamp": "2026-04-26T20:18:08.094Z",
"findings": [
{
"severity": "low",
"category": "documentation",
"description": "completion_gate_overflow_action could specify output format for escalation message",
"location": "pr-review-config.yaml:123",
"recommendation": "Consider adding expected format (e.g., table, bullet list) for the escalation summary"
},
{
"severity": "low",
"category": "maintainability",
"description": "summary_format and summary_format_allowed_values duplicate 'table' value",
"location": "pr-review-config.yaml:127-129",
"recommendation": "Acceptable as-is; comment explains intentional coupling for extensibility"
}
]
}Architect Review DetailsDesign Quality Assessment
Overall Design Score: 5/5 Architectural Concerns
Breaking Change Assessment
The changes are additive. Existing behavior unchanged for users who do not specify Technical Debt Analysis
The PR reduces technical debt by formalizing implicit constraints (PR caps, retry limits, token budgets) into explicit, documented configuration. Previously unbounded loops now have explicit termination conditions. ADR Assessment
Recommendations
Verdict{
"verdict": "PASS",
"message": "Additive config changes follow established patterns with clear extensibility guards.",
"agent": "architect",
"timestamp": "2026-04-26T20:17:00Z",
"findings": []
}DevOps Review DetailsDevOps Review: PR #1786PR Scope Detection
Classification: CONFIG + DOCS PR. No workflows, actions, or scripts modified. Pipeline Impact Assessment
CI/CD Quality Checks
Findings
Template Assessment
Automation Opportunities
The changes already improve automation by adding explicit limits and overflow handling. Detailed AnalysisConfig Changes (pr-review-config.yaml:119-130):
Documentation Changes (pr-review.md):
Documentation Changes (context-hub-setup.md):
Recommendations
Verdict{
"verdict": "PASS",
"message": "CONFIG+DOCS PR with valid YAML structure, consistent cross-references, and clear completion criteria.",
"agent": "devops",
"timestamp": "2026-04-26T20:17:57.125Z",
"findings": []
}Roadmap Review DetailsNow I have sufficient context to provide the roadmap review assessment. Strategic Alignment Assessment
Feature Completeness
Impact Analysis
Concerns
Recommendations
Verdict{
"verdict": "PASS",
"message": "Change delivers bounded execution and output constraints that improve operational predictability for pr-review command.",
"agent": "roadmap",
"timestamp": "2026-04-26T20:17:00Z",
"findings": [
{
"severity": "low",
"category": "scope",
"description": "all_open_max_prs default of 5 may be conservative for high-volume repos",
"location": ".claude/commands/pr-review-config.yaml:120",
"recommendation": "Acceptable starting point. Monitor usage and adjust if needed."
},
{
"severity": "low",
"category": "investment",
"description": "No YAML schema validation for pr-review-config.yaml",
"location": ".claude/commands/pr-review-config.yaml",
"recommendation": "Consider adding JSON Schema validation in a follow-up if config complexity grows."
}
]
}Run Details
Powered by AI Quality Gate workflow |
Review Triage RequiredNote Priority: NORMAL - Human approval required before bot responds Review Summary
Next Steps
Powered by PR Maintenance workflow - Add triage:approved label |
- pr-review-config.yaml: Reword all_open_overflow_action so users explicitly re-invoke with the remaining PR numbers instead of looping all-open against the same first 5 PRs (gemini-code-assist). - pr-review-config.yaml: Document summary_format_allowed_values so the configurable surface matches the single supported value (table). Future values must update Step 6 in the same change (copilot). - context-hub-setup.md: Fix copy-paste hazard: the verification command had an escaped pipe inside inline code, which a shell would treat literally. Describe the pipeline in prose instead so the instruction is unambiguous whether rendered or copied (copilot). - context-hub-setup.md: Reconcile completion criteria language with Step 3 output. Step 3 emits a plain text status block, not a markdown table, so call it a status block in both the criteria row and the stop condition (copilot). - pr-review.md: Step 6 referenced summary_format from config but then unconditionally required a markdown table. Make the contract explicit: table is the only supported value today, and any new value must update this step and the config allowed list together (copilot). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
PR #1786 (merged to main) shipped the same `invocation_limits` and `output_constraints` config additions and the `context-hub-setup.md` completion criteria that this branch was adding. Resolution: - Take main's version of `pr-review.md`, `pr-review-config.yaml`, and `context-hub-setup.md` (all superseded by #1786). - Drop the stale per-issue session log (`.agents/sessions/2026-04-18-session-01-issue-1668-output-constraints.json`), which referenced the now-superseded shape. Keep the unique-and-still-valuable pieces from this branch and update them to match main's actual schema: - `scripts/validate_pr_review_config.py`: CWE-22 path-traversal guard on the CLI entry point; schema validation for `invocation_limits` and `output_constraints`. Schema constants now reflect main's keys (`per_pr_max_response_tokens`, `summary_format_allowed_values`). - Apply CodeRabbit review feedback (PR #1671): guard against non-mapping values (e.g. `null`), require positive integers for max counts and non-negative integers for retry counts, require non-empty strings for action and format fields, require list entries to be non-empty strings, and assert `summary_format` is a member of `summary_format_allowed_values`. - Tests: update `VALID_CONFIG` to main's schema and add cases covering every new error branch (12 new tests, 35 total, all pass). Refs #1668 Refs #1786 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Summary
Closes #1668
Supersedes #1717. That branch was contaminated with 13 unrelated commits from a foreign repo (1,016,442 false deletions). This is a clean cherry-pick of commit 13fe83a.
Test plan
🤖 Generated with Claude Code