fix(ship): Greptile triage runs only when a PR exists; every other case says why

PR: unknown (gh missing, not logged in, a non-GitHub remote, or a failed
lookup) used to dispatch the triage child anyway. The Step 10 check now
tests gh, its login, the remote and the PR in that order, and every case
but 'PR: exists' skips the dispatch and records
'Greptile: not run (<reason>); runs on the PR once it exists'.

Co-authored-by: dgrant <dgrant@users.noreply.github.com>
This commit is contained in:
garrytananddgrant committed 2026-10-06 20:34:58 +00:00
1 parent 8759ee58aa
commit 7b997838c4
2 files changed
+20 -6

No files matched your search

+10 -3
View File
@@ -2,13 +2,20 @@
<!-- Regenerate: bun run gen:skill-docs -->
## Step 10: Address Greptile review comments (if PR exists)
Check for a PR first; with none there is nothing for Greptile to have reviewed:
Check for a PR first. Greptile reviews a PR, so with no PR, no `gh`, no `gh` login or
a non-GitHub remote there is nothing to triage yet:
```bash
_PR_ERR=$(gh pr view --json number -q .number 2>&1 >/dev/null) && echo "PR: exists" || case "$_PR_ERR" in *"no pull requests found"*) echo "PR: none" ;; *) echo "PR: unknown ($_PR_ERR)" ;; esac
if ! command -v gh >/dev/null 2>&1; then echo "PR: skip (gh not installed)"
elif ! gh auth status >/dev/null 2>&1; then echo "PR: skip (gh not logged in)"
elif ! _GH_ERR=$(gh repo view --json nameWithOwner -q .nameWithOwner 2>&1 >/dev/null); then echo "PR: skip (not a GitHub remote: $(printf '%s' "$_GH_ERR" | head -1))"
elif _PR_ERR=$(gh pr view --json number -q .number 2>&1 >/dev/null); then echo "PR: exists"
else case "$_PR_ERR" in *"no pull requests found"*) echo "PR: skip (no PR yet)" ;; *) echo "PR: skip (PR lookup failed: $(printf '%s' "$_PR_ERR" | head -1))" ;; esac
fi
```
`PR: none` → skip the dispatch, record "Greptile: runs on the PR once it exists; the next /ship or /review triages it", and continue to Step 11. Otherwise dispatch:
Only `PR: exists` dispatches. `PR: skip (<reason>)` → do not dispatch; record
"Greptile: not run (<reason>); runs on the PR once it exists" and continue to Step 11.
Dispatch a subagent through Agent with `subagent_type: "general-purpose"` and
`run_in_background: false`, using Step 7's shared foreground-dispatch rule.
+10 -3
View File
@@ -1,12 +1,19 @@
## Step 10: Address Greptile review comments (if PR exists)
Check for a PR first; with none there is nothing for Greptile to have reviewed:
Check for a PR first. Greptile reviews a PR, so with no PR, no `gh`, no `gh` login or
a non-GitHub remote there is nothing to triage yet:
```bash
_PR_ERR=$(gh pr view --json number -q .number 2>&1 >/dev/null) && echo "PR: exists" || case "$_PR_ERR" in *"no pull requests found"*) echo "PR: none" ;; *) echo "PR: unknown ($_PR_ERR)" ;; esac
if ! command -v gh >/dev/null 2>&1; then echo "PR: skip (gh not installed)"
elif ! gh auth status >/dev/null 2>&1; then echo "PR: skip (gh not logged in)"
elif ! _GH_ERR=$(gh repo view --json nameWithOwner -q .nameWithOwner 2>&1 >/dev/null); then echo "PR: skip (not a GitHub remote: $(printf '%s' "$_GH_ERR" | head -1))"
elif _PR_ERR=$(gh pr view --json number -q .number 2>&1 >/dev/null); then echo "PR: exists"
else case "$_PR_ERR" in *"no pull requests found"*) echo "PR: skip (no PR yet)" ;; *) echo "PR: skip (PR lookup failed: $(printf '%s' "$_PR_ERR" | head -1))" ;; esac
fi
```
`PR: none` → skip the dispatch, record "Greptile: runs on the PR once it exists; the next /ship or /review triages it", and continue to Step 11. Otherwise dispatch:
Only `PR: exists` dispatches. `PR: skip (<reason>)` → do not dispatch; record
"Greptile: not run (<reason>); runs on the PR once it exists" and continue to Step 11.
Dispatch a subagent through Agent with `subagent_type: "general-purpose"` and
`run_in_background: false`, using Step 7's shared foreground-dispatch rule.