Skip to content

Commit 186522d

Browse files
feat: use opus 4.6 and restructure review skill (#53)
## Summary - Switch to `claude-opus-4-6` for better prompt compliance (was defaulting to Sonnet) - Increase max-turns from 15 to 100 - Restructure the review skill to be more resilient to structural shortcuts ## What changed in the skill - **Step checklist at the top** with explicit deliverables per step — agent knows upfront what's expected - **Docs staleness promoted to Agent 4** — runs in parallel with code review agents instead of being a post-processing sub-item that gets skipped - **Required summary template** with a mandatory Documentation section — forces the agent to report on docs staleness - **File classification table** updated to include `docs/connector.mdx` → docs-reviewer ## Why The previous run on [baton-twingate#16](ConductorOne/baton-twingate#16) had the docs staleness skill on disk but didn't flag the missing docs update (PR adds provisioning for roles without updating the Capabilities table). Root causes: 1. Sonnet was taking shortcuts and skipping the multi-step orchestration 2. The docs check was buried as item 6 in a validation step — easy to skip
1 parent 3e4b018 commit 186522d

2 files changed

Lines changed: 107 additions & 36 deletions

File tree

.github/workflows/pr-review.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,6 @@ jobs:
3434
use_sticky_comment: true
3535
track_progress: true
3636
include_fix_links: true
37-
claude_args: --max-turns 15
37+
claude_args: --model claude-opus-4-6 --max-turns 100
3838
prompt: |
3939
Use the /pr-review skill to review this PR.

skills/pr-review.md

Lines changed: 106 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,28 @@ description: Review a baton connector PR in CI. Performs a structured, read-only
55

66
# Review Baton Connector PR (CI)
77

8-
Perform a structured code review of a baton connector PR. Uses at most 3 focused agents with embedded criteria to minimize token usage.
8+
Perform a structured code review of a baton connector PR.
99

1010
This skill runs in CI — do NOT write files, create commits, or run build/test commands.
1111

12-
## Step 1: Determine Context
12+
**You MUST complete ALL of the following steps in order. Do NOT skip any step. Each step has a deliverable — produce it before moving on.**
1313

14-
1. **Changed files:** Identify files changed in this PR from the diff context provided. Exclude `vendor/`, `conf.gen.go`, non-`.go` files (keep `go.mod`/`go.sum` and `docs/connector.mdx`). Stop if empty (no Go files and no docs changes).
15-
2. **PR context:** Use the PR title, description, comments, and review comments provided in the conversation context.
14+
| Step | Deliverable |
15+
|------|-------------|
16+
| 1. Determine Context | List of changed files by category |
17+
| 2. Spawn Review Agents | All agent tasks launched (including docs-reviewer) |
18+
| 3. Validate and Aggregate | Merged findings list |
19+
| 4. Post Results | Summary comment with ALL required sections |
1620

17-
## Step 2: Gather Diffs
21+
---
1822

19-
For each category of files, read the relevant diffs from the PR context provided. If you need full file content to evaluate a finding, use the Read tool.
23+
## Step 1: Determine Context
2024

21-
## Step 3: Spawn Review Agents
25+
1. **Changed files:** Identify files changed in this PR from the diff context provided. Exclude `vendor/`, `conf.gen.go`, non-`.go` files (keep `go.mod`/`go.sum` and `docs/connector.mdx`). Stop if empty (no Go files and no docs changes).
26+
2. **PR context:** Use the PR title, description, comments, and review comments provided in the conversation context.
27+
3. **Classify files** into categories per the table below.
2228

23-
Classify changed files and spawn **at most 3 agents** in parallel using the Task tool.
29+
**Deliverable:** Print the list of changed files grouped by category before proceeding.
2430

2531
### File Classification
2632

@@ -33,10 +39,27 @@ Classify changed files and spawn **at most 3 agents** in parallel using the Task
3339
| `pkg/connector/*_actions.go`, `pkg/connector/actions.go` | Provisioning | provisioning-reviewer |
3440
| `pkg/config/config.go` | Config | lightweight-reviewer |
3541
| `go.mod`, `go.sum` | Dependencies | lightweight-reviewer |
42+
| `docs/connector.mdx` | Documentation | docs-reviewer |
43+
44+
---
45+
46+
## Step 2: Spawn Review Agents
47+
48+
For each category of files, read the relevant diffs from the PR context provided. If you need full file content to evaluate a finding, use the Read tool.
49+
50+
Spawn agents in parallel using the Task tool: up to 3 code review agents (Agents 1-3) plus the docs-reviewer (Agent 4) which always runs.
51+
52+
### Agent Spawning Rules
53+
54+
- If no provisioning files changed → skip provisioning-reviewer
55+
- If no config/dep files changed → skip lightweight-reviewer
56+
- If only config/dep files changed → skip sync-reviewer, only spawn lightweight-reviewer
57+
- **Always spawn docs-reviewer** (Agent 4) — it runs on every PR
58+
- Always spawn at least one code review agent
3659

37-
### Agent 1: sync-reviewer (sonnet)
60+
### Agent 1: sync-reviewer
3861

39-
Spawn with `subagent_type: "general-purpose"`. Reviews ALL non-provisioning Go files including breaking change detection. This is the main review agent.
62+
Spawn with `subagent_type: "general-purpose"`. Reviews ALL non-provisioning Go files including breaking change detection.
4063

4164
**Prompt template:**
4265

@@ -110,7 +133,7 @@ FILES AND DIFFS:
110133
<paste diffs here, grouped by file>
111134
```
112135

113-
### Agent 2: provisioning-reviewer (sonnet)
136+
### Agent 2: provisioning-reviewer
114137

115138
Only spawn if changed files contain `*_actions.go` or `actions.go` files. This agent MUST read the full provisioning files (not just diffs) because entity source correctness requires understanding the complete Grant/Revoke flow.
116139

@@ -147,7 +170,7 @@ FILES TO READ: <list full paths>
147170
DIFFS: <paste diffs>
148171
```
149172

150-
### Agent 3: lightweight-reviewer (haiku)
173+
### Agent 3: lightweight-reviewer
151174

152175
Only spawn if changed files contain config or dependency files. Use `model: "haiku"` for efficiency.
153176

@@ -173,40 +196,88 @@ DIFFS:
173196
<paste diffs>
174197
```
175198

176-
### Agent Spawning Rules
199+
### Agent 4: docs-reviewer
200+
201+
**Always spawn this agent.** It checks whether the PR's code changes require updates to `docs/connector.mdx`. Spawn with `subagent_type: "general-purpose"`.
202+
203+
**Prompt template:**
204+
205+
```
206+
You are checking whether a baton connector PR requires documentation updates.
207+
208+
The file docs/connector.mdx documents the connector's capabilities, configuration, and credentials for end users. Your job is to determine if the code changes in this PR make the docs stale.
177209
178-
- If no provisioning files changed → skip Agent 2
179-
- If no config/dep files changed → skip Agent 3
180-
- If only config/dep files changed → skip Agent 1, only spawn Agent 3
181-
- Always spawn at least one agent
210+
Procedure:
182211
183-
## Step 4: Validate and Aggregate
212+
1. Check if docs/connector.mdx exists in the repo (use the Glob tool).
213+
2. If it does not exist, return: {"status": "no_docs"}
214+
3. If it exists, check whether it is included in the PR's changed files list below.
215+
4. If it is in the changed files, return: {"status": "docs_updated"}
216+
5. If it exists but is NOT in the changed files, check the code diffs below for:
184217
185-
1. Parse JSON arrays from each agent. Filter confidence < 80.
218+
- D1: Capabilities table — Resource types added, removed, or changed sync/provision support (new resource builders, removed ResourceSyncers entries, added Grant/Revoke methods).
219+
- D2: Connector actions — Action schemas added, removed, or modified (new BatonActionSchema definitions, changed action names, added/removed arguments).
220+
- D3: Credential requirements — Required API scopes or permissions changed (new OAuth scopes, different permission levels, new authentication methods).
221+
- D4: Configuration fields — Config fields added, removed, or renamed in pkg/config/config.go.
222+
223+
If any of D1-D4 apply, read docs/connector.mdx to confirm the specific section that would need updating.
224+
225+
Return a JSON object:
226+
{"status": "stale", "findings": [{"id": "D1", "section": "<section name in docs>", "reason": "<why it's stale>"}]}
227+
228+
Or if none apply:
229+
{"status": "up_to_date"}
230+
231+
CHANGED FILES:
232+
<list of changed file paths>
233+
234+
DIFFS:
235+
<paste diffs>
236+
```
237+
238+
**Deliverable:** All agent tasks launched. Wait for them to complete before proceeding.
239+
240+
---
241+
242+
## Step 3: Validate and Aggregate
243+
244+
1. Parse JSON arrays from code review agents (Agents 1-3). Filter confidence < 80.
186245
2. Deduplicate: same file + line range → keep highest confidence.
187246
3. **Cross-validate entity sources** (if provisioning changed): Read the Grant/Revoke code yourself to verify P1/P2 findings. This is the #1 bug.
188247
4. **Cross-validate PR feedback**: Check PR review comments against findings. Add missing unaddressed items as warnings.
189248
5. Downgrade breaking changes gated behind config flags from critical → suggestion.
190-
6. **Check for documentation staleness** (see below).
191-
192-
### Documentation Staleness Check (D1-D4)
193-
194-
Connector repos have a `docs/connector.mdx` file that documents the connector's capabilities, configuration, and credentials for end users. If `docs/connector.mdx` exists in the repo but is NOT included in the PR's changed files, check whether the code changes affect documented functionality:
249+
6. Parse the docs-reviewer (Agent 4) result. If status is "stale", convert each finding to a warning.
195250

196-
- **D1: Capabilities table** — If resource types are added, removed, or change sync/provision support (new resource builders, removed ResourceSyncers entries, added Grant/Revoke methods), the Capabilities table in the docs likely needs updating.
197-
- **D2: Connector actions** — If action schemas are added, removed, or modified in `*_actions.go` or `actions.go` (new `BatonActionSchema` definitions, changed action names, added/removed arguments), the Connector Actions table in the docs likely needs updating.
198-
- **D3: Credential requirements** — If required API scopes or permissions change (new OAuth scopes, different permission levels, new authentication methods), the credential gathering section in the docs likely needs updating.
199-
- **D4: Configuration fields** — If config fields are added, removed, or renamed in `pkg/config/config.go`, the configuration instructions in the docs likely need updating.
251+
**Deliverable:** A merged list of findings (code + docs) with duplicates removed. Print the count of findings by severity.
200252

201-
If any of D1-D4 apply, add a warning finding recommending the author update `docs/connector.mdx`. Read the current docs file to confirm the specific section that's stale rather than guessing.
253+
---
202254

203-
## Step 5: Post Results
255+
## Step 4: Post Results
204256

205257
Post findings directly as PR comments:
206258

207259
1. **Inline comments** on specific lines where issues are found, with the finding ID, severity, description, and recommendation.
208-
2. **Summary comment** with:
209-
- Severity counts (critical / warning / suggestion)
210-
- Breaking changes detected (yes/no)
211-
- List of files reviewed with categories
212-
- Any critical findings highlighted
260+
261+
2. **Summary comment** with ALL of the following sections (do not omit any):
262+
263+
```
264+
### PR Review: <PR title>
265+
266+
### Findings
267+
| Severity | Count |
268+
|----------|-------|
269+
| Critical | N |
270+
| Warning | N |
271+
| Suggestion | N |
272+
273+
### Breaking Changes
274+
<findings or "None detected.">
275+
276+
### Documentation
277+
<output from docs-reviewer agent — docs staleness assessment>
278+
279+
### Files Reviewed
280+
| File | Category |
281+
|------|----------|
282+
| ... | ... |
283+
```

0 commit comments

Comments
 (0)