Skip to content

[Bug]: Retrying a failed Issues list interrupts another environment's refresh #38653

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. Open Issues with two connected environments that both have issues.
  2. Click Refresh issues when one environment's list responds slowly and the other returns an error.
  3. Click Retry in the partial results warning while Refresh issues still shows that the list is loading.

Expected behavior

The failed environment retries, and the other environment's pending results appear as soon as they arrive.

Actual behavior

Retry restarts the read on the slow environment. Its original results never appear, even if that read would have finished first.

partial issues after retry

failure

Impact

Minor bug or occasional failure. People browsing issues across environments wait again for a slow list whenever they retry another environment's failure before that list finishes.

Version or commit

main at 8cf97b5f06. The cause is at apps/web/src/components/issue/IssuesPage.tsx:497.

Environment

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

Logs or stack traces

Updated issue from the slow environment
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/issues-retry-keeps-pending-environment.e2e.ts b/scripts/scenarios/issues-retry-keeps-pending-environment.e2e.ts
new file mode 100644
index 0000000000..8cf489e4ca
--- /dev/null
+++ b/scripts/scenarios/issues-retry-keeps-pending-environment.e2e.ts
@@ -0,0 +1,153 @@
+/// <reference lib="dom" />
+import type { IssueListResult } from "@t3tools/contracts";
+import { expect } from "e2e";
+
+import { SECOND_HOME, startSecondServer } from "./second-server.ts";
+import { makeState, test, WEB } from "./t3.ts";
+
+test(
+  "Retrying a failed environment keeps the Issues refresh already in progress",
+  WEB,
+  async ({ t3, app, screen, browser }) => {
+    await t3.project("demo");
+    const server = startSecondServer(app.baseUrl ?? "");
+    try {
+      const { host, token } = await server.ready;
+      await makeState(SECOND_HOME).state.project("remote-demo");
+      await browser.addInitScript((remoteHost) => {
+        const { promise: slowRead, resolve: release } = Promise.withResolvers<void>();
+        let refreshing = false;
+        let primaryRefreshStarted = false;
+        let remoteRefreshStarted = false;
+        Object.assign(window, {
+          armIssuesRefresh: () => {
+            refreshing = true;
+          },
+          releaseSlowIssuesRead: release,
+        });
+        const date = "2026-10-01T00:00:00.000Z";
+        const tracker = "github" as IssueListResult["trackers"][number]["tracker"];
+        const list = (title: string, remote: boolean): IssueListResult => {
+          const key = remote ? "2" : "1";
+          return {
+            entries: [
+              {
+                tracker,
+                host: "github.com",
+                scope: "example/demo",
+                key,
+                displayKey: "#" + key,
+                title,
+                projectId: (remote
+                  ? "remote-demo"
+                  : "demo") as IssueListResult["entries"][number]["projectId"],
+                projectTitle: remote ? "remote-demo" : "demo",
+                url: "https://github.com/example/demo/issues/" + key,
+                author: null,
+                state: { category: "open", name: "Open" },
+                createdAt: date,
+                updatedAt: date,
+                closedAt: null,
+                assignees: [],
+                labels: [],
+                commentCount: 0,
+              },
+            ],
+            errors: [],
+            nextCursors: {},
+            viewers: {},
+            trackers: [
+              {
+                tracker,
+                host: "github.com",
+                projectCount: 1,
+                capabilities: null,
+                configured: true,
+                detail: null,
+              },
+            ],
+          };
+        };
+        const send = WebSocket.prototype.send;
+        WebSocket.prototype.send = function (data) {
+          const request: { _tag: string; id: string; tag: string } | null =
+            typeof data === "string" ? JSON.parse(data) : null;
+          if (request?._tag !== "Request" || request.tag !== "issues.list")
+            return send.call(this, data);
+          const remote = new URL(this.url).host === remoteHost;
+          const reply = (exit: unknown) =>
+            this.dispatchEvent(
+              new MessageEvent("message", {
+                data: JSON.stringify({ _tag: "Exit", requestId: request.id, exit }),
+              }),
+            );
+          const success = (title: string) => reply({ _tag: "Success", value: list(title, remote) });
+
+          if (!refreshing) {
+            queueMicrotask(() =>
+              success(remote ? "Issue from the linked environment" : "Before refresh"),
+            );
+          } else if (remote && !remoteRefreshStarted) {
+            remoteRefreshStarted = true;
+            queueMicrotask(() =>
+              reply({
+                _tag: "Failure",
+                cause: [
+                  {
+                    _tag: "Fail",
+                    error: {
+                      _tag: "IssueOperationError",
+                      operation: "list",
+                      detail: "The linked environment could not list issues.",
+                    },
+                  },
+                ],
+              }),
+            );
+          } else if (remote) {
+            queueMicrotask(() => success("Issues recovered on the linked environment"));
+          } else if (!primaryRefreshStarted) {
+            primaryRefreshStarted = true;
+            // Only the original slow read is allowed to finish. Restarting it strands its result.
+            void slowRead.then(() => success("Updated issue from the slow environment"));
+          }
+        };
+      }, new URL(host).host);
+
+      await t3.open("/settings/connections");
+      await screen.getByRole("button", "Add environment").tap();
+      const dialog = screen.getByRole("dialog");
+      await dialog.getByPlaceholder("backend.example.com").fill(host);
+      await dialog.getByPlaceholder("PAIRCODE").fill(token);
+      await dialog.getByRole("button", "Add environment").tap();
+      await screen.getByRole("button", "More actions for Scenario").waitFor({ timeout: 60_000 });
+      await app.open("/issues");
+
+      await screen.getByText("Before refresh", { exact: true }).waitFor({ timeout: 60_000 });
+      await screen.getByText("Issue from the linked environment", { exact: true }).waitFor();
+      await browser.evaluate(() => {
+        (window as unknown as { armIssuesRefresh: () => void }).armIssuesRefresh();
+        return null;
+      });
+      await screen.getByRole("button", "Refresh issues", { exact: true }).tap();
+      await screen.getByText(/Showing the issues that loaded/).waitFor();
+      await screen.getByRole("button", "Retry", { exact: true }).tap();
+      await screen
+        .getByText("Issues recovered on the linked environment", { exact: true })
+        .waitFor();
+      await browser.evaluate(() => {
+        (window as unknown as { releaseSlowIssuesRead: () => void }).releaseSlowIssuesRead();
+        return null;
+      });
+      try {
+        await expect(
+          screen.getByText("Updated issue from the slow environment", { exact: true }),
+        ).toBeVisible();
+      } finally {
+        await app.screenshot("partial-issues-after-retry");
+      }
+    } finally {
+      await server.stop();
+    }
+  },
+);
pnpm scenarios:prove scripts/scenarios/issues-retry-keeps-pending-environment.e2e.ts --base main

Workaround

No response

Activity

  1. added
    vouch:trusted
    on Nov 18, 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