Skip to content

codex/roborev two speed hook - #2276

Closed
shunkakinoki wants to merge 1 commit into
mainfrom
codex/roborev-two-speed-hook
Closed

codex/roborev two speed hook#2276
shunkakinoki wants to merge 1 commit into
mainfrom
codex/roborev-two-speed-hook

Conversation

@shunkakinoki

@shunkakinoki shunkakinoki commented Aug 6, 2026

Copy link
Copy Markdown
Owner

Stack created with GitHub Stacks CLIGive Feedback 💬


Summary by cubic

Runs the RoboRev full PR panel from the agent hook as a separate background task and posts a dedicated PR comment, keeping the quick CI comment fast. Adds gating and per-head dedup so the full panel runs once per PR head.

  • New Features
    • Starts full-panel review in the background; preserves normal hook output (even if the full review fails).
    • Triggers on Stop, post-push, and PR create; runs only for OPEN PRs on the current head using merge-base (base..head), and only if [review.panels.full] exists in .roborev.toml.
    • Posts a separate PR comment via gh with a "RoboRev Full Panel" header and short head SHA; only posts if the PR is still OPEN and on the same head.
    • Deduplicates per head SHA via a lock dir; configurable via ROBOREV_BIN, GH_BIN, GIT_BIN, JQ_BIN, ROBOREV_SERVER_ADDR, ROBOREV_AGENT_FULL_REVIEW_STATE_DIR, with optional sync mode ROBOREV_AGENT_HOOK_SYNC=1. Logs to a file when launched in the background.

Written for commit b9c6500. Summary will update on new commits.

Review in cubic

@indent-zero

indent-zero Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor
PR Summary

Adds a "two-speed" behavior to the RoboRev agent hook: the existing fast agent-hook run path is preserved so the coding agent still gets a snappy response, and after PR-affecting events (Stop, git push, gh pr create) a background invocation runs the full RoboRev panel and posts the synthesized review as a PR comment. The full-panel path is opt-in per repository via a .roborev.toml with a [review.panels.full] section.

  • config/shared/hooks/roborev-agent.sh: buffers stdin, runs the quick agent-hook run (now guarded with || true so its exit code doesn't tank the hook), parses the event via jq, and — on matching Stop/PostToolUse events — launches run_full_pr_review either inline (ROBOREV_AGENT_HOOK_SYNC=1) or via nohup "$0" --full-pr-review &.
  • run_full_pr_review: gates on .roborev.toml containing [review.panels.full], validates PR/OIDs, acquires a per-(git-common-dir, head_oid) mkdir lock under $STATE_DIR, runs roborev review --wait --quiet --panel full, re-checks PR state, and posts a ## RoboRev Full Panel (<sha>) comment via gh pr comment. All bail-outs use return (not exit) so the outer hook still emits its quick response, and the lock is released on both review and comment failures.
  • Configurable via ROBOREV_BIN, GH_BIN, GIT_BIN, JQ_BIN, ROBOREV_SERVER_ADDR, ROBOREV_AGENT_FULL_REVIEW_STATE_DIR, ROBOREV_AGENT_HOOK_SYNC.
  • spec/roborev_hooks_spec.sh: covers quick output preservation, full-panel git push flow, silent no-op on review failure with preserved hook output, the async nohup background path (polls $CALLS for gh pr comment), per-head dedup with preserved hook output, and skipping repos without the [review.panels.full] opt-in.

Issues

1 potential issue found:

  • Full-panel comment is now posted fresh for every head SHA: this force-push removed the marker-based upsert (COMMENT_MARKER + gh api PATCH) and replaced it with gh pr comment "$pr_number" --body "$comment_body", which always creates a new comment. Long-lived PRs with many pushes will accumulate one "RoboRev Full Panel" comment per new head SHA — if the intent is a single evolving comment, restore the marker + gh api upsert flow. → Autofix
5 issues already resolved
  • Sync-mode early-exits swallow the quick hook output: every bail-out inside run_full_pr_review uses bare exit 0/exit 1, and when ROBOREV_AGENT_HOOK_SYNC=1 the function runs in-process, so hitting any bail-out (missing .roborev.toml, missing panel section, closed PR, HEAD moved, invalid OIDs, dedup lock collision, review failure) terminates the whole script before the final printf '%s\n' "$HOOK_OUTPUT" — the coding agent then gets an empty response. Use return instead of exit when not in the --full-pr-review re-exec path. Notably, the new .roborev.toml opt-in gate means most repos will hit an early-exit on every hook invocation. (fixed by commit 833dba9)
  • The default async path (nohup "$0" --full-pr-review "$cwd" & at line 63) has no test coverage — every scenario in spec/roborev_hooks_spec.sh forces ROBOREV_AGENT_HOOK_SYNC=1 in setup_hook, so regressions in the fork/re-exec, log-file setup, or --full-pr-review dispatch won't be caught by CI. (fixed by commit 833dba9)
  • Lock directories under $STATE_DIR are never cleaned up on success: ${STATE_DIR}/${head_oid}.enqueued (line 36) is only rmdir'd on roborev review failure (line 42), so ~/.roborev/agent-full-reviews/ grows unbounded and if gh pr comment fails after review succeeded, the stale lock permanently blocks any retry for that head SHA. (fixed by commit 833dba9)
  • Dedup lock dropped its repo scope: the new ${STATE_DIR}/${head_oid}.enqueued key (line 36) omits the previous ${repo_slug//\//_}/ segment, so two distinct working trees on the host that share a head SHA (mirror clones, sibling forks checked out at a common commit) will dedup against each other and only one will get a full-panel run. (fixed by commit 833dba9)
  • HOOK_OUTPUT="$(... agent-hook run)" (line 76) under set -euo pipefail aborts the script silently if roborev agent-hook run exits non-zero, so unlike the previous exec-based version any partial output the daemon emitted before failing is no longer forwarded to the agent — add || true (or capture the exit code explicitly) if that fallback matters. (fixed by commit 833dba9)

CI Checks

Waiting for CI checks...


⚡ Autofix All Issues

@coderabbitai

coderabbitai Bot commented Aug 6, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@shunkakinoki, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 32 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: fa33bd7d-b035-4f6a-b6eb-b4792d13a7f2

📥 Commits

Reviewing files that changed from the base of the PR and between 5eac42a and b9c6500.

📒 Files selected for processing (2)
  • config/shared/hooks/roborev-agent.sh
  • spec/roborev_hooks_spec.sh

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@shunkakinoki
shunkakinoki force-pushed the codex/roborev-two-speed-hook branch from 394089e to a8e2276 Compare August 6, 2026 06:39
Comment thread config/shared/hooks/roborev-agent.sh Outdated
Comment thread config/shared/hooks/roborev-agent.sh Outdated
Comment thread spec/roborev_hooks_spec.sh
Comment thread config/shared/hooks/roborev-agent.sh Outdated
@shunkakinoki
shunkakinoki force-pushed the codex/roborev-two-speed-hook branch from a8e2276 to d6e88d3 Compare August 6, 2026 06:45
Comment thread config/shared/hooks/roborev-agent.sh Outdated
[ "$(printf '%s' "$pr_json" | "$JQ_BIN" -r '.headRefOid // empty')" = "$head_oid" ] || exit 0

comment_body="$(printf '## RoboRev Full Panel (`%s`)\n\n%s' "${head_oid:0:12}" "$review_output")"
(cd "$repo_path" && "$GH_BIN" pr comment "$pr_number" --body "$comment_body") >/dev/null

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.

No more upsert — one full-panel comment per new head SHA: The prior revision embedded a <!-- roborev-full-panel-comment --> marker and used gh api PATCH on any pre-existing marker-tagged comment via post_full_comment. That helper (and the marker) were removed in this force-push, so gh pr comment now unconditionally POSTs a new comment. On a PR with N head SHAs (rebases, review-loop pushes, etc.), the PR ends up with N Full Panel comments. If per-SHA history is the intent, this is fine; if the intent is one evolving comment, either bring back the marker/PATCH flow, or gh api DELETE any prior full-panel comments before posting.

Comment thread config/shared/hooks/roborev-agent.sh Outdated
@shunkakinoki
shunkakinoki force-pushed the codex/roborev-two-speed-hook branch from d6e88d3 to 833dba9 Compare August 6, 2026 06:54
@shunkakinoki
shunkakinoki force-pushed the codex/roborev-two-speed-hook branch from 833dba9 to b9c6500 Compare August 6, 2026 06:56
@shunkakinoki

Copy link
Copy Markdown
Owner Author

Superseded by #2277. The replacement keeps the shared agent-hook passthrough unchanged and only configures approval-gated fixer reminders.

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