The best way to control Claude Code, Codex and more from any computer or phone
fix(web): a failed review guide keeps Try again reachable (#26073)
Co-authored-by: maria-rcks <maria@kuuro.net>
NotAnNvidiaFan committed
Oct 30, 2026 at 20:37 UTC
e123ac644eefeecee8931da6557b3c906fde70d4
2 files changed
+113
-10
apps/web/src/components/pullRequest/PullRequestGuideTab.browser.test.tsx
new
+75
@@ -0,0 +1,75 @@
1
+import { EnvironmentId, ProjectId, type PullRequestRef } from "@t3tools/contracts";
2
+import { expect, it, vi } from "vite-plus/test";
3
+import { userEvent } from "vite-plus/test/browser";
4
+
5
+vi.mock(import("./guide/useReviewGuideWriter"), () => ({ useReviewGuideWriter: vi.fn() }));
6
+
7
+import { render } from "../../../test/render";
8
+import { useReviewGuideWriter } from "./guide/useReviewGuideWriter";
9
+import { PullRequestGuideTab } from "./PullRequestGuideTab";
10
+
11
+const reference: PullRequestRef = {
12
+ projectId: ProjectId.make("project"),
13
+ repository: "owner/repo",
14
+ number: 1,
15
+};
16
+
17
+const verboseFailure = [
18
+ "Codex CLI command failed: OpenAI Codex v0.164.0",
19
+ ...Array.from({ length: 200 }, (_, line) => `prompt line ${line}: read the change in order`),
20
+ "ERROR: provider auth command `sh` timed out after 5000 ms",
21
+].join("\n");
22
+
23
+it("keeps Try again inside a short panel when a failed guide has long diagnostics", async () => {
24
+ const write = vi.fn(async () => {});
25
+ vi.mocked(useReviewGuideWriter).mockReturnValue({
26
+ query: { isPending: false, error: null } as never,
27
+ data: {
28
+ guide: null,
29
+ run: {
30
+ _tag: "Failed",
31
+ headSha: "head",
32
+ failedAt: "2026-10-27T16:37:47.661Z",
33
+ detail: verboseFailure,
34
+ },
35
+ currentHeadSha: "head",
36
+ },
37
+ running: false,
38
+ canWrite: true,
39
+ write,
40
+ });
41
+ const panel = document.createElement("div");
42
+ panel.style.cssText = "position: relative; width: 480px; height: 360px; overflow: hidden";
43
+ const tab = document.createElement("div");
44
+ tab.style.cssText = "position: absolute; inset: 0";
45
+ panel.append(tab);
46
+ document.body.append(panel);
47
+ using _panel = { [Symbol.dispose]: () => panel.remove() };
48
+
49
+ await using screen = await render(
50
+ <PullRequestGuideTab
51
+ environmentId={EnvironmentId.make("environment")}
52
+ reference={reference}
53
+ title="Test pull request"
54
+ workspaceRoot="/workspace"
55
+ active
56
+ canComment={false}
57
+ rangeComments={false}
58
+ onAskAboutLines={null}
59
+ onAskAboutStop={null}
60
+ onFinishReview={null}
61
+ onOpenFile={() => {}}
62
+ />,
63
+ { container: tab },
64
+ );
65
+
66
+ const retry = screen.getByRole("button", { name: "Try again" });
67
+ await expect.element(retry).toBeVisible();
68
+ const panelBox = panel.getBoundingClientRect();
69
+ const retryBox = retry.element().getBoundingClientRect();
70
+ expect(retryBox.top).toBeGreaterThanOrEqual(panelBox.top);
71
+ expect(retryBox.bottom).toBeLessThanOrEqual(panelBox.bottom);
72
+
73
+ await userEvent.click(retry);
74
+ expect(write).toHaveBeenCalledOnce();
75
+});
apps/web/src/components/pullRequest/PullRequestGuideTab.tsx
+38
-10
@@ -104,18 +104,24 @@ export function PullRequestGuideTab({
104
);
105
}
106
return (
107
- <div className="flex min-h-48 flex-col items-center justify-center gap-2 px-4 py-10 text-center">
107
+ <div className="scrollbar-gutter-both flex h-full flex-col items-center justify-center-safe gap-2 overflow-y-auto px-4 py-10 text-center">
108
<p className="text-sm font-medium text-foreground">
109
- {running ? "Writing a review guide" : "No review guide yet"}
109
+ {running
110
+ ? "Writing a review guide"
111
+ : failure === null
112
+ ? "No review guide yet"
113
+ : "Could not write a review guide"}
114
</p>
115
<p className="max-w-md text-xs text-muted-foreground">
112
- {failure ??
113
- query.error ??
114
- (running
115
- ? "An agent is reading the change. A large one takes a few minutes. You can leave; you will be told when it is ready."
116
- : "A guide is a tour of the change: stops through the code in reading order, with the calls only a maintainer can make.")}
116
+ {running
117
+ ? "An agent is reading the change. A large one takes a few minutes. You can leave; you will be told when it is ready."
118
+ : failure === null
119
+ ? (query.error ??
120
+ "A guide is a tour of the change: stops through the code in reading order, with the calls only a maintainer can make.")
121
+ : FAILURE_HINT}
122
</p>
123
{writeButton(failure === null ? "Write guide" : "Try again", "sm")}
124
+ {failure === null || running ? null : <FailureDetails detail={failure} />}
125
</div>
126
);
127
}
@@ -125,9 +131,16 @@ export function PullRequestGuideTab({
131
<Alert variant={running ? "info" : "warning"}>
132
{running ? <Spinner /> : <TriangleAlertIcon />}
133
<AlertDescription>
128
- {running
129
- ? "Rewriting this guide. You will be told when the new one is ready."
130
- : (failure ?? "Written before the latest push.")}
134
+ {running ? (
135
+ "Rewriting this guide. You will be told when the new one is ready."
136
+ ) : failure === null ? (
137
+ "Written before the latest push."
138
+ ) : (
139
+ <>
140
+ {`Could not rewrite this guide. ${FAILURE_HINT}`}
141
+ <FailureDetails detail={failure} />
142
+ </>
143
+ )}
144
</AlertDescription>
145
{!running && canWrite ? <AlertAction>{writeButton("Rewrite", "xs")}</AlertAction> : null}
146
</Alert>
@@ -156,3 +169,18 @@ export function PullRequestGuideTab({
169
</GuideProseContext>
170
);
171
}
172
+
173
+const FAILURE_HINT = "Check the review guide model in Settings → Source control.";
174
+
175
+function FailureDetails({ detail }: { detail: string }) {
176
+ return (
177
+ <details className="w-full max-w-lg text-xs text-muted-foreground">
178
+ <summary className="cursor-pointer rounded-sm -outline-offset-2 hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring">
179
+ Technical details
180
+ </summary>
181
+ <pre className="scrollbar-gutter-both mt-2 max-h-40 overflow-auto whitespace-pre-wrap break-words rounded-lg border border-border bg-muted/40 p-3 text-left font-mono text-xs">
182
+ {detail}
183
+ </pre>
184
+ </details>
185
+ );
186
+}