Skip to content

fix(web): show readable errors when a stack action fails - #24118

Open
only21mil wants to merge 2 commits into
pingdotgg:mainfrom
only21mil:r13/n018-show-the-host-s-reason-when-a-stack-merg
Open

only21mil wants to merge 2 commits into
pingdotgg:mainfrom
only21mil:r13/n018-show-the-host-s-reason-when-a-stack-merg

Conversation

@only21mil

Copy link
Copy Markdown
Contributor

Problem

When GitHub refuses Merge stack or Rebase stack, the error toast includes PullRequestOperationError: Pull request operation runAction failed: before the reason. Other pull request actions already show the readable detail.

Change

Pass stack failures through the existing readableFailure helper. It removes the operation prefix, limits the description to 320 characters, and uses the existing merge or rebase guidance when the error has no useful detail.

Scope and approval

This is a focused fix for an obvious inconsistency in the existing stack controls. It changes the failure description shared by web and desktop. It does not change the requests sent to GitHub. No linked issue.

Verification

  • cd apps/web && pnpm exec vp test run src/components/pullRequest/PullRequestStackMenu.browser.test.tsx --project browser: both cases pass on the candidate. The same test with the original main component fails both cases on the exact error-description assertion. The command failure is controlled at the boundary; the component, tagged error, failure unwrapping and toast are real.
  • pnpm exec vp fmt --check and pnpm exec vp lint on both changed files pass. pnpm exec vp run --filter @t3tools/web typecheck passes. Production builds using pnpm exec vp run --filter t3 build pass for base and candidate.
  • Real app, production builds of base and candidate on Linux with fresh state: web served by t3 serve and driven in a browser, and the Electron desktop app driven with real pointer input on its own display. I made a three-layer GitHub native stack in a throwaway public repository I can write to, and opened the top layer. With the Merge or Rebase confirmation open, I pushed a commit to the bottom layer, so the heads the app sent were stale. GitHub's stack API reported the new head before I confirmed. In all eight runs the server rejected the action with GitHubStackChangedError after one read of the stack, before any merge or branch update. All three PRs stayed open and main did not move.

Original main component, both regression cases fail on the prefixed text:

Base regression test failure

Candidate, both regression cases pass:

Candidate regression test success

Web, candidate build: the stack menu on layer 3 of 3, with both actions enabled:

Web stack menu with Merge stack and Rebase stack enabled

Web, before: Merge stack on the base build. The toast starts with the error class and operation:

Web base merge toast with the prefixed error

Web, after: the same steps on the candidate. Only the host's reason:

Web candidate merge toast with the host's reason

Web, before: Rebase stack on the base build:

Web base rebase toast with the prefixed error

Web, after: Rebase stack on the candidate:

Web candidate rebase toast with the host's reason

Desktop, candidate build: the same stack menu in the Linux Electron app:

Desktop stack menu with Merge stack and Rebase stack enabled

Desktop, before: Merge stack on the base build:

Desktop base merge toast with the prefixed error

Desktop, after: Merge stack on the candidate:

Desktop candidate merge toast with the host's reason

Desktop, before: Rebase stack on the base build:

Desktop base rebase toast with the prefixed error

Desktop, after: Rebase stack on the candidate:

Desktop candidate rebase toast with the host's reason

Not checked:

  • Mobile. It does not render this component and has no Rebase stack action. Its merge controls in apps/mobile/src/features/pull-requests/PullRequestMergeControls.tsx show the raw error message in an alert for single and stack merges alike, so a refusal there likely still starts with the operation prefix. That is separate code and a separate fix, so this change does not touch it.
  • macOS and Windows desktop. The change is in the web client the desktop app loads, with no platform code.
  • Host refusals other than a stale head, such as branch rules, failing checks or a rebase conflict. They reach the same toast through the same helper.

Prior PRs: Steven Hanna's #21958 moves this block into a shared hook without changing the error description. TonybynMp4's closed #18875 addressed inferred single-PR merge hints and was closed as fixed by GraphQL error forwarding. It did not change this stack path. Neither patch is reused here.

Production fix, tests, PR description and test images written with GPT-6.1 Sol; real-app screenshots and the Verification update by Claude Opus 5.5, both in T3 Code Nightly.

🤖 Generated with GPT-6.1 Sol and Claude Opus 5.5 in T3 Code Nightly

only21mil and others added 2 commits October 22, 2026 16:52
Co-Authored-By: GPT-6.1 Sol <noreply@openai.com>
Use the existing PR failure formatter for stack merge and rebase refusals.

Co-Authored-By: GPT-6.1 Sol <noreply@openai.com>
@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:XS 0-9 changed lines (additions + deletions). labels Oct 23, 2026
@macroscopeapp

macroscopeapp Bot commented Oct 23, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved at 0826de6

Macroscope's review found this PR approvable — This PR narrowly improves merge and rebase stack failure toasts by reusing the existing readable error formatter, with browser coverage for both actions. It does not change stack operations, requests, schemas, or product defaults.

You can add or adjust custom eligibility rules. Learn more.

@coderabbitai

coderabbitai Bot commented Oct 23, 2026

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
📥 Commits

Reviewing files that changed from the base of the PR and between eb1510d and 0826de6.

📒 Files selected for processing: 2
  • apps/web/src/components/pullRequest/PullRequestStackMenu.browser.test.tsx
  • apps/web/src/components/pullRequest/PullRequestStackMenu.tsx

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.

📝 Walkthrough

Merge and rebase failure toasts now use readableFailure with action-specific fallback guidance. A browser test simulates refusals for both actions and checks the pending status and displayed text.

Changes: Stack operation messages

Layer / File(s) Summary
Format stack operation failures
apps/web/src/components/pullRequest/PullRequestStackMenu.tsx, apps/web/src/components/pullRequest/PullRequestStackMenu.browser.test.tsx
Merge and rebase failure descriptions now use readableFailure with action-specific fallback text. The browser test checks refusal messages and pending status for both actions.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~8 minutes

Change: Bug fix · Severity of issue fixed: Low

Merge Risk: ⚪ Minimal · up to 0826d

Merge and rebase refusals should show readable guidance. No actionable issue remains in the supplied review evidence.

Pre-merge checks: Passed 4
Check name Status Explanation
Title check Passed The title clearly and concisely describes the main change: displaying readable errors when stack actions fail.
Description check Passed The description includes all required sections, explains the problem and change, documents scope and approval rationale, and provides detailed verification results with screenshots and untested cases.
Linked Issues check Passed Issue #18875 is closed and completed. It supplies historical context only. No active directly linked issue provides coding requirements for this pull request. The pull request implements its stated cu…
Out of Scope Changes check Passed The whole pull request changes only PullRequestStackMenu.tsx and its browser test. The component change formats Merge stack and Rebase stack failure descriptions. The test verifies both actions and …
Full details: Linked Issues check

Explanation

Issue #18875 is closed and completed. It supplies historical context only. No active directly linked issue provides coding requirements for this pull request. The pull request implements its stated current objective by passing stack failures through readableFailure and adding merge and rebase regression coverage.

Full details: Out of Scope Changes check

Explanation

The whole pull request changes only PullRequestStackMenu.tsx and its browser test. The component change formats Merge stack and Rebase stack failure descriptions. The test verifies both actions and the removal of the operation prefix. These changes directly support the stated fix. No unrelated change is present in the reviewed diff.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XS 0-9 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant