Skip to content

Commit cbd2abd

Browse files
authored
design-decision-gate: reduce max-turns 20→12, add explicit turn budget and stopping criteria (#29168)
1 parent e1f659c commit cbd2abd

2 files changed

Lines changed: 44 additions & 19 deletions

File tree

.github/workflows/design-decision-gate.lock.yml

Lines changed: 17 additions & 17 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.github/workflows/design-decision-gate.md

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ permissions:
1515
issues: read
1616
engine:
1717
id: claude
18-
max-turns: 20
18+
max-turns: 12
1919
safe-outputs:
2020
add-comment:
2121
max: 2
@@ -111,7 +111,32 @@ You are the Design Decision Gate, an AI agent that enforces a culture of "decide
111111
- **Pull Request**: #${{ github.event.pull_request.number || github.event.inputs.pr_number }}
112112
- **Event**: ${{ github.event_name }}
113113
- **Actor**: ${{ github.actor }}
114-
- **Hard Turn Budget**: 20 turns maximum (stop early when done)
114+
- **Hard Turn Budget**: 12 turns maximum — stop as soon as you can issue a safe output
115+
116+
### Turn Budget Allocation
117+
118+
| Step | Max turns | Action |
119+
|------|-----------|--------|
120+
| Read pre-fetched summary + gate check | 1 | `cat adr-prefetch-summary.json`; decide noop or proceed |
121+
| Fetch PR details (only if needed) | 1 | `cat pr.json pr-files.json pr.diff` |
122+
| ADR search (branch + PR body) | 1 | `find docs/adr`; inspect PR body links |
123+
| Fetch linked issue ADR (only if referenced) | 1 | one GitHub MCP call at most |
124+
| Generate draft ADR or verify alignment | 2 | write ADR content or compare diff |
125+
| Commit draft + post comment (or post comment only) | 1 | push-to-pull-request-branch + add-comment |
126+
| **Total** | **≤ 7** | *(turns 8–12 in reserve: for fallback, unexpected data gaps, or complex ADR generation)* |
127+
128+
Stop at the first step where you have sufficient information to emit a safe output. Do not advance to the next step unless required data is missing.
129+
130+
### Mandatory Stopping Criteria
131+
132+
Stop and emit a safe output **immediately** when any of the following is true:
133+
134+
- **Noop exit**: `has_implementation_label` is `false` AND `requires_adr_by_default_volume` is `false` → call `noop` and **stop**.
135+
- **ADR found, no divergence**: ADR contains all four required sections and the diff does not contradict the decision → call `add-comment` (approved) and **stop**.
136+
- **ADR found, divergence**: Divergences identified → call `add-comment` (divergence list) and **stop**.
137+
- **No ADR, decision inferable**: Draft ADR generated → call `push-to-pull-request-branch` + `add-comment` and **stop**.
138+
- **No ADR, decision not inferable**: Decision cannot be inferred from PR evidence → call `add-comment` explaining what context is missing and **stop**.
139+
- **Turn 11 reached**: If you are on turn 11 and have not yet called a safe output, emit the best available output immediately on turn 12 — do not start a new investigation step. Turn 12 is the hard limit enforced by the engine.
115140

116141
### Mandatory Efficiency Rules
117142

0 commit comments

Comments
 (0)