@deftai/directive-content 0.55.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.agents/skills/deft/SKILL.md +6 -0
- package/.agents/skills/deft-directive-article-review/SKILL.md +11 -0
- package/.agents/skills/deft-directive-build/SKILL.md +10 -0
- package/.agents/skills/deft-directive-cost/SKILL.md +12 -0
- package/.agents/skills/deft-directive-debug/SKILL.md +13 -0
- package/.agents/skills/deft-directive-gh-arch/SKILL.md +11 -0
- package/.agents/skills/deft-directive-gh-slice/SKILL.md +10 -0
- package/.agents/skills/deft-directive-glossary/SKILL.md +10 -0
- package/.agents/skills/deft-directive-interview/SKILL.md +9 -0
- package/.agents/skills/deft-directive-pre-pr/SKILL.md +9 -0
- package/.agents/skills/deft-directive-refinement/SKILL.md +10 -0
- package/.agents/skills/deft-directive-release/SKILL.md +12 -0
- package/.agents/skills/deft-directive-review-cycle/SKILL.md +10 -0
- package/.agents/skills/deft-directive-setup/SKILL.md +10 -0
- package/.agents/skills/deft-directive-swarm/SKILL.md +10 -0
- package/.agents/skills/deft-directive-sync/SKILL.md +9 -0
- package/.agents/skills/deft-directive-triage/SKILL.md +9 -0
- package/.agents/skills/deft-directive-write-skill/SKILL.md +9 -0
- package/LICENSE.md +22 -0
- package/QUICK-START.md +167 -0
- package/UPGRADING.md +517 -0
- package/coding/build-output.md +28 -0
- package/coding/coding.md +235 -0
- package/coding/debugging.md +110 -0
- package/coding/holzmann.md +96 -0
- package/coding/hygiene.md +127 -0
- package/coding/security.md +158 -0
- package/coding/testing.md +162 -0
- package/coding/toolchain.md +44 -0
- package/commands.md +300 -0
- package/context/context.md +57 -0
- package/context/deterministic-split.md +67 -0
- package/context/examples.md +26 -0
- package/context/fractal-summaries.md +69 -0
- package/context/long-horizon.md +46 -0
- package/context/spec-deltas.md +177 -0
- package/context/tool-design.md +34 -0
- package/context/working-memory.md +62 -0
- package/contracts/boundary-maps.md +65 -0
- package/contracts/deterministic-questions.md +59 -0
- package/contracts/hierarchy.md +77 -0
- package/conventions/content-manifest.json +399 -0
- package/conventions/machine-generated-banner.md +130 -0
- package/conventions/references.md +120 -0
- package/conventions/rule-ownership.json +382 -0
- package/conventions/task-caching.md +43 -0
- package/conventions/vbrief-filenames.md +70 -0
- package/deployments/README.md +37 -0
- package/deployments/agentuity/README.md +138 -0
- package/deployments/agentuity/via-cli.md +380 -0
- package/deployments/agentuity/via-cloud.md +425 -0
- package/deployments/agentuity/via-github-actions.md +664 -0
- package/deployments/agentuity/via-gravity-network.md +606 -0
- package/deployments/agentuity/via-vpc.md +607 -0
- package/deployments/aws/README.md +38 -0
- package/deployments/aws/via-app-runner.md +612 -0
- package/deployments/aws/via-ecs-fargate.md +561 -0
- package/deployments/aws/via-elastic-beanstalk.md +628 -0
- package/deployments/aws/via-lambda.md +649 -0
- package/deployments/azure/README.md +37 -0
- package/deployments/azure/via-aks.md +390 -0
- package/deployments/azure/via-app-service.md +564 -0
- package/deployments/azure/via-container-apps.md +599 -0
- package/deployments/azure/via-functions.md +552 -0
- package/deployments/cloud-gov/README.md +63 -0
- package/deployments/cloud-gov/agents/compliance-docs.md +154 -0
- package/deployments/cloud-gov/agents.md +39 -0
- package/deployments/cloud-gov/cicd.md +64 -0
- package/deployments/cloud-gov/deployment.md +150 -0
- package/deployments/cloud-gov/logging.md +43 -0
- package/deployments/cloud-gov/manifest.md +121 -0
- package/deployments/cloud-gov/overview.md +58 -0
- package/deployments/cloud-gov/security.md +46 -0
- package/deployments/cloud-gov/services.md +72 -0
- package/deployments/cloud-gov/upstream/README.md +18 -0
- package/deployments/cloudflare/README.md +33 -0
- package/deployments/cloudflare/via-dashboard.md +83 -0
- package/deployments/cloudflare/via-git.md +90 -0
- package/deployments/cloudflare/via-github-actions.md +185 -0
- package/deployments/cloudflare/via-terraform.md +157 -0
- package/deployments/cloudflare/via-wrangler.md +165 -0
- package/deployments/fly-io/README.md +37 -0
- package/deployments/fly-io/via-dockerfile.md +648 -0
- package/deployments/fly-io/via-flyctl.md +653 -0
- package/deployments/fly-io/via-github-actions.md +695 -0
- package/deployments/fly-io/via-multi-region.md +598 -0
- package/deployments/google/README.md +34 -0
- package/deployments/google/via-app-engine.md +42 -0
- package/deployments/google/via-cloud-functions.md +23 -0
- package/deployments/google/via-cloud-run.md +330 -0
- package/deployments/google/via-gke.md +23 -0
- package/deployments/netlify/README.md +99 -0
- package/deployments/netlify/via-cli.md +17 -0
- package/deployments/netlify/via-functions.md +19 -0
- package/deployments/netlify/via-git.md +25 -0
- package/deployments/vercel/README.md +90 -0
- package/deployments/vercel/via-api.md +16 -0
- package/deployments/vercel/via-cli.md +17 -0
- package/deployments/vercel/via-git.md +24 -0
- package/docs/BROWNFIELD.md +179 -0
- package/docs/getting-started.md +137 -0
- package/docs/good-agents-md.md +137 -0
- package/events/README.md +89 -0
- package/events/event-record.schema.json +26 -0
- package/events/registry.json +166 -0
- package/events/registry.schema.json +71 -0
- package/glossary.md +145 -0
- package/incidents/README.md +81 -0
- package/incidents/_template.md +38 -0
- package/interfaces/cli.md +104 -0
- package/interfaces/rest.md +212 -0
- package/interfaces/tui.md +242 -0
- package/interfaces/web.md +123 -0
- package/languages/6502-DASM.md +132 -0
- package/languages/c.md +235 -0
- package/languages/commands.md +23 -0
- package/languages/cpp.md +132 -0
- package/languages/csharp.md +259 -0
- package/languages/dart.md +183 -0
- package/languages/delphi.md +218 -0
- package/languages/elixir.md +208 -0
- package/languages/go.md +78 -0
- package/languages/java.md +278 -0
- package/languages/javascript.md +163 -0
- package/languages/julia.md +175 -0
- package/languages/kotlin.md +193 -0
- package/languages/markdown.md +168 -0
- package/languages/mermaid.md +146 -0
- package/languages/officejs.md +392 -0
- package/languages/python.md +209 -0
- package/languages/r.md +163 -0
- package/languages/rust.md +216 -0
- package/languages/sql.md +216 -0
- package/languages/swift.md +153 -0
- package/languages/typescript.md +132 -0
- package/languages/vba.md +279 -0
- package/languages/vhdl.md +180 -0
- package/languages/visual-basic.md +151 -0
- package/languages/zig.md +196 -0
- package/meta/SOUL.md +27 -0
- package/meta/code-field.md +44 -0
- package/meta/morals.md +40 -0
- package/meta/philosophy.md +39 -0
- package/meta/project.md +49 -0
- package/meta/ralph.md +223 -0
- package/meta/security.md +80 -0
- package/meta/versioning.md +326 -0
- package/package.json +22 -0
- package/packs/lessons/lessons-pack-0.1.json +553 -0
- package/packs/patterns/patterns-pack-0.1.json +57 -0
- package/packs/rules/rules-pack-0.1.json +4767 -0
- package/packs/skills/skills-pack-0.1.json +262 -0
- package/packs/strategies/strategies-pack-0.1.json +167 -0
- package/packs/swarm-spec/swarm-spec-pack-0.1.json +17 -0
- package/patterns/executor-layer-credentials.md +227 -0
- package/patterns/llm-app.md +156 -0
- package/patterns/multi-agent.md +278 -0
- package/patterns/prompt-assembly-layer-ordering.md +154 -0
- package/patterns/role-as-overlay.md +179 -0
- package/platforms/2600.md +137 -0
- package/platforms/unity.md +329 -0
- package/references/composer-skill-porting.md +152 -0
- package/references/cost-models.md +163 -0
- package/references/ip-risk.md +246 -0
- package/references/plain-english-ux.md +275 -0
- package/resilience/context-pruning.md +67 -0
- package/resilience/continue-here.md +62 -0
- package/scm/changelog.md +276 -0
- package/scm/git.md +139 -0
- package/scm/github.md +265 -0
- package/secrets/.gitkeep +0 -0
- package/skills/deft-build/SKILL.md +20 -0
- package/skills/deft-directive-article-review/SKILL.md +156 -0
- package/skills/deft-directive-build/SKILL.md +302 -0
- package/skills/deft-directive-cost/SKILL.md +201 -0
- package/skills/deft-directive-debug/SKILL.md +140 -0
- package/skills/deft-directive-decompose/SKILL.md +96 -0
- package/skills/deft-directive-gh-arch/SKILL.md +160 -0
- package/skills/deft-directive-gh-slice/SKILL.md +199 -0
- package/skills/deft-directive-glossary/SKILL.md +118 -0
- package/skills/deft-directive-interview/SKILL.md +528 -0
- package/skills/deft-directive-pre-pr/SKILL.md +131 -0
- package/skills/deft-directive-probe/SKILL.md +127 -0
- package/skills/deft-directive-refinement/SKILL.md +403 -0
- package/skills/deft-directive-release/SKILL.md +266 -0
- package/skills/deft-directive-review-cycle/SKILL.md +401 -0
- package/skills/deft-directive-setup/SKILL.md +717 -0
- package/skills/deft-directive-swarm/SKILL.md +989 -0
- package/skills/deft-directive-sync/SKILL.md +288 -0
- package/skills/deft-directive-triage/SKILL.md +137 -0
- package/skills/deft-directive-write-skill/SKILL.md +169 -0
- package/skills/deft-interview/SKILL.md +16 -0
- package/skills/deft-pre-pr/SKILL.md +16 -0
- package/skills/deft-review-cycle/SKILL.md +16 -0
- package/skills/deft-roadmap-refresh/SKILL.md +16 -0
- package/skills/deft-setup/SKILL.md +20 -0
- package/skills/deft-swarm/SKILL.md +16 -0
- package/skills/deft-sync/SKILL.md +16 -0
- package/strategies/README.md +83 -0
- package/strategies/artifact-guards.md +85 -0
- package/strategies/bdd.md +115 -0
- package/strategies/brownfield.md +7 -0
- package/strategies/discuss.md +129 -0
- package/strategies/emit-hints.md +69 -0
- package/strategies/enterprise.md +193 -0
- package/strategies/interview.md +551 -0
- package/strategies/map.md +179 -0
- package/strategies/probe.md +151 -0
- package/strategies/rapid.md +155 -0
- package/strategies/research.md +155 -0
- package/strategies/roadmap.md +9 -0
- package/strategies/speckit.md +437 -0
- package/strategies/v0-20-contract.md +134 -0
- package/strategies/yolo.md +169 -0
- package/swarm/swarm.md +300 -0
- package/templates/COST-ESTIMATE.md +114 -0
- package/templates/PULL_REQUEST_TEMPLATE.md +35 -0
- package/templates/agent-prompt-preamble.md +409 -0
- package/templates/agents-entry.md +211 -0
- package/templates/agents-entry.placeholders.md +75 -0
- package/templates/embed.go +20 -0
- package/templates/embed_test.go +36 -0
- package/templates/make-spec-example.md +9 -0
- package/templates/make-spec.md +246 -0
- package/templates/project.md.template +52 -0
- package/templates/specification.md +1 -0
- package/templates/swarm-greptile-poller-prompt.md +556 -0
- package/templates/user.md.template +31 -0
- package/tools/RWLDL.md +80 -0
- package/tools/greptile.md +141 -0
- package/tools/installer.md +23 -0
- package/tools/taskfile-migration.md +32 -0
- package/tools/taskfile.md +185 -0
- package/tools/telemetry.md +285 -0
- package/vbrief/schemas/cache-meta.schema.json +137 -0
- package/vbrief/schemas/candidates.schema.json +130 -0
- package/vbrief/schemas/codebase-map.schema.json +213 -0
- package/vbrief/schemas/lessons-pack.schema.json +134 -0
- package/vbrief/schemas/patterns-pack.schema.json +84 -0
- package/vbrief/schemas/rules-pack.schema.json +105 -0
- package/vbrief/schemas/skills-pack.schema.json +94 -0
- package/vbrief/schemas/slices.schema.json +87 -0
- package/vbrief/schemas/strategies-pack.schema.json +89 -0
- package/vbrief/schemas/swarm-spec-pack.schema.json +84 -0
- package/vbrief/schemas/vbrief-core.schema.json +1022 -0
- package/vbrief/vbrief.md +684 -0
- package/verification/integration.md +76 -0
- package/verification/plan-checking.md +85 -0
- package/verification/uat.md +60 -0
- package/verification/verification.md +117 -0
|
@@ -0,0 +1,401 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: deft-directive-review-cycle
|
|
3
|
+
description: >-
|
|
4
|
+
Greptile bot reviewer response workflow. Use when running a review cycle on
|
|
5
|
+
a PR -- to audit process prerequisites, fetch bot findings, fix all issues
|
|
6
|
+
in a single batch commit, and exit cleanly when no P0 or P1 issues remain.
|
|
7
|
+
---
|
|
8
|
+
<!-- AUTO-GENERATED by task packs:render -- DO NOT EDIT MANUALLY -->
|
|
9
|
+
<!-- Purpose: rendered skill -->
|
|
10
|
+
<!-- Source of truth: packs/skills/skills-pack-0.1.json -->
|
|
11
|
+
<!-- Regenerate with: task packs:render -->
|
|
12
|
+
<!-- Edit the source, not this file. Slice instead of loading every SKILL.md: task packs:slice skills by-trigger --trigger <kw> (or list) -->
|
|
13
|
+
|
|
14
|
+
# Deft Directive Review Cycle
|
|
15
|
+
|
|
16
|
+
Structured workflow for responding to bot reviewer (Greptile) findings on a PR.
|
|
17
|
+
|
|
18
|
+
Legend (from RFC2119): !=MUST, ~=SHOULD, ≉=SHOULD NOT, ⊗=MUST NOT, ?=MAY.
|
|
19
|
+
|
|
20
|
+
## Platform Requirements
|
|
21
|
+
|
|
22
|
+
! This skill requires **GitHub** as the SCM platform and the **GitHub CLI (`gh`)** to be installed and authenticated. PR comment fetching, check-run queries, and review submission all depend on `gh`.
|
|
23
|
+
|
|
24
|
+
## When to Use
|
|
25
|
+
|
|
26
|
+
- User says "review cycle", "check reviews", or "run review cycle" on a PR
|
|
27
|
+
- A bot reviewer (Greptile) has posted findings on an open PR
|
|
28
|
+
- Dispatching a cloud agent to monitor and resolve PR review findings
|
|
29
|
+
|
|
30
|
+
## Branch-Protection Policy Guard
|
|
31
|
+
|
|
32
|
+
! Before entering the review/fix loop, run the skill-level branch-policy guard documented in `scripts/policy.py` / `scripts/preflight_branch.py` (#746 / #747). Halt before any state mutation if the project's `plan.policy.allowDirectCommitsToMaster` is unresolvable AND the operator has not set `DEFT_ALLOW_DEFAULT_BRANCH_COMMIT=1`. Concretely:
|
|
33
|
+
|
|
34
|
+
```
|
|
35
|
+
uv run python scripts/preflight_branch.py --project-root . --quiet || exit 1
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
or invoke `task verify:branch`. The skill MUST NOT modify files, push, or comment on the PR until the guard passes -- this catches the case where a malformed PROJECT-DEFINITION quietly disabled the policy and the agent would have committed directly to master mid-review.
|
|
39
|
+
|
|
40
|
+
## Deterministic Questions Contract
|
|
41
|
+
|
|
42
|
+
! Every numbered-menu prompt rendered in this skill (Phase 1 audit gates, Phase 2 Step 4 monitoring approach selection, Phase 5->6 ready-to-merge gate, Step 6 exit-condition prompts) MUST follow [`../../contracts/deterministic-questions.md`](../../contracts/deterministic-questions.md): the final two numbered options MUST be `Discuss` and `Back`, in that order. The Discuss-pause semantic is documented verbatim there -- on `Discuss` selection the agent MUST halt the in-progress sequence immediately, prompt `What would you like to discuss?`, and resume only on an explicit user signal (re-asking the original question, saying `resume`/`continue`, or re-issuing the prior selection). Implicit resumption is forbidden.
|
|
43
|
+
|
|
44
|
+
## Pre-Flight Check
|
|
45
|
+
|
|
46
|
+
! Before entering the review/fix loop, verify the Greptile configuration supports it:
|
|
47
|
+
|
|
48
|
+
1. ! `triggerOnUpdates` must be enabled (via Greptile dashboard or `.greptile/config.json`) — without this, Greptile only reviews the initial PR and never re-reviews after fix pushes, so the loop cannot reach the exit condition
|
|
49
|
+
2. ~ `statusCheck` should be enabled so Greptile posts a `"Greptile Review"` check run on each commit — this is the signal the org ruleset uses to gate merges
|
|
50
|
+
3. ? If Greptile does not re-review after a push despite `triggerOnUpdates` being enabled, comment `@greptileai` on the PR as a manual re-trigger fallback
|
|
51
|
+
|
|
52
|
+
! Greptile posts **check runs** (GitHub Checks API), not **commit statuses** (Statuses API). To verify the check run is present on a commit:
|
|
53
|
+
|
|
54
|
+
```
|
|
55
|
+
gh api repos/<owner>/<repo>/commits/<sha>/check-runs --jq '.check_runs[] | select(.name == "Greptile Review")'
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
⊗ Use `commits/<sha>/statuses` to check for Greptile — that endpoint will always be empty.
|
|
59
|
+
|
|
60
|
+
~ See `tools/greptile.md` for recommended dashboard and per-repo settings.
|
|
61
|
+
|
|
62
|
+
## Phase 1 — Deft Process Audit
|
|
63
|
+
|
|
64
|
+
! Before touching code, verify ALL prerequisites are satisfied. Fix any gaps first:
|
|
65
|
+
|
|
66
|
+
1. ! Verify `skills/deft-directive-pre-pr/SKILL.md` was run before PR creation -- the PR branch should have passed at least one full RWLDL cycle. If not, run it now before proceeding.
|
|
67
|
+
2. ! `PROJECT-DEFINITION.vbrief.json` and `vbrief/` lifecycle folders have scope vBRIEF coverage for all changes in the PR
|
|
68
|
+
3. ! `CHANGELOG.md` has entries under `[Unreleased]` for the PR's changes
|
|
69
|
+
4. ! `task check` passes fully (fmt + lint + typecheck + tests + coverage ≥75%)
|
|
70
|
+
5. ! `.github/PULL_REQUEST_TEMPLATE.md` checklist is satisfied in the PR description
|
|
71
|
+
6. ! If the PR touches 3+ files: verify a `/deft:change` `proposal.vbrief.json` exists in `history/changes/` for this branch and was explicitly confirmed by the user (affirmative response, not a broad 'proceed'), or document N/A with reason in the PR checklist
|
|
72
|
+
7. ! Verify the PR is on a feature branch -- work MUST NOT have been committed directly to the default branch (master/main)
|
|
73
|
+
|
|
74
|
+
~ **PR scope gate:** If the PR spans 3+ unrelated surfaces (e.g. a skill, a tool doc, and a strategy -- with no shared issue or scope vBRIEF linking them), warn the user that broad PRs increase review churn and Greptile noise. Recommend splitting into focused PRs unless all changes trace to the same scope vBRIEF or issue bundle.
|
|
75
|
+
|
|
76
|
+
! Phase 1 audit gaps must be resolved before merging — but hold the fixes (do NOT commit or push them independently). Proceed to Phase 2 analysis to gather bot findings, then batch all Phase 1 + Phase 2 fixes into a single commit.
|
|
77
|
+
⊗ Commit or push Phase 1 audit fixes independently before gathering Phase 2 findings.
|
|
78
|
+
|
|
79
|
+
## Phase 2 — Review/Fix Loop
|
|
80
|
+
|
|
81
|
+
### Step 1: Fetch ALL bot comments
|
|
82
|
+
|
|
83
|
+
! Retrieve findings using BOTH methods — each catches different comment categories:
|
|
84
|
+
|
|
85
|
+
```
|
|
86
|
+
gh pr view <number> --comments
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
! Use `do_not_summarize_output: true` — summarizers silently drop the "Comments Outside Diff" section from large bot comments.
|
|
90
|
+
|
|
91
|
+
~ **Oversized output fallback:** If `do_not_summarize_output: true` produces output too large to process, extract the relevant section with:
|
|
92
|
+
|
|
93
|
+
- **PowerShell (Windows):** `gh pr view <number> --comments | Select-String "Outside Diff" -Context 50`
|
|
94
|
+
- **Unix/macOS:** `gh pr view <number> --comments | grep -A 50 "Outside Diff"`
|
|
95
|
+
|
|
96
|
+
Both commands extract the "Comments Outside Diff" section with surrounding context, avoiding the need to process the full output.
|
|
97
|
+
|
|
98
|
+
~ **Windows + Grok Build (#1353):** Avoid `|`, `>`, or `2>&1` in `run_terminal_command` strings -- use Python `pathlib`/`subprocess` or plain task commands instead.
|
|
99
|
+
|
|
100
|
+
! **MCP capability probe** (mirrors deft-directive-swarm Phase 3 pattern): Before attempting MCP `get_review_comments`, probe whether MCP GitHub tools are available in the current session. Detection: attempt a lightweight MCP call (e.g. list available tools or a no-op query) -- if it succeeds, MCP is available; if it errors or the tool is not in the available set, MCP is unavailable.
|
|
101
|
+
|
|
102
|
+
- **MCP available**: ! Use MCP `get_review_comments` as the second source to catch Comments Outside Diff.
|
|
103
|
+
- **MCP unavailable** (e.g. non-MCP agents including `start_agent` / `spawn_subagent` ("grok-build") dispatch, cloud agents, `oz agent run`): ! Use `gh api repos/<owner>/<repo>/pulls/<number>/comments` as the explicit fallback for the second review source. Document in the commit message or PR comment why MCP was skipped (e.g. "MCP unavailable in this session -- used gh api fallback for review comments"). The platform descriptor from runtime detection determines MCP availability independently of the dispatch primitive.
|
|
104
|
+
|
|
105
|
+
⊗ Report "all comments resolved" without verifying both sources.
|
|
106
|
+
⊗ Skip the second review source without probing for MCP capability and documenting the fallback used.
|
|
107
|
+
|
|
108
|
+
~ **Late-arriving bot review re-check:** If the initial dual-source fetch returns no bot review on the current HEAD SHA, wait ~60s and re-fetch before evaluating the Step 6 exit condition. Bot reviewers (Greptile) typically land within 3-7 min of PR creation/push; an empty first pass is more likely "review pending" than "review clean".
|
|
109
|
+
|
|
110
|
+
⊗ Declare the exit condition met based on a single fetch that returned no bot review — re-fetch at least once after a ~60s delay first.
|
|
111
|
+
|
|
112
|
+
~ This codifies a user-rule precedent on late-arriving bot reviews into the deft-internal deterministic tier. The [`templates/swarm-greptile-poller-prompt.md`](../../templates/swarm-greptile-poller-prompt.md) loop body already handles the same case for push-driven cycles via its per-poll fetch -- the rule above closes the orthogonal cold-start path where the one-shot review-cycle entry runs on a freshly-opened PR before any fix push has triggered the Step 4 polling loop.
|
|
113
|
+
|
|
114
|
+
### Step 2: Analyze ALL findings before changing anything
|
|
115
|
+
|
|
116
|
+
! Before making any changes:
|
|
117
|
+
|
|
118
|
+
- Read every finding across all files
|
|
119
|
+
- Identify cross-file dependencies (a term, value, or field mentioned in multiple files)
|
|
120
|
+
- Categorize by severity (P0, P1, P2 — where P0 is critical/blocking, P1 is a real defect, P2 is a style or non-blocking suggestion)
|
|
121
|
+
- Plan a single coherent batch of fixes
|
|
122
|
+
|
|
123
|
+
⊗ Start fixing individual findings as you encounter them.
|
|
124
|
+
|
|
125
|
+
### Step 3: Fix all findings in ONE batch commit
|
|
126
|
+
|
|
127
|
+
! Apply ALL fixes across all files before committing:
|
|
128
|
+
|
|
129
|
+
- ! For any fix that touches a value, term, or field appearing in multiple files: grep for it across the full PR file set and update every occurrence in the same commit
|
|
130
|
+
- ! Validate structured data files locally before committing (e.g. `python3 -m json.tool` for JSON, YAML lint for YAML) — do not rely on the bot to catch syntax errors
|
|
131
|
+
- ! Before committing any Greptile fix, re-read the FULL current Greptile review and confirm all P0/P1 issues are addressed in the staged changes — this is the pre-commit gate that prevents per-finding fix commits
|
|
132
|
+
- ! Run `task check` before committing
|
|
133
|
+
- ! **Fail-loud completion claim (#1006)**: when reporting fix-batch completion (to the user, in the commit message, in a PR comment, or in a status message to a parent agent), MUST surface the OUTCOMES not the intent -- name the P0/P1 finding count addressed ("addressed 3/3 P0 findings, 2/2 P1 findings, 0 deferred" -- NOT "all findings addressed"), report the `task check` result with the test-collection counts ("task check: 412 collected, 412 passed, 0 skipped, 0 xfailed" -- NOT "task check passed"), and explicitly call out any finding intentionally deferred with the reason. Apply `coding/coding.md` `## Fail Loud: Completion Claims Require Outcome Verification (#1006)` to every claim emitted during the review cycle
|
|
134
|
+
- ⊗ Claim "all Greptile findings addressed" without verifying that the staged fix actually closes every P0/P1 currently surfaced in the review body -- a fix that addresses 3 out of 4 P1 findings and reports completion is the exact failure mode #1006 forbids
|
|
135
|
+
- ⊗ Claim "task check passes" when any test was skipped, xfailed, or run with errors suppressed -- report the full collection counts instead (#1006)
|
|
136
|
+
- ? **Pre-existing failure carve-out**: If `task check` fails due to a pre-existing issue unrelated to the PR's changes, a partial test suite run is acceptable ONLY if BOTH conditions are met: (a) the `task check` failure is pre-existing with an open GitHub issue number tracking it, AND (b) the PR description explicitly notes the failure and includes the issue reference (e.g. "task check: test_foo fails due to #NNN (pre-existing)"). Without both conditions, the full `task check` pass remains mandatory.
|
|
137
|
+
- ~ Commit message: `fix: address Greptile review findings (batch)`
|
|
138
|
+
|
|
139
|
+
⊗ Push individual fix commits per finding — always batch.
|
|
140
|
+
|
|
141
|
+
### Step 3b: Proactive test coverage scan
|
|
142
|
+
|
|
143
|
+
! After committing the fix batch but before pushing, scan the changed lines for untested code paths:
|
|
144
|
+
|
|
145
|
+
1. ! Run `git --no-pager diff HEAD~1 HEAD --name-only` to identify files touched in the fix batch
|
|
146
|
+
2. ! For each changed file that has a corresponding test file, review whether the fix introduced or modified logic that lacks test coverage
|
|
147
|
+
3. ! If untested code paths are found, write tests and amend them into the fix batch commit (or add as a second commit in the same push)
|
|
148
|
+
4. ! Run `task check` again after adding tests to verify they pass
|
|
149
|
+
|
|
150
|
+
~ This eliminates one CI round-trip per fix cycle — catching coverage gaps before CI does.
|
|
151
|
+
|
|
152
|
+
⊗ Push fix commits without scanning for untested code paths in changed files.
|
|
153
|
+
|
|
154
|
+
### Step 4: Push and wait
|
|
155
|
+
|
|
156
|
+
! Push the batch commit, then wait for the bot to review the latest commit.
|
|
157
|
+
|
|
158
|
+
! After pushing, the agent MUST autonomously poll for review updates and continue the review cycle without stopping to ask the user. Do not pause for confirmation, do not ask "should I continue?", do not wait for user input between push and review completion. The review/fix loop is designed to run to the exit condition without human intervention.
|
|
159
|
+
|
|
160
|
+
⊗ Push any additional commits — including unrelated fixes, doc updates, or lessons — while waiting for the bot to finish reviewing the current head. Every push re-triggers Greptile and resets the review clock. If you discover additional work while waiting, stage it locally but do NOT push until the current review completes.
|
|
161
|
+
|
|
162
|
+
### Stall Detection Rubric (#564)
|
|
163
|
+
|
|
164
|
+
! Track per poll: `startedAt` (timestamp of the first observation of the IN_PROGRESS check run for the current commit) and `commit.oid` (head SHA being reviewed). Both fields MUST be re-recorded every time the head SHA changes -- the rubric measures elapsed time on a single commit, not across the whole review cycle.
|
|
165
|
+
|
|
166
|
+
! Expected duration baseline -- Greptile reviews typically complete in 2-5 minutes, with 7 minutes as the upper bound of normal. The escalation threshold is **3x expected = ~10 minutes** of continuous IN_PROGRESS on the same `commit.oid`. The 21-minute stall observed during the rc4 swarm cascade on PR #561 is the recurrence record; see [`../../meta/lessons.md`](../../../meta/lessons.md) `## Greptile Review Stall Detection (2026-04)`.
|
|
167
|
+
|
|
168
|
+
! When elapsed time on the current `commit.oid` exceeds 10 minutes (3x expected) without the IN_PROGRESS check transitioning to a terminal state, the agent MUST escalate to the user. The escalation message MUST include: (1) the PR number; (2) the head SHA being reviewed; (3) the elapsed time since `startedAt`; (4) the four canonical user-decision options.
|
|
169
|
+
|
|
170
|
+
! User-decision options at escalation -- render as a deterministic numbered menu per [`../../contracts/deterministic-questions.md`](../../contracts/deterministic-questions.md) (final two options `Discuss` + `Back`):
|
|
171
|
+
|
|
172
|
+
1. Wait another N minutes (user picks N).
|
|
173
|
+
2. Manually re-trigger Greptile by commenting `@greptileai` on the PR (logs the override in a PR comment for auditability per the next rule).
|
|
174
|
+
3. Skip the bot review for this cycle and exit the loop with a documented reason.
|
|
175
|
+
4. Cancel the review cycle entirely.
|
|
176
|
+
5. Discuss.
|
|
177
|
+
6. Back.
|
|
178
|
+
|
|
179
|
+
! Auto-restart detection -- when the polling loop observes a NEW `startedAt` (Greptile dropped its prior check run and started a fresh one without any push from the agent, e.g. service-side restart), the agent MUST reset its elapsed-time clock to the new `startedAt` AND notify the user that an auto-restart was detected. Resetting the clock without notifying is forbidden -- the user needs to know the cycle effectively re-started.
|
|
180
|
+
|
|
181
|
+
! **`INCOMPLETE_BUT_RATED` stall signature (#1259):** when a poll observes a parsed `Confidence Score: X/5` number BUT no terminal check-run (no `completed` status with a `{success, neutral}` conclusion) AND/OR no HEAD-matching `Last reviewed commit:` completion marker, classify the state as **`INCOMPLETE_BUT_RATED`** — Greptile has emitted a confidence rating against a review that has NOT terminally landed on the current HEAD. This is NOT an exit condition (the Step 6 fail-closed all-of resolves the missing fields to `unknown`); treat it as a stall signature and keep polling, escalating per the 10-minute threshold above if it persists. A confidence number is the single most common false-positive for a premature exit — `INCOMPLETE_BUT_RATED` names the trap so the agent does not mistake a rating for a verdict.
|
|
182
|
+
|
|
183
|
+
⊗ Auto-retrigger Greptile (empty commits, force-pushes, agent-posted `@greptileai` comments, status-check rebuilds) without explicit user approval. The escalation menu's option 2 is the ONLY supported re-trigger path, and even that requires the user to pick it.
|
|
184
|
+
|
|
185
|
+
! Document any user-approved override in a brief PR comment for auditability -- e.g. `Note: review-cycle stall detected at <SHA> after <N> min; user approved manual re-trigger via @greptileai per skills/deft-directive-review-cycle Stall Detection Rubric (#564).` This makes the override visible to humans reviewing the PR history and to future agents that resume the cycle.
|
|
186
|
+
|
|
187
|
+
⊗ Treat a stall as silent -- if the elapsed clock crosses the 10-minute threshold the agent MUST surface the menu, even if the agent is mid-poll. Continuing to poll past the threshold without user input is forbidden.
|
|
188
|
+
|
|
189
|
+
### Review Monitoring
|
|
190
|
+
! **Background / independent dispatch (#1880 Gap D):** Long-running review-cycle owners and pollers (>~3 min) MUST be dispatched independently / in the background so the parent conversation stays interactive. On Cursor, use the Task tool background path (`run_in_background: true`). This generalizes the Approach-1 sub-agent monitor rule to implementation and fix workers as well — foreground dispatch is reserved for short tasks. The parent receives completion via `DONE` / `BLOCKED` / `FAILED` per `templates/agent-prompt-preamble.md` §11.
|
|
191
|
+
|
|
192
|
+
! **Worker-owns-lifecycle (#1880 Gap C):** When this skill runs as part of an implementation worker scoped `drive-to: merge-ready`, the worker owns the full review/fix loop through merge-ready in its own tool loop — do NOT exit at PR-open expecting the orchestrator to spawn a separate review leaf.
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
! Select the monitoring approach based on runtime capability detection (the matrix in `skills/deft-directive-swarm/SKILL.md` Phase 3 Step 1, extended per #1342 slices 1-2 for `spawn_subagent` / "grok-build" as a first-class tier). Probe the environment (tool set + env vars) to obtain the stable platform descriptor (`grok-build`, `warp-orchestrated`, `warp-interactive`, etc.) from the launch adapter / `get_platform_capabilities` and map the descriptor to the appropriate tier + dispatch primitive (start_agent or spawn_subagent). The descriptor (not hard-coded tool presence) is the single source of truth for both launch and review monitoring.
|
|
197
|
+
|
|
198
|
+
- **Tier 1 (orchestrated sub-agent)** → Approach 1 (spawn review-monitor sub-agent via the primitive matching the descriptor: `start_agent` or `spawn_subagent`)
|
|
199
|
+
- **Tier 2 (no sub-agent primitive, but scheduler/timer/auto-reinvocation)** → Approach 2 (yield-between-polls)
|
|
200
|
+
- **Tier 3 (interactive session, nothing else)** → Approach 3 (blocking sleep loop as last resort)
|
|
201
|
+
|
|
202
|
+
! Detection: use the full runtime capability matrix (swarm Phase 3 + launch adapter from #1342 slice 2). The old single-probe for `start_agent` is superseded; the returned platform descriptor determines both the orchestration path and the MCP surface (see MCP probe below). If the descriptor is `grok-build` (spawn_subagent present, start_agent + WARP_* absent), treat as Tier 1 with the spawn_subagent poller path.
|
|
203
|
+
|
|
204
|
+
! Swarm agents (whether launched via `start_agent` or `spawn_subagent` per the platform descriptor) SHOULD prefer Approach 1 for their own review-monitor sub-agent. Approach 2's yield-between-polls is not self-sustaining for swarm agents (see warning below). Always include the canonical `templates/agent-prompt-preamble.md` (AGENTS.md read mandate, #810 vBRIEF gate, #798 PowerShell UTF-8, pre-PR + review-cycle mandates) when spawning a poller sub-agent.
|
|
205
|
+
|
|
206
|
+
**Approach 1 (preferred -- sub-agent orchestration available per platform descriptor):**
|
|
207
|
+
|
|
208
|
+
! **Background dispatch (#1880):** Spawn the review-monitor sub-agent via the matching primitive IN THE BACKGROUND (Cursor: Task `run_in_background: true`; Grok Build: `spawn_subagent` with parent yielding). The parent MUST remain interactive while the poller runs.
|
|
209
|
+
|
|
210
|
+
! When the platform descriptor indicates Tier 1 (sub-agent support), spawn a review-monitor sub-agent using the primitive matching the descriptor:
|
|
211
|
+
|
|
212
|
+
1. ! Launch via the matching primitive: `start_agent` (Warp) **or** `spawn_subagent` (grok-build / TUI / non-Warp) with a prompt that instructs it to poll for Greptile completion. For `spawn_subagent` the prompt MUST reference the canonical poller template `templates/swarm-greptile-poller-prompt.md` (with placeholders filled) plus the agent preamble; the working directory / context must be the PR branch (worktree or equivalent for hybrid).
|
|
213
|
+
2. ! The sub-agent polls using the mechanism for its primitive: for `spawn_subagent` use `get_command_or_subagent_output` (adaptive cadence: ~20-30s first check after push, ~60s second, ~90s thereafter; Greptile typically lands in 3-7 min); for `start_agent` the native messaging path. Front-load the first check to catch fast reviews.
|
|
214
|
+
3. ! When the exit condition is met (Greptile review current on the HEAD commit SHA, confidence > 3, no P0/P1 remaining), the sub-agent reports completion back to the parent (via `send_message_to_agent` or the spawn_subagent result channel).
|
|
215
|
+
4. ! The main conversation pane stays fully interactive during monitoring -- the user (or parent monitor) can continue other work.
|
|
216
|
+
5. ! On receiving the completion message / result, the parent re-fetches findings (both gh pr view --comments and the secondary source) and proceeds to Step 5.
|
|
217
|
+
|
|
218
|
+
**Approach 2 (fallback -- no sub-agent primitive for the descriptor):**
|
|
219
|
+
|
|
220
|
+
! When the platform descriptor indicates no sub-agent orchestration (or the primitive is unavailable), use discrete tool calls with a yield between checks. For `grok-build` / spawn_subagent descriptor this path is normally avoided in favor of Approach 1; it exists for pure interactive or limited runtimes.
|
|
221
|
+
|
|
222
|
+
1. ! Use the current shell execution tool (`run_terminal_command` or equivalent in the runtime) in wait mode to run `gh pr view <number> --comments` and `gh pr checks <number>`.
|
|
223
|
+
2. ! After each check, yield control (end all tool calls) -- the agent runtime will re-invoke after its interval or on next interaction.
|
|
224
|
+
3. ! Target adaptive cadence (20-30s / 60s / 90s) where the runtime permits. The full cadence is easiest in Approach 1 (sub-agent) or 3 (blocking); pure yield is runtime-controlled.
|
|
225
|
+
4. ! No blocking shell pane lock -- the conversation remains interactive between checks.
|
|
226
|
+
5. ~ Approach 2 requires a periodic re-invocation trigger (timer, scheduler, user nudge, or external orchestrator for hybrid/worktree cases). Without it the poller stops after the first yield.
|
|
227
|
+
6. ! When the exit condition is met, proceed to Step 5.
|
|
228
|
+
|
|
229
|
+
⚠️ **Swarm / hybrid limitation**: Approach 2 is NOT autonomous for swarm agents or manual worktree setups. Yielding ends the turn with no self-wake; the parent monitor (or external scheduler) must detect idle and re-trigger or send a message. For true `grok-build` / spawn_subagent hybrids, prefer Approach 1 (spawn_subagent + get_command_or_subagent_output poller) exactly as the swarm launch adapter does.
|
|
230
|
+
|
|
231
|
+
⊗ Use blocking `Start-Sleep` shell loops or `time.sleep()` loops EXCEPT as Approach 3 (see below) -- these lock the conversation and prevent user interaction.
|
|
232
|
+
⊗ Poll more frequently than every 20 seconds -- use a real delay between checks, not back-to-back calls. Adaptive cadence (20-30s / 60s / 90s) replaces the fixed 60s minimum.
|
|
233
|
+
|
|
234
|
+
**Approach 3 (last resort -- interactive session, no `start_agent`, no timer/scheduler):**
|
|
235
|
+
|
|
236
|
+
! Approach 3 is a blocking sleep-poll loop used ONLY when both Approach 1 and Approach 2 are unavailable (interactive session with no `start_agent` and no auto-reinvocation mechanism). Uses PowerShell `sleep` / Unix `sleep` commands between polls.
|
|
237
|
+
|
|
238
|
+
! **User warning gate:** Before activating Approach 3, the agent MUST warn the user that the conversation pane will be locked during polling and ask for explicit confirmation. Example: "No sub-agent or auto-reinvocation available. I will poll in a blocking loop (~20-30s / 60s / 90s cadence). The conversation will be locked during polling. Proceed? (yes/no)"
|
|
239
|
+
|
|
240
|
+
⊗ Activate Approach 3 without first warning the user that it will lock the conversation pane.
|
|
241
|
+
|
|
242
|
+
1. ! After receiving user confirmation, use a blocking shell loop with adaptive cadence:
|
|
243
|
+
- First check: wait ~25 seconds (e.g. `sleep 25`), then poll
|
|
244
|
+
- Second check: wait ~60 seconds, then poll
|
|
245
|
+
- Subsequent checks: wait ~90 seconds, then poll
|
|
246
|
+
2. ! Poll using `gh pr view <number> --comments` and `gh pr checks <number>` in the same shell session
|
|
247
|
+
3. ! When the exit condition is met (Greptile review current, confidence > 3, no P0/P1), exit the loop and proceed to Step 5
|
|
248
|
+
4. ! If the user interrupts (Ctrl+C or equivalent), exit gracefully and report current review status
|
|
249
|
+
|
|
250
|
+
! Greptile may advance its review by **editing an existing PR issue comment** rather than creating a new PR review object. Do NOT rely solely on `pulls/{number}/reviews` — that endpoint may remain stale at an older commit SHA even after Greptile has reviewed the latest commit.
|
|
251
|
+
|
|
252
|
+
! To confirm the review is current, check **both** surfaces:
|
|
253
|
+
|
|
254
|
+
1. **PR issue comments** (primary signal) — Greptile edits its existing summary comment in place:
|
|
255
|
+
- `gh pr view <number> --comments` (with `do_not_summarize_output: true`)
|
|
256
|
+
- Or `gh api repos/<owner>/<repo>/issues/<number>/comments`
|
|
257
|
+
- Parse the comment body for `Last reviewed commit` and compare to the pushed commit SHA
|
|
258
|
+
- Check the comment's `updated_at` timestamp to confirm it was refreshed after your push
|
|
259
|
+
2. **PR review objects** (secondary signal) — may or may not be updated:
|
|
260
|
+
- `gh api repos/<owner>/<repo>/pulls/<number>/reviews`
|
|
261
|
+
- Check `commit_id` on the latest review object
|
|
262
|
+
|
|
263
|
+
! Treat an edited Greptile issue comment as a valid new review pass even if no new PR review object was created.
|
|
264
|
+
|
|
265
|
+
! Fetch the full untruncated comment body or use MCP `get_comments` to get the actual commit URL containing the full SHA — do NOT rely on grepping truncated link text.
|
|
266
|
+
|
|
267
|
+
⊗ Re-fetch or re-trigger while the bot's last review still targets an older commit on **both** surfaces.
|
|
268
|
+
|
|
269
|
+
### Step 5: Re-fetch and analyze
|
|
270
|
+
|
|
271
|
+
! Fetch the new review using both methods from Step 1.
|
|
272
|
+
|
|
273
|
+
! Analyze all new findings before planning any changes.
|
|
274
|
+
|
|
275
|
+
### Step 6: Exit condition check — fail-closed ReviewerStatus all-of (#1259)
|
|
276
|
+
|
|
277
|
+
! The loop MAY exit clean ONLY when a SINGLE fresh fetch (not cached state, not a verdict assembled across earlier polls) satisfies ALL of the `ReviewerStatus` fields below. This is a **fail-closed all-of**: any field that is missing, unparsed, or ambiguous resolves to **`unknown`**, and `unknown` is NOT a pass — the agent stays in the loop and returns to Step 2. A PARTIAL or STALE Greptile review MUST NOT satisfy the exit predicate; the predicate is what prevents merging un-reviewed code while a P0/P1 finding is still in flight (#1259).
|
|
278
|
+
|
|
279
|
+
1. ! **Terminal check-run** — the `Greptile Review` check run on the current HEAD has `status == "completed"` AND `conclusion` in `{success, neutral}`. The conclusions `null`, `cancelled`, `timed_out`, `stale`, `action_required`, and `failure` are explicitly NOT terminal-clean: any of them resolves to `unknown` and the loop continues. A check run still `queued` / `in_progress` is `unknown`.
|
|
280
|
+
2. ! **HEAD-SHA pinned AT READ TIME** — read the current HEAD SHA in the SAME fetch used to evaluate this predicate (`gh api repos/<owner>/<repo>/pulls/<number> -q .head.sha`, read AT exit-evaluation time, NOT carried over from an earlier poll) and require `head_sha_reviewed == current HEAD`. A review whose reviewed SHA lags HEAD is `unknown`.
|
|
281
|
+
3. ! **Completion marker present and matching** — the rolling-summary comment body carries `Last reviewed commit: <sha>` AND that `<sha>` matches the current HEAD. Extract the SHA with the markdown-link-aware NON-GREEDY regex below. Markdown link text can contain escaped brackets (e.g. a commit subject `add \[Unreleased\] entry`), so a greedy `[^\]]*` stops at the first `]` and yields no match → false `unknown` on a clean review (#1326):
|
|
282
|
+
|
|
283
|
+
```
|
|
284
|
+
Last reviewed commit:\s*\[.*?\]\(https?://github\.com/[^/]+/[^/]+/commit/(?P<sha>[0-9a-f]{7,40})
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
A missing or non-matching completion marker is `unknown`. See [`../../templates/swarm-greptile-poller-prompt.md`](../../templates/swarm-greptile-poller-prompt.md) `### Last reviewed commit:` for the canonical regex shared with the push-driven poller loop.
|
|
288
|
+
4. ! **Confidence > 3** — the parsed `Confidence Score: X/5` is strictly greater than 3 (i.e. 4/5 or 5/5). A `confidence == 3`, an unparsed confidence, or an absent confidence is `unknown`.
|
|
289
|
+
5. ! **No P0/P1 findings** — the triple-tier (+ Tier 2.5) detector reports zero P0 and zero P1 findings (P2 issues are non-blocking style suggestions and do not gate the loop).
|
|
290
|
+
|
|
291
|
+
! All five fields MUST hold on the SAME single fresh fetch. The agent MUST NOT assemble a "pass" by combining a terminal check-run observed on one poll with a confidence parsed on an earlier poll — the read is atomic per the SHA-pinned-AT-READ-TIME rule above.
|
|
292
|
+
|
|
293
|
+
? If the bot says "all prior issues resolved" but lists new issues, treat it as one final batch — not the start of another loop. Go back to Step 2 one more time, re-evaluate this all-of, then stop.
|
|
294
|
+
|
|
295
|
+
⊗ Exit the loop on a confidence number alone while the check run is non-terminal (`queued` / `in_progress` / `cancelled` / `timed_out` / `stale` / `action_required`) — a confidence score is NOT a verdict without a terminal check-run AND a HEAD-matching completion marker (#1259).
|
|
296
|
+
⊗ Exit the loop against a reviewed SHA that lags the current HEAD — a partial or stale review MUST resolve to `unknown`, never to a pass (#1259).
|
|
297
|
+
|
|
298
|
+
If the exit predicate is not met (any field `unknown`), go back to Step 2.
|
|
299
|
+
|
|
300
|
+
## Pre-Merge Re-Poll Gate (#1259)
|
|
301
|
+
|
|
302
|
+
! Immediately before any `gh pr merge` invocation, the agent MUST re-fetch reviewer state ONE more time — a fresh `gh pr view <number> --comments`, a fresh `gh api repos/<owner>/<repo>/commits/<HEAD>/check-runs`, and a fresh HEAD-SHA read — and re-evaluate the Step 6 fail-closed all-of against that fresh fetch. The exit-condition pass recorded at the end of the review loop is NOT sufficient authorization to merge: review state can go stale between the loop's last poll and the merge call (a new push, a Greptile re-trigger, a service-side check-run reset).
|
|
303
|
+
|
|
304
|
+
! Treat the re-poll and the `gh pr merge` as an atomic freshness window. If the re-poll shows ANY field `unknown`, ABORT the merge and return to Step 2.
|
|
305
|
+
|
|
306
|
+
⊗ Call `gh pr merge` on the strength of a review verdict observed earlier in the loop without an immediately-preceding re-poll that re-satisfies the Step 6 all-of — merging on cached review state is forbidden (#1259).
|
|
307
|
+
|
|
308
|
+
### Informal-clean missing canonical fields (#1543)
|
|
309
|
+
|
|
310
|
+
Greptile can post a **separate** informal clean reply that says prior issues are resolved and the current diff is clean while omitting the canonical rolling-summary fields Directive merge gates require: `Last reviewed commit:` and `Confidence Score: X/5`. `task pr:merge-ready` and `task swarm:verify-review-clean` correctly refuse merge-ready in this state -- prose alone cannot prove review currency or confidence.
|
|
311
|
+
|
|
312
|
+
! When the latest Greptile bot comment is found, reports P0=0 and P1=0, but BOTH canonical fields are unparsed, classify the state as **`informal-clean missing-canonical-fields`** (see `scripts/pr_merge_readiness.py`) instead of treating it as "review still writing" or silently polling.
|
|
313
|
+
|
|
314
|
+
! Recovery for informal-clean missing canonical fields -- route to ONE of these operator actions; do NOT keep polling:
|
|
315
|
+
|
|
316
|
+
1. Comment `@greptileai review` on the PR to retrigger a canonical rolling summary on the current HEAD.
|
|
317
|
+
2. Wait for Greptile to edit its primary rolling-summary comment with both canonical fields, then re-run `task pr:merge-ready -- <N>`.
|
|
318
|
+
3. Document an explicit operator override per `skills/deft-directive-swarm/SKILL.md` Phase 6 Step 1 (merge with rationale in the merge commit body).
|
|
319
|
+
|
|
320
|
+
⊗ Treat informal clean Greptile prose (`current diff is clean`, `looks solid`, `no new issues`) as merge-ready without canonical `Last reviewed commit:` and `Confidence Score: X/5` evidence.
|
|
321
|
+
|
|
322
|
+
⊗ Keep polling silently when `task pr:merge-ready` reports the informal-clean missing-canonical-fields diagnostic -- this is a blocked recovery state, not a late-arriving review.
|
|
323
|
+
|
|
324
|
+
~ Swarm pollers MUST surface this state via the `### (6) INFORMAL-CLEAN` terminal exit in `templates/swarm-greptile-poller-prompt.md` instead of falling through to generic `(4) TIMEOUT` or `(5) STALL`.
|
|
325
|
+
|
|
326
|
+
## Submitting GitHub Reviews
|
|
327
|
+
|
|
328
|
+
! When submitting PR reviews via the GitHub MCP tool, always use `pull_request_review_write` with method `create` and the appropriate event:
|
|
329
|
+
|
|
330
|
+
- `APPROVE` — formally approve the PR (shows green "Approved" status)
|
|
331
|
+
- `REQUEST_CHANGES` — block the PR with requested changes
|
|
332
|
+
- `COMMENT` — review feedback without approving or blocking
|
|
333
|
+
|
|
334
|
+
⊗ Use `add_issue_comment` for review notes — that creates a regular comment, not a formal review. Review notes must always go in the review body via `pull_request_review_write`.
|
|
335
|
+
|
|
336
|
+
## GitHub Interface Selection
|
|
337
|
+
|
|
338
|
+
~ Use the most efficient interface for the task:
|
|
339
|
+
|
|
340
|
+
- **MCP GitHub tool** — structured/programmatic operations (querying issues, creating PRs, bulk operations, filtering data)
|
|
341
|
+
- **GitHub CLI (`gh`)** — quick ad-hoc commands and direct shell integration
|
|
342
|
+
|
|
343
|
+
Choose whichever minimizes steps and maximizes clarity for the given task.
|
|
344
|
+
|
|
345
|
+
~ When MCP is unavailable (agents without MCP tools in their dispatch environment, including `start_agent` / `spawn_subagent` ("grok-build") cases, cloud agents, `oz agent run`), `gh` CLI is sufficient as the sole interface. The dual-source requirement (MCP + `gh`) in Step 1 applies only when both are available -- agents without MCP access should use `gh pr view --comments` and `gh api` as their primary and only review detection surface. Runtime capability detection (swarm Phase 3 matrix) informs both orchestration tier and MCP surface choice.
|
|
346
|
+
|
|
347
|
+
## Framework Events Emitted Here
|
|
348
|
+
|
|
349
|
+
! When the user replies `yes` / `confirmed` / `approve` on a ready-to-merge PR thread (Phase 5 -> 6 gate per the canonical #642 workflow comment), emit a `plan:approved` framework event via `scripts/_events.py` so the approval is captured as a structural artifact rather than prose-only:
|
|
350
|
+
|
|
351
|
+
```
|
|
352
|
+
python -m scripts._events emit plan:approved \
|
|
353
|
+
--plan-ref https://github.com/<owner>/<repo>/pull/<N> \
|
|
354
|
+
--approver <github-login> \
|
|
355
|
+
--approval-phrase <yes|confirmed|approve> \
|
|
356
|
+
--pr-number <N>
|
|
357
|
+
```
|
|
358
|
+
|
|
359
|
+
? Downstream consumers of `plan:approved` (auto-merge bots, status updates, audit reporting) are explicitly deferred to follow-up work; this event currently emits a record only (#635 events behavioral wiring).
|
|
360
|
+
|
|
361
|
+
## Post-Merge Verification
|
|
362
|
+
|
|
363
|
+
! After a PR is squash-merged, verify that all referenced issues were actually closed. Squash merges can silently fail to process closing keywords (`Closes #N`, `Fixes #N`) from the PR body (#167).
|
|
364
|
+
|
|
365
|
+
1. ! For each issue referenced with a closing keyword in the PR body, run:
|
|
366
|
+
```
|
|
367
|
+
gh issue view <N> --json state --jq .state
|
|
368
|
+
```
|
|
369
|
+
2. ! If the issue state is not `CLOSED`, close it manually with a comment referencing the merged PR:
|
|
370
|
+
```
|
|
371
|
+
gh issue close <N> --comment "Closed by #<PR> (squash merge — auto-close did not trigger)"
|
|
372
|
+
```
|
|
373
|
+
3. ~ This step mirrors `skills/deft-directive-swarm/SKILL.md` Phase 6 Step 2 and applies to ALL PR merges, not just swarm runs.
|
|
374
|
+
4. ! For PRs that referenced any umbrella / staying-OPEN issue (`Refs #N`), the INVERSE check applies: any protected issue that auto-closed MUST be reopened with a comment citing #701 and the merged PR. See `skills/deft-directive-swarm/SKILL.md` Phase 6 Step 1 protected-issue reopen sweep and `meta/lessons.md` `## GitHub Closing-Keyword False-Positive Layer 3` for the persistent `closingIssuesReferences` link case (Layer 3, #701).
|
|
375
|
+
|
|
376
|
+
## Anti-Patterns
|
|
377
|
+
|
|
378
|
+
- ⊗ Push individual fix commits per finding
|
|
379
|
+
- ⊗ Start fixing before analyzing ALL findings
|
|
380
|
+
- ⊗ Rely on the bot to catch syntax errors in structured data files
|
|
381
|
+
- ⊗ Re-trigger a bot review before the previous one has updated
|
|
382
|
+
- ⊗ Report "all comments resolved" without checking both `gh pr view --comments` and a second source (`get_review_comments` via MCP, or `gh api` fallback when MCP is unavailable)
|
|
383
|
+
- ⊗ Use `add_issue_comment` for formal review submission
|
|
384
|
+
- ⊗ Commit or push Phase 1 audit fixes independently — always batch with Phase 2 fixes
|
|
385
|
+
- ⊗ Proceed to Phase 2 while any Phase 1 prerequisite is unmet
|
|
386
|
+
- ⊗ Rely solely on `pulls/{number}/reviews` to detect whether Greptile has reviewed the latest commit — Greptile may update via an edited issue comment instead of a new review object
|
|
387
|
+
- ⊗ Push additional commits while Greptile is reviewing the current head — each push re-triggers Greptile and resets the review clock
|
|
388
|
+
- ⊗ Use blocking `Start-Sleep` shell loops or `time.sleep()` loops to poll for review updates when Approach 1 or 2 is available -- Approach 3 (blocking loop) is permitted only as a last resort with user warning
|
|
389
|
+
- ⊗ Poll more frequently than every 20 seconds -- use a real delay between checks, not back-to-back calls; adaptive cadence (20-30s / 60s / 90s) replaces the fixed 60s minimum
|
|
390
|
+
- ⊗ Stop and ask the user whether to continue after pushing -- the review/fix loop MUST run autonomously to the exit condition
|
|
391
|
+
- ⊗ Push fix commits without scanning changed lines for untested code paths — always check test coverage before pushing
|
|
392
|
+
- ⊗ Push a fix commit that addresses fewer findings than the current Greptile review surfaces — if Greptile flags 3 issues, all 3 must be fixed in one commit before pushing
|
|
393
|
+
- ⊗ Push after fixing a P1 without first checking whether the same Greptile review contains additional P0 or P1 findings
|
|
394
|
+
- ⊗ Assume squash merge auto-closed referenced issues — always verify with `gh issue view` after merge (#167)
|
|
395
|
+
- ⊗ Assume Approach 2 (yield-between-polls) produces a self-sustaining polling loop -- yielding ends the agent's turn with no self-wake; swarm agents will silently stop polling
|
|
396
|
+
- ⊗ Skip the second review source (MCP or `gh api` fallback) without probing for MCP capability and documenting the fallback used
|
|
397
|
+
- ⊗ Run a partial test suite instead of `task check` without documenting the pre-existing failure reason and open issue number in the PR body
|
|
398
|
+
- ⊗ Create a PR without running `skills/deft-directive-pre-pr/SKILL.md` first -- the pre-PR quality loop catches issues before they reach the reviewer
|
|
399
|
+
- ⊗ Activate Approach 3 (blocking `Start-Sleep` loop) without first warning the user that it will lock the conversation pane and receiving confirmation
|
|
400
|
+
- ⊗ Exit the review loop on a Greptile confidence number alone while the check run is non-terminal -- a confidence score is NOT a verdict without a terminal check-run (`completed` + `{success, neutral}`) AND a HEAD-matching `Last reviewed commit:` completion marker (#1259)
|
|
401
|
+
- ⊗ Call `gh pr merge` on cached/earlier review state without an immediately-preceding pre-merge re-poll that re-satisfies the Step 6 fail-closed all-of (#1259)
|