Skip to content

[Bug]: A failed pull request checkout keeps showing its error on the next pull request #39553

Closed

Description

@StiensWout

Before submitting

  • I searched existing issues and did not find a duplicate.
  • I included enough detail to reproduce or investigate the problem.

Area

apps/web

Steps to reproduce

  1. Make an uncommitted edit to a tracked file in a project with two open pull requests.
  2. Open a new thread in that project.
  3. Open the branch picker.
  4. Enter the first pull request number.
  5. Choose Checkout pull request.
  6. Click Local after the pull request resolves.
  7. Replace the number with the second pull request number after the checkout fails.
  8. Wait for the second pull request title to appear.

Expected behavior

The dialog shows the second pull request without the first checkout's error.

Actual behavior

The dialog shows the second pull request alongside an error that still names the first.

second pull request

failure

Impact

Minor bug or occasional failure. Anyone who switches references in the same dialog after a failed checkout sees stale feedback until they try another checkout or close the dialog.

Version or commit

main at 59651c1761. The cause is at apps/web/src/components/PullRequestThreadDialog.tsx:199.

Environment

Linux x64 boat.dev default machine, a fresh checkout.

Logs or stack traces

The second pull request does not display the first checkout error
Automated repro

Fails in 2 of 2 runs on main: apply the patch with git apply, then run the command.

diff --git a/scripts/scenarios/pull-request-checkout-error-follows-reference.e2e.ts b/scripts/scenarios/pull-request-checkout-error-follows-reference.e2e.ts
new file mode 100644
index 0000000000..b8656e05df
--- /dev/null
+++ b/scripts/scenarios/pull-request-checkout-error-follows-reference.e2e.ts
@@ -0,0 +1,90 @@
+/// <reference lib="dom" />
+import type { GitResolvePullRequestResult } from "@t3tools/contracts";
+import { expect } from "e2e";
+
+import { test, WEB } from "./t3.ts";
+
+test(
+  "A failed local checkout does not show its error on another pull request",
+  WEB,
+  async ({ t3, app, browser, screen }) => {
+    await t3.project("demo");
+    await browser.setViewport({ width: 1280, height: 800 });
+    await browser.addInitScript(() => {
+      const send = WebSocket.prototype.send;
+      WebSocket.prototype.send = function (data) {
+        const request: {
+          _tag: string;
+          id: string;
+          tag: string;
+          payload: { cwd: string; reference: string };
+        } | null = typeof data === "string" ? JSON.parse(data) : null;
+        if (request?._tag !== "Request") return send.call(this, data);
+        const reply = (exit: unknown) =>
+          queueMicrotask(() =>
+            this.dispatchEvent(
+              new MessageEvent("message", {
+                data: JSON.stringify({ _tag: "Exit", requestId: request.id, exit }),
+              }),
+            ),
+          );
+        if (request.tag === "git.resolvePullRequest") {
+          const number = Number(request.payload.reference.replace(/^#/, ""));
+          const value: GitResolvePullRequestResult = {
+            pullRequest: {
+              number,
+              title: number === 42 ? "Update the release notes" : "Fix the status badge",
+              url: `https://github.com/example/demo/pull/${number}`,
+              baseBranch: "main",
+              headBranch: `change-${number}`,
+              state: "open",
+            },
+          };
+          reply({ _tag: "Success", value });
+          return;
+        }
+        if (request.tag === "git.preparePullRequestThread") {
+          reply({
+            _tag: "Failure",
+            cause: [
+              {
+                _tag: "Fail",
+                error: {
+                  _tag: "GitManagerError",
+                  operation: "preparePullRequestThread",
+                  cwd: request.payload.cwd,
+                  detail:
+                    "This repository has uncommitted changes. Commit or stash them before checking out pull request #42 here, or check it out in its own folder.",
+                },
+              },
+            ],
+          });
+          return;
+        }
+        return send.call(this, data);
+      };
+    });
+
+    await t3.open("/");
+    await browser
+      .locator('[data-slot="combobox-trigger"][aria-label^="Branch:"]:visible')
+      .first()
+      .click();
+    await screen.getByPlaceholder("Search refs...").fill("#42");
+    const checkoutLabel = /Checkout (?:pull|change) request/i;
+    await screen.getByRole("option", checkoutLabel).tap();
+
+    const dialog = screen.getByRole("dialog", checkoutLabel);
+    await dialog.getByText("Update the release notes", { exact: true }).waitFor();
+    await dialog.getByRole("button", "Local", { exact: true }).tap();
+    const previousError = dialog.getByText(/before checking out pull request #42 here/);
+    await previousError.waitFor();
+    await dialog.getByRole("textbox").fill("#43");
+    await dialog.getByText("Fix the status badge", { exact: true }).waitFor();
+    await app.screenshot("second-pull-request");
+    expect(
+      await previousError.isVisible(),
+      "The second pull request does not display the first checkout error",
+    ).toBe(false);
+  },
+);
pnpm scenarios:prove scripts/scenarios/pull-request-checkout-error-follows-reference.e2e.ts --base main

Workaround

No response

Activity

  1. added
    vouch:trusted
    on Nov 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    vouch:trusted

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions