Skip to content

agent: @U0AJM7X8FBR I need individual buttons to merge each pull request in the#276

Merged
recoup-coding-agent merged 9 commits intotestfrom
agent/-u0ajm7x8fbr-i-need-individual-1773100182652
Mar 10, 2026
Merged

agent: @U0AJM7X8FBR I need individual buttons to merge each pull request in the#276
recoup-coding-agent merged 9 commits intotestfrom
agent/-u0ajm7x8fbr-i-need-individual-1773100182652

Conversation

@sweetmantech
Copy link
Contributor

@sweetmantech sweetmantech commented Mar 9, 2026

Automated PR from coding agent.

Summary by CodeRabbit

  • New Features
    • Granular PR merge controls - Users can now merge individual pull requests separately instead of all at once. Each PR has its own dedicated merge button with real-time status updates and specific error feedback for individual merge operations.

@vercel
Copy link
Contributor

vercel bot commented Mar 9, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
recoup-api Ready Ready Preview Mar 10, 2026 2:02am

Request Review

@coderabbitai
Copy link

coderabbitai bot commented Mar 9, 2026

Warning

Rate limit exceeded

@sweetmantech has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 16 minutes and 43 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, 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 have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: b4409606-babf-46a5-8c05-1e03dcaf9973

📥 Commits

Reviewing files that changed from the base of the PR and between e751f79 and fd7ce53.

⛔ Files ignored due to path filters (3)
  • lib/coding-agent/__tests__/mergeGithubPR.test.ts is excluded by !**/*.test.*, !**/__tests__/** and included by lib/**
  • lib/coding-agent/__tests__/onMergeAction.test.ts is excluded by !**/*.test.*, !**/__tests__/** and included by lib/**
  • lib/coding-agent/__tests__/parseMergeActionId.test.ts is excluded by !**/*.test.*, !**/__tests__/** and included by lib/**
📒 Files selected for processing (3)
  • lib/coding-agent/handlers/onMergeAction.ts
  • lib/coding-agent/mergeGithubPR.ts
  • lib/coding-agent/parseMergeActionId.ts
📝 Walkthrough

Walkthrough

Replaces a single global merge-all button with individual per-PR merge buttons in the PR card UI. Updates the merge action handler to parse PR-specific action IDs and process merges for individual PRs, with immediate state updates and per-PR success/failure messaging instead of batch aggregation.

Changes

Cohort / File(s) Summary
PR Card & Merge Handler
lib/coding-agent/buildPRCard.ts, lib/coding-agent/handlers/onMergeAction.ts
Migrates from batch merge operations to granular per-PR merges. buildPRCard.ts adds individual merge buttons per PR (id: merge_pr:${repo}#${number}). onMergeAction.ts introduces parseMergeActionId() to extract repo and PR number, validates the action, finds the specific PR in state, performs a targeted squash-merge via GitHub API, and updates state incrementally with immediate status transitions.

Sequence Diagram

sequenceDiagram
    participant User
    participant UI as PR Card
    participant Handler as onMergeAction
    participant API as GitHub API
    participant State as Thread State

    User->>UI: Click merge button (merge_pr:repo#123)
    UI->>Handler: Emit action merge_pr:repo#123
    Handler->>Handler: parseMergeActionId()
    alt Valid Action ID
        Handler->>State: Locate PR `#123`
        alt PR Found
            Handler->>API: POST /repos/owner/repo/pulls/123/merge
            alt Merge Successful
                API-->>Handler: Success response
                Handler->>State: Remove PR from list
                Handler->>State: Update overall status
                Handler->>UI: Post success message
            else Merge Failed
                API-->>Handler: Error response
                Handler->>UI: Post failure message with error
            end
        else PR Not Found
            Handler->>UI: Post "PR not found" error
        end
    else Invalid Action ID
        Handler->>UI: Post "Invalid merge action" error
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Poem

🎯 No more waiting for the batch,
Each PR gets its own dispatch!
One button, one merge, one PR's fate—
Granular control, now that's great!

🚥 Pre-merge checks | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Solid & Clean Code ⚠️ Warning Code violates SOLID principles and clean code practices: unprotected JSON.parse() call at line 77, Single Responsibility Principle violated, hardcoded strings repeated across locations, and excessive nesting depth. Wrap JSON.parse() in try-catch, extract magic strings to constants, decompose handler into utility functions, and refactor conditionals to reduce nesting depth to ≤3 levels.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch agent/-u0ajm7x8fbr-i-need-individual-1773100182652

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.

@sweetmantech sweetmantech force-pushed the agent/-u0ajm7x8fbr-i-need-individual-1773100182652 branch from 70f4c1c to e751f79 Compare March 10, 2026 00:04
Copy link

@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

🧹 Nitpick comments (2)
lib/coding-agent/handlers/onMergeAction.ts (2)

9-13: Consider making parseMergeActionId a private helper or moving to a separate file.

Per coding guidelines, lib/**/*.ts files should follow Single Responsibility Principle with one exported function per file. Currently, this file exports both parseMergeActionId and registerOnMergeAction.

Options:

  1. Remove the export keyword if this helper is only used internally
  2. Move to a dedicated parseMergeActionId.ts utility file if needed elsewhere
♻️ Option 1: Make it internal
-export function parseMergeActionId(actionId: string) {
+function parseMergeActionId(actionId: string) {

As per coding guidelines: "Apply Single Responsibility Principle (SRP): one exported function per file; each file should do one thing well"

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@lib/coding-agent/handlers/onMergeAction.ts` around lines 9 - 13, The helper
parseMergeActionId is exported alongside registerOnMergeAction, violating SRP;
either remove the export from parseMergeActionId to make it an internal helper
used by registerOnMergeAction, or move parseMergeActionId into its own module
(e.g., parseMergeActionId.ts) and keep it exported there; update any
imports/usages accordingly and ensure registerOnMergeAction references the
internal helper or the new module.

24-89: Function exceeds 50-line guideline; consider extracting helpers.

The registerOnMergeAction function spans ~65 lines with multiple concerns: validation, API interaction, state management, and user messaging. Per coding guidelines, functions should stay under 50 lines.

Potential extractions:

  • mergePullRequest(owner, repo, number, token) - encapsulate the GitHub API call
  • State update logic into a helper

This isn't blocking but would improve testability and readability.

As per coding guidelines: "Keep functions under 50 lines"

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@lib/coding-agent/handlers/onMergeAction.ts` around lines 24 - 89, The
registerOnMergeAction function is too long and mixes validation, GitHub API
interaction, and state updates; extract the API call into a new helper
mergePullRequest(owner, repo, number, token) that performs the fetch/PUT and
returns a success boolean and error info, and move the state mutation and
post-merge behavior into a helper like applyMergeResultToThread(thread, state,
pr, success) which updates thread.setState, computes remainingPrs/allMerged,
calls handleMergeSuccess when appropriate, and posts the final message; replace
the inline fetch block and state logic in registerOnMergeAction with calls to
mergePullRequest and applyMergeResultToThread so the exported
registerOnMergeAction body stays under 50 lines and is easier to test.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@lib/coding-agent/handlers/onMergeAction.ts`:
- Around line 81-88: The handler in onMergeAction.ts currently calls
JSON.parse(errorBody) which can throw if GitHub returns non-JSON; wrap the parse
in a try-catch (around JSON.parse(errorBody)) and use a safe fallback: if
parsing succeeds extract error.message, otherwise use the raw errorBody (or a
generic message) when calling thread.post and logging; keep the existing
console.error but include the safe error text so thread.post(`❌
${pr.repo}#${pr.number} failed to merge: ...`) always runs without throwing.

---

Nitpick comments:
In `@lib/coding-agent/handlers/onMergeAction.ts`:
- Around line 9-13: The helper parseMergeActionId is exported alongside
registerOnMergeAction, violating SRP; either remove the export from
parseMergeActionId to make it an internal helper used by registerOnMergeAction,
or move parseMergeActionId into its own module (e.g., parseMergeActionId.ts) and
keep it exported there; update any imports/usages accordingly and ensure
registerOnMergeAction references the internal helper or the new module.
- Around line 24-89: The registerOnMergeAction function is too long and mixes
validation, GitHub API interaction, and state updates; extract the API call into
a new helper mergePullRequest(owner, repo, number, token) that performs the
fetch/PUT and returns a success boolean and error info, and move the state
mutation and post-merge behavior into a helper like
applyMergeResultToThread(thread, state, pr, success) which updates
thread.setState, computes remainingPrs/allMerged, calls handleMergeSuccess when
appropriate, and posts the final message; replace the inline fetch block and
state logic in registerOnMergeAction with calls to mergePullRequest and
applyMergeResultToThread so the exported registerOnMergeAction body stays under
50 lines and is easier to test.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: a1486e23-269e-42b2-9fd5-6ec487ea16fd

📥 Commits

Reviewing files that changed from the base of the PR and between f7ce9ae and e751f79.

⛔ Files ignored due to path filters (2)
  • lib/coding-agent/__tests__/handlePRCreated.test.ts is excluded by !**/*.test.*, !**/__tests__/** and included by lib/**
  • lib/coding-agent/__tests__/onMergeAction.test.ts is excluded by !**/*.test.*, !**/__tests__/** and included by lib/**
📒 Files selected for processing (2)
  • lib/coding-agent/buildPRCard.ts
  • lib/coding-agent/handlers/onMergeAction.ts

Chat SDK's onAction uses exact match, not prefix match. Changed to
a catch-all handler that filters with startsWith("merge_pr:") so
dynamic action IDs like "merge_pr:#42" are matched.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@recoup-coding-agent recoup-coding-agent merged commit 87eb2b1 into test Mar 10, 2026
3 checks passed
sweetmantech added a commit that referenced this pull request Mar 10, 2026
…est in the (#276) (#277)

* agent: @U0AJM7X8FBR I need individual buttons to merge each pull request in the

* agent: address feedback

* agent: address feedback

* agent: address feedback

* agent: address feedback

* agent: address feedback

* agent: address feedback

* agent: address feedback

* fix: use catch-all action handler for merge_pr prefix matching

Chat SDK's onAction uses exact match, not prefix match. Changed to
a catch-all handler that filters with startsWith("merge_pr:") so
dynamic action IDs like "merge_pr:#42" are matched.



---------

Co-authored-by: Recoup Agent <agent@recoupable.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
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.

2 participants