Review army + red team findings, all verified before applying: - ship-docsync E2E now asserts run_in_background === false on the captured dispatch (red team CRITICAL: phrase pins prove text exists, this proves the model obeys it — verified passing live). - Structural scanner test: any generated file with an Agent-dispatch imperative (or bare '(foreground)' prose, the #2440 inert shape) must carry the flag or hold a reasoned exemption — the 4th-recurrence net the hand-enumerated pin list can't provide. - Parent push reconciliation models reality: the parent shares the repo, so a non-fast-forward that hit the subagent hits the parent identically — fetch + ahead/behind check first, push only when the rejection was transient; dispatch prompt promise softened to 'the parent will handle it'. - Recovered commits from a dead subagent are vetted docs-only (git show --stat, never VERSION/package.json) before any push. - Deadline pacing named: ~3 minutes between checks, wall clock not polls. - Greptile UNAVAILABLE recording narrowed to the PR body (Step 20's schema carries no triage field). - document-release contract gains the echo-failure tie-breaker: prompt claims spawned + no echo → fail fast with the dispatch contract's failure shape instead of reproducing the #2733 prose-STOP; contract anti-injection and NEVER-relax clauses pinned in tests. - 'Claude Code v2.1.198' extracted to CC_BACKGROUND_DEFAULT_SINCE and interpolated at all resolver sites (byte-identical output). - CHANGELOG: entry-boundary blank line restored; worst-case-wait row scoped to the backgrounded path. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
4.4 KiB
Step 10: Address Greptile review comments (if PR exists)
Dispatch the fetch + classification as a subagent using the Agent tool with subagent_type: "general-purpose". The subagent pulls every Greptile comment, runs the escalation detection algorithm, and classifies each comment. Parent receives a structured list and handles user interaction + file edits.
Foreground required: pass run_in_background: false on the Agent call — subagents run in the BACKGROUND by default since Claude Code v2.1.198. (Merely omitting the flag no longer produces a foreground run; it must be explicitly false.) Dispatch with the Agent tool itself — never substitute the Skill tool or inline execution to "guarantee" blocking: the explicit flag already makes the Agent call block, and running the work inline forfeits the fresh-context isolation this dispatch exists for.
Subagent prompt:
You are classifying Greptile review comments for a /ship workflow. Read
~/.claude/skills/gstack/review/greptile-triage.mdand follow the fetch, filter, classify, and escalation detection steps. Do NOT fix code, do NOT reply to comments, do NOT commit — report only.For each comment, assign:
classification(valid_actionable,already_fixed,false_positive,suppressed),escalation_tier(1 or 2), the file:line or [top-level] tag, body summary, and permalink URL.If no PR exists,
ghfails, the API errors, or there are zero comments, output:{"total":0,"comments":[]}and stop.Otherwise, output a single JSON object on the LAST LINE of your response:
{"total":N,"comments":[{"classification":"...","escalation_tier":N,"ref":"file:line","summary":"...","permalink":"url"},...]}
Parent processing:
Parse the LAST line as JSON.
If total is 0, skip this step silently. Continue to Step 12.
If the subagent fails, returns invalid JSON, or never completes (backgrounded despite the flag, or no final output after ~10 minutes — stop waiting): print Greptile triage did not complete — review the PR comments manually and continue to Step 12, recording the triage as UNAVAILABLE — not as zero comments — in the PR body wherever review results are reported (an unavailable triage must not read as a clean one; Step 20's metrics schema carries no triage field, so the PR body is the record). Do not block /ship on the triage subagent.
Otherwise, print: + {total} Greptile comments ({valid_actionable} valid, {already_fixed} already fixed, {false_positive} FP).
For each comment in comments:
VALID & ACTIONABLE: Use AskUserQuestion with:
- The comment (file:line or [top-level] + body summary + permalink URL)
RECOMMENDATION: Choose A because [one-line reason]- Options: A) Fix now, B) Acknowledge and ship anyway, C) It's a false positive
- If user chooses A: apply the fix, commit the fixed files (
git add <fixed-files> && git commit -m "fix: address Greptile review — <brief description>"), reply using the Fix reply template from greptile-triage.md (include inline diff + explanation), and save to both per-project and global greptile-history (type: fix). - If user chooses C: reply using the False Positive reply template from greptile-triage.md (include evidence + suggested re-rank), save to both per-project and global greptile-history (type: fp).
VALID BUT ALREADY FIXED: Reply using the Already Fixed reply template from greptile-triage.md — no AskUserQuestion needed:
- Include what was done and the fixing commit SHA
- Save to both per-project and global greptile-history (type: already-fixed)
FALSE POSITIVE: Use AskUserQuestion:
- Show the comment and why you think it's wrong (file:line or [top-level] + body summary + permalink URL)
- Options:
- A) Reply to Greptile explaining the false positive (recommended if clearly wrong)
- B) Fix it anyway (if trivial)
- C) Ignore silently
- If user chooses A: reply using the False Positive reply template from greptile-triage.md (include evidence + suggested re-rank), save to both per-project and global greptile-history (type: fp)
SUPPRESSED: Skip silently — these are known false positives from previous triage.
After all comments are resolved: If any fixes were applied, the tests from Step 5 are now stale. Re-run tests (Step 5) before continuing to Step 12. If no fixes were applied, continue to Step 12.