From 23520a93edb2b4e0f81d8fc63fb483d4ba77147c Mon Sep 17 00:00:00 2001 From: garrytan Date: Tue, 6 Oct 2026 18:23:45 +0000 Subject: [PATCH] fix(ship): skip Greptile triage when no PR exists yet (#3020) /ship's first run on a branch dispatched a triage subagent only to learn there was no PR. Step 10 now checks for a PR inline (gh's 'no pull requests found') and records that Greptile runs on the PR once it exists; other gh errors still dispatch so the child can report unavailable. Co-authored-by: dgrant --- ship/sections/greptile.md | 8 ++++++++ ship/sections/greptile.md.tmpl | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/ship/sections/greptile.md b/ship/sections/greptile.md index 4d1a364dd..e74feb2a9 100644 --- a/ship/sections/greptile.md +++ b/ship/sections/greptile.md @@ -2,6 +2,14 @@ ## Step 10: Address Greptile review comments (if PR exists) +Check for a PR first; with none there is nothing for Greptile to have reviewed: + +```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 +``` + +`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: + Dispatch a subagent through Agent with `subagent_type: "general-purpose"` and `run_in_background: false`, using Step 7's shared foreground-dispatch rule. It fetches and classifies all Greptile comments, diff --git a/ship/sections/greptile.md.tmpl b/ship/sections/greptile.md.tmpl index 594186969..f1cbcb760 100644 --- a/ship/sections/greptile.md.tmpl +++ b/ship/sections/greptile.md.tmpl @@ -1,5 +1,13 @@ ## Step 10: Address Greptile review comments (if PR exists) +Check for a PR first; with none there is nothing for Greptile to have reviewed: + +```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 +``` + +`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: + Dispatch a subagent through Agent with `subagent_type: "general-purpose"` and `run_in_background: false`, using Step 7's shared foreground-dispatch rule. It fetches and classifies all Greptile comments,