Skip to content

Merge approved PRs through the GitHub client#2

Merged
khaliqgant merged 2 commits into
mainfrom
codex/issue-147-merge-pr
May 26, 2026
Merged

Merge approved PRs through the GitHub client#2
khaliqgant merged 2 commits into
mainfrom
codex/issue-147-merge-pr

Conversation

@khaliqgant
Copy link
Copy Markdown
Member

@khaliqgant khaliqgant commented May 26, 2026

Summary

  • Replaces the review agent's gh pr merge shell command with ctx.github.mergePullRequest(...).
  • Keeps squash merge behavior while removing the direct gh CLI dependency from the agent.
  • Adds a runtime guard so older runtime clients fail with a clear message instead of silently skipping merges.

Part of AgentWorkforce/workforce#147.

Companion PRs

Validation

  • npm run typecheck
  • git diff --check HEAD~1..HEAD

@gemini-code-assist
Copy link
Copy Markdown

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 26, 2026

Review Change Stack

Warning

Review limit reached

@khaliqgant, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 33 minutes and 8 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

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.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: d19026d6-4e70-4437-906c-9e9ae82efe5f

📥 Commits

Reviewing files that changed from the base of the PR and between 914b923 and 72b4397.

📒 Files selected for processing (1)
  • review/agent.ts
📝 Walkthrough

Walkthrough

The PR replaces CLI-based PR merging with a direct API call to ctx.github.mergePullRequest, adds type safety via the new GithubMergeClient interface, includes runtime validation to ensure the merge method exists, and removes the prior shellQuote helper that escaped arguments for the gh command.

Changes

GitHub merge API integration

Layer / File(s) Summary
Merge API type contract, implementation, and cleanup
review/agent.ts
Introduces GithubMergeClient type defining the mergePullRequest method signature with optional merge method and response shape. Reworks mergePr to validate ctx.github and mergePullRequest availability (throwing if missing), then calls mergePullRequest with method: 'squash'. Removes the shellQuote helper function that was used for CLI command argument escaping.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related issues

Poem

🐰 The rabbit hops from shell to API,
No more gh commands—just TypeScript harmony,
Type-safe merges, validation clear,
The old shellQuote fades away here! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Merge approved PRs through the GitHub client' clearly and concisely describes the main change: replacing the gh CLI merge command with the GitHub client API.
Description check ✅ Passed The description is well-related to the changeset, providing context about replacing gh CLI with ctx.github.mergePullRequest, maintaining squash merge behavior, adding runtime guards, and referencing related issues.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/issue-147-merge-pr

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 and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@review/agent.ts`:
- Around line 74-87: The call to GithubMergeClient.mergePullRequest inside
mergePr does not inspect its return ({ merged: boolean; sha?: string }), so you
may send a successful Slack message even when merged === false; update mergePr
to await and capture the result from github.mergePullRequest, check
result.merged (and handle undefined result) and only call ctx.slack.post with
the ":tada: Merged" message when merged is true; if merged is false, post an
informative failure message (or throw) including result.sha or other context so
users aren't misled.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: fdbfd966-5fc6-487f-adbe-82c079a1f0bf

📥 Commits

Reviewing files that changed from the base of the PR and between a2bba47 and 914b923.

📒 Files selected for processing (1)
  • review/agent.ts

Comment thread review/agent.ts
Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

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

1 issue found across 1 file

You’re at about 95% of the monthly reviewed-line limit. You may want to disable incremental reviews to conserve quota. Reviews will continue until that limit is exceeded. If you need help avoiding interruptions, please contact contact@cubic.dev.

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread review/agent.ts Outdated
@khaliqgant khaliqgant merged commit 416631a into main May 26, 2026
2 checks passed
@khaliqgant khaliqgant deleted the codex/issue-147-merge-pr branch May 26, 2026 18:44
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