Skip to content

fix: address commented reviews that mention the bot, scope runs to actionable feedback - #104

Merged
danii1 merged 6 commits into
mainfrom
fix/commented-review-mention-handling
Aug 31, 2026
Merged

fix: address commented reviews that mention the bot, scope runs to actionable feedback#104
danii1 merged 6 commits into
mainfrom
fix/commented-review-mention-handling

Conversation

@danii1

@danii1 danii1 commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Problem

Review feedback on #102 was received by the worker but never processed. Logs showed 📌 [relay] review feedback on getdevintern/devintern#102 followed immediately by processed 1 envelope — a fast, silent no-op.

Root cause: devintern address-review only acted on CHANGES_REQUESTED reviews. The actual feedback was a COMMENTED review (empty body) wrapping an inline comment that mentioned @devintern-ai. The relay dispatched correctly, the run found no changes_requested review, printed "No pending changes_requested reviews found", and exited 0.

Changes

address-review.ts

  • Handle commented reviews: fall back to the latest COMMENTED review when no CHANGES_REQUESTED review exists — gated on a bot @-mention in the review body or its comments, matching the documented webhook trigger semantics (changes_requested stays unconditional). Fails closed when no bot identity is resolvable.
  • Scope each run to actionable feedback: comments are included only if they belong to the chosen review's threads (matched via pull_request_review_id, resolved through reply chains) or explicitly mention the bot. Previously all unaddressed comments on the PR were batched, so informal comments skipped for lack of a mention could be swept into a later changes_requested run, and a new informal review could bypass the mention gate entirely whenever an older CHANGES_REQUESTED review existed.
  • Log the reason: skip messages now state why (commented review without mention, no resolvable bot identity), and out-of-scope unaddressed comments are counted (N unaddressed but out of scope for this run).
  • Pass the real review state into the prompt (💬 Commented) instead of hardcoding changes_requested.

Relay / workspace worker

  • RelayHandlers.addressPr now returns Promise<boolean>; the relay logs ✅ … feedback addressed or ⚠️ … did not complete cleanly instead of silently discarding the outcome.
  • Warn with the reason when review/comment envelopes arrive in a workspace without GitHub credentials (previously a silent no-op).

Resulting semantics

Feedback Actioned?
changes_requested review always
commented review / stray inline comment only when the bot is @-mentioned
Already-addressed comment (🎉 hooray) never repeated

Verification

  • bun run typecheck, bun run lint, bun run format clean
  • bun run --filter @getdevintern/code test: 1108 pass, 0 fail

Fixes #102

danii1 added 6 commits August 31, 2026 20:49
…tionable feedback

Relay/poll review runs only acted on CHANGES_REQUESTED reviews, so a
COMMENTED review wrapping a @bot mention (e.g. devintern#102) was
silently no-oped. Changes:

- address-review: fall back to the latest COMMENTED review when no
  changes_requested review exists, gated on a bot mention in the review
  body or its comments (matches the webhook trigger semantics); pass the
  real review state into the prompt instead of hardcoding
  changes_requested
- address-review: scope each run to the chosen review's threads plus
  explicit bot mentions — stray or skipped informal comments are no
  longer swept into later runs, and already-addressed (hooray) comments
  are never repeated; log out-of-scope counts and skip reasons
- relay: propagate the addressPr outcome and log addressed/not-clean
  instead of silently discarding it; warn with the reason when PR
  envelopes arrive without GitHub credentials
The address-review CLI built its client token-first, so with a human
GITHUB_TOKEN set the App auth was never initialized and getBotUsername()
returned null — the commented-review mention gate then failed closed and
skipped every run (devintern#102). Prefer App auth like the worker's own
poller client so `slug[bot]` resolves for @mention matching.
Relay-managed PRs are associated with the DevIntern AI App identity
(devintern-ai), whose private key stays on DevIntern infrastructure —
so a local worker can never resolve it via App auth and @devintern-ai
mentions were correctly skipped by the commented-review gate.

- mention-sweep: add GITHUB_BOT_ALIASES (comma-separated logins) and
  mentionsAnyBot/botMentionCandidates helpers; the sweep now matches the
  resolved login plus aliases and stays dormant only when neither exists
- relay: a relay-connected worker injects devintern-ai as an alias into
  the worker env, so the address-review subprocess and every mention
  gate respond to @devintern-ai without the key
- address-review: the commented-review mention gate and per-comment
  scoping match all candidate identities; skip messages list them
- docs: document GITHUB_BOT_ALIASES under GitHub authentication
- configuration.md: the GitHub App setup now lists Reactions: Read &
  write — the 🎉 reaction is the addressed-marker, and an installation
  without it fails marking with 403 and re-processes feedback later
- address-review: reaction failures matching GitHub's App-permission
  error now log the fix (grant Reactions, or mark manually) inline
When a review run is triggered by a mention of the relay App identity
(devintern-ai) and the local credentials could not mark the comments,
the worker asks the relay to react as devintern-ai (POST /v1/reactions,
see private control-plane PR) so the addressed-marker exists in
relay-only setups too.

- address-review: return a structured result (aliasMentioned +
  unmarkedComments); markCommentsAddressed reports skipped replies and
  failed reactions; the gate records whether the mention matched the
  relay identity; index.ts emits the result via DEVINTERN_RESULT_FD
- runAddressReviewViaCli: optional onResult captures the subprocess
  result through the result fd (same pattern as resolve-conflicts)
- fleet: after a run with a CLI result, request relay reactions
  (loadRelayState + POST); failures logged, non-fatal
- docs: correct the App permission list — Reactions is NOT required;
  review-comment reactions need Pull requests write and
  conversation-comment reactions need Issues write (verified
  empirically against an App installation); a 403 on reactions means a
  stale installation token or missing PR/Issues write
@danii1
danii1 merged commit 0eb0e86 into main Aug 31, 2026
1 check passed
@danii1
danii1 deleted the fix/commented-review-mention-handling branch August 31, 2026 15:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant