Skip to content

fix(review): reviewer posts to GitHub and records its verdict autonomously#259

Open
neversettle17-101 wants to merge 2 commits into
mainfrom
fix/258-reviewer-flow
Open

fix(review): reviewer posts to GitHub and records its verdict autonomously#259
neversettle17-101 wants to merge 2 commits into
mainfrom
fix/258-reviewer-flow

Conversation

@neversettle17-101

@neversettle17-101 neversettle17-101 commented Jun 16, 2026

Copy link
Copy Markdown
Collaborator

Fixes #258

Summary

The claude-code reviewer never completed a review autonomously — it didn't post to the PR on GitHub and couldn't record its verdict, leaving the review_run stuck running. This fixes the three independent defects in the reviewer launch + flow:

  1. Permission mode (internal/adapters/reviewer/claudecode/claudecode.go) — the reviewer launched with no --permission-mode, so a headless pane stalled on the first tool-permission prompt. Now launches with bypassPermissions. Read-only is enforced by the prompt (not a sandbox), so granting autonomy to run gh/ao is safe.
  2. Pinned PATH (internal/review/launcher.go, internal/session_manager/manager.go) — the reviewer pane was created with no env, so ao review submit resolved to a foreign ao on the inherited PATH and failed. Exported the existing HookPATH helper and reuse it in the launcher to pin PATH to the daemon's own dir, exactly as worker sessions do.
  3. Prompt ordering (internal/review/prompt.go) — the prompt only implied ordering. It now requires posting the review on the PR via gh first, then running ao review submit, falling back to submit-only if the provider post genuinely fails.

Test

  • go build ./...
  • go test ./internal/review/... ./internal/session_manager/... ./internal/adapters/reviewer/... — pass
  • Verified end-to-end locally: triggering a review now spawns an autonomous reviewer that resolves ao correctly.

Notes

  • Scope is limited to the reviewer flow; no DTO/API/frontend changes.
  • Self-approval (per the issue): GitHub rejects --approve on your own PR. The reviewer prompt now falls back to posting the approval as a regular comment review when self-approval is rejected, so the approve path works on single-account setups.

🤖 Generated with Claude Code

On bypassPermissions (read-only enforcement)

The reviewer launches with --permission-mode bypassPermissions so it can run gh/ao headless without a human approving each tool call. This bypasses the interactive permission prompts, not safety — the read-only guarantee ("review only, do not edit/push") is enforced by the reviewer prompt, not a sandbox. A hard, allowlist-enforced read-only reviewer is a deliberate follow-up: it must move off bypassPermissions (which skips allow/deny lists entirely) to a scoped tool allowlist, with tradeoffs around stalling and the review.md write. Tracked in #260.

…autonomously

The claude-code reviewer never completed a review on its own. Three defects
in the reviewer launch + flow:

- It launched with no permission mode, so a headless pane stalled on the
  first tool-permission prompt and never ran gh/ao. Launch with
  bypassPermissions (read-only is enforced by the prompt, not a sandbox).
- The reviewer pane got no pinned PATH, so `ao review submit` resolved to a
  foreign `ao` on the inherited PATH and failed. Pin PATH to the daemon's
  own dir the same way worker sessions do — export HookPATH and reuse it in
  the launcher.
- The prompt did not enforce ordering. Make it post the review on the PR
  via gh first, then run `ao review submit`.

Fixes #258

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

@greptile-apps greptile-apps Bot left a comment

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.

Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.

…cted

GitHub does not let an author approve their own PR, so a reviewer running
under the same account can't post an `approve`. Tell the reviewer to post
the approval as a regular comment review (COMMENT event stating it is an
approval) when the provider rejects the self-approval, instead of failing.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

@greptile-apps greptile-apps Bot left a comment

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.

Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.

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.

fix(review): reviewer flow fixes — never posts to GitHub or records its verdict

1 participant