Skip to content

fix(skills): recognize Greptile's reaction as convergence, not a stall - #2195

Merged
carlos-alm merged 3 commits into
mainfrom
fix/greptile-reaction-convergence-2194
Aug 2, 2026
Merged

carlos-alm merged 3 commits into
mainfrom
fix/greptile-reaction-convergence-2194

Conversation

@carlos-alm

Copy link
Copy Markdown
Contributor

Summary

  • Both /fixer (Phase 2f) and /sweep (Step 2h) told the agent to wait for Greptile's response after posting an @greptileai re-trigger, but neither had a way to recognize that a positive reaction (+1/hooray/heart/rocket) from greptile-apps[bot] on the trigger comment itself — with no follow-up review — means Greptile examined the fix and has nothing further to flag.
  • /fixer Phase 2f's G1 instructions also told the agent to poll "until a Confidence Score appears," but Greptile typically posts that score once, in its initial summary — it doesn't necessarily reappear on later reviews, so that condition can already be trivially satisfied from round 1 while giving no signal about whether a re-trigger actually converged.
  • Observed live on PR docs: fix stale codegraph check flag names across README and guides (#1984) #2193 (issue docs: stale codegraph check flag names in README and other guides #1984): after fixing Greptile's round-2 finding and re-triggering, the agent waited over 4 hours re-arming a Monitor tool and even re-triggering a second time, because it kept waiting for a brand-new review object that was never coming — Greptile had already responded within ~2 minutes both times via a 👍 reaction on the trigger comment.
  • Added explicit reaction-checking guidance (mirroring the existing pre-trigger check already in /sweep) to both skills' post-trigger wait logic, plus a copy-pasteable gh api snippet in /fixer so future runs check reactions directly instead of inventing an ad hoc "wait for a new review" polling loop.

Verification

  • Both are markdown skill-instruction files with no associated test suite (confirmed no test references SKILL.md).
  • npm run lint — clean.

Closes #2194

fixer Phase 2f and sweep Step 2h both told the agent to keep waiting
for a new Greptile review after a re-trigger, with no way to recognize
that a positive reaction on the trigger comment itself (with no
follow-up review) means Greptile already examined the fix and has
nothing further to flag.
Comment thread .claude/skills/fixer/SKILL.md Outdated
Comment on lines +528 to +530
TRIGGER_COMMENT_ID=$(gh api "repos/$REPO/issues/$PR/comments" --paginate --jq \
'[.[] | select(.body | test("^@greptileai\\s*$"))] | last | .id')
gh api "repos/$REPO/issues/comments/$TRIGGER_COMMENT_ID/reactions" \

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Paginated lookup corrupts trigger ID

When a PR's issue comments span multiple API pages, --jq evaluates last separately for each page and captures multiple IDs or null values in TRIGGER_COMMENT_ID, producing an invalid reactions URL and preventing the fixer from recognizing Greptile's convergence reaction.

Fix in Claude Code

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed — the --paginate --jq combo applies the jq filter per-page rather than to the merged result, so last over a multi-page comment list would return one candidate per page instead of the true global last. Switched to fetching raw with --paginate and slurping with jq -s, matching the pattern this same file already uses elsewhere (e.g. the G2 unanswered-comments check a few lines below).

Comment thread .claude/skills/sweep/SKILL.md Outdated
After re-triggering:

1. Poll for new reviews on an interval — see "Before you start: how to wait." Do not end your turn to wait passively, and don't declare a round "done" from a single check taken right after triggering — Greptile can take 15–30 minutes to respond.
1. Poll for new reviews on an interval — see "Before you start: how to wait." Do not end your turn to wait passively, and don't declare a round "done" from a single check taken right after triggering — Greptile can take 15–30 minutes to respond. **But also check the trigger comment's own reactions on each poll**, using the same reaction check as Step 2g's Step 1 (positive reaction from `greptile-apps[bot]` — `+1`/`hooray`/`heart`/`rocket` — on the `@greptileai` comment you just posted). A positive reaction there with no new review following it means Greptile examined the fix and has nothing further to add — that is a terminal "done" signal for this round on its own; don't keep polling the full 15–30 minutes waiting for a review object that isn't coming.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Reaction check targets wrong comment

When another user or agent comment follows the @greptileai trigger, the referenced Step 2g lookup selects that latest non-Greptile comment instead of the trigger, causing the sweep either to miss Greptile's convergence reaction or to accept an unrelated reaction as convergence.

Fix in Claude Code

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed — replaced the reference to Step 2g's "most recent non-Greptile comment" lookup (which drifts to the wrong comment if anything else is posted after the trigger) with a self-contained lookup keyed on the trigger comment's own content (matching ^@greptileai\s*$), plus the same paginate/slurp fix as the other finding.

@greptile-apps

greptile-apps Bot commented Jul 30, 2026 •

Copy link
Copy Markdown
Contributor

Greptile Summary

Updates the Greptile convergence workflow:

  • Captures each re-trigger comment ID directly from the GitHub API post response.
  • Recognizes positive Greptile reactions on that exact comment as a terminal response when no subsequent findings exist.
  • Replaces the stale confidence-score polling condition with round-specific response guidance.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains; the current instructions capture and reuse the exact trigger comment ID rather than reconstructing it through a paginated or concurrency-sensitive lookup.

Important Files Changed

Filename Overview
.claude/skills/fixer/SKILL.md The revised post-and-capture flow resolves the prior paginated trigger lookup issue by retaining the exact ID returned when the trigger is created.
.claude/skills/sweep/SKILL.md The sweep now carries the trigger ID from creation into reaction polling, resolving the previously reported wrong-comment and cross-round drift paths.

Reviews (3): Last reviewed commit: "fix: capture trigger comment ID at post ..." | Re-trigger Greptile

--paginate with --jq applies per-page, so 'last' across a multi-page
comment list returned one candidate per page instead of the true
global last. Also replace sweep's reliance on "most recent non-Greptile
comment" (which drifts to the wrong comment if anything else is posted
after the trigger) with a lookup keyed on the trigger comment's own content.
@carlos-alm

Copy link
Copy Markdown
Contributor Author

@greptileai

Comment thread .claude/skills/sweep/SKILL.md Outdated
Comment on lines +344 to +345
| jq -s '[.[][] | select(.body | test("^@greptileai\\s*$"))] | last | .id')
positive_count=$(gh api repos/<repo>/issues/comments/$trigger_id/reactions \

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Trigger lookup drifts between rounds

When another identical @greptileai comment is posted after this sweep round's trigger but before its next poll, selecting the global last matching comment checks the other trigger's reactions. This can falsely declare convergence from an unrelated reaction or miss the reaction on the current trigger and continue polling.

Fix in Claude Code

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed — the real fix is to capture the trigger comment's ID directly from the post response (gh api ... -f body="@greptileai" --jq '.id') rather than re-deriving it afterward via any content-based search. That eliminates the drift risk entirely: Step 2g now captures trigger_id at post time, and Step 2h's reaction check reuses that exact value instead of searching for "the last @greptileai comment" (which is what both this finding and the earlier pagination finding were really pointing at).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's the right fix. Capturing trigger_id at post time eliminates both the drift and the pagination issues simultaneously — no content search to go stale.

One small thing worth confirming: gh api ... --jq '.id' on the comment creation endpoint returns the ID as a bare number, so $trigger_id will be an integer. That's fine for the subsequent repos/<repo>/issues/comments/$trigger_id/reactions call — just making sure neither the instruction text nor any downstream usage wraps it in quotes in a way that would break interpolation.

The fix is correct and addresses the original concern cleanly.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confirmed fine — $(gh api ... --jq '.id') returns a bare integer, and bash interpolates that identically whether $trigger_id is quoted or unquoted (no whitespace/special characters to worry about, unlike interpolating arbitrary strings). Neither snippet wraps it in quotes anywhere it would matter, so no further change needed.

Searching for "the last @greptileai comment" after the fact drifts to
the wrong comment if another trigger lands on the same PR in between
(a resumed run, a concurrent session). Capturing the ID directly from
the post response removes the ambiguity entirely.
@carlos-alm

Copy link
Copy Markdown
Contributor Author

@greptileai

@carlos-alm
carlos-alm merged commit 1195ce9 into main Aug 2, 2026
41 checks passed
@carlos-alm
carlos-alm deleted the fix/greptile-reaction-convergence-2194 branch August 2, 2026 01:39
@github-actions github-actions Bot locked and limited conversation to collaborators Aug 2, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fixer/sweep skills: recognize Greptile's 👍 reaction as convergence, not a stall

1 participant