[codex] Preserve terminal preview link failure context#3367
[codex] Preserve terminal preview link failure context#3367juliusmarminge wants to merge 2 commits into
Conversation
Co-authored-by: codex <codex@users.noreply.github.com>
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
Bugbot Autofix prepared a fix for the issue found in the latest run.
- ✅ Fixed: Interrupt-only preview failures logged incorrectly
- Added an isAtomCommandInterrupted guard so interrupt-only failures silently return without logging TerminalLinkPreviewOpenError or triggering the browser fallback, matching the pattern used in ChatMarkdown.tsx and other files.
Or push these changes by commenting:
@cursor push a1e1c166b8
Preview (a1e1c166b8)
diff --git a/apps/web/src/components/preview/openTerminalLinkInPreview.ts b/apps/web/src/components/preview/openTerminalLinkInPreview.ts
--- a/apps/web/src/components/preview/openTerminalLinkInPreview.ts
+++ b/apps/web/src/components/preview/openTerminalLinkInPreview.ts
@@ -2,6 +2,8 @@
import { isPreviewableUrl } from "@t3tools/shared/preview";
import * as Schema from "effect/Schema";
+import { isAtomCommandInterrupted } from "@t3tools/client-runtime/state/runtime";
+
import type { OpenPreviewMutation } from "~/browser/openFileInPreview";
import { applyPreviewServerSnapshot, isPreviewSupportedInRuntime } from "~/previewStateStore";
import { useRightPanelStore } from "~/rightPanelStore";
@@ -85,13 +87,15 @@
input: { threadId: input.threadRef.threadId, url: input.url },
});
if (result._tag === "Failure") {
- console.error(
- new TerminalLinkPreviewOpenError({
- ...errorContext,
- cause: result.cause,
- }),
- );
- input.fallbackToBrowser();
+ if (!isAtomCommandInterrupted(result)) {
+ console.error(
+ new TerminalLinkPreviewOpenError({
+ ...errorContext,
+ cause: result.cause,
+ }),
+ );
+ input.fallbackToBrowser();
+ }
return;
}
applyPreviewServerSnapshot(input.threadRef, result.value);You can send follow-ups to the cloud agent here.
Reviewed by Cursor Bugbot for commit a0ac289. Configure here.
ApprovabilityVerdict: Approved This PR adds structured error classes and logging for terminal preview link failures without changing the existing fallback behavior. The changes are purely observability improvements - errors are now logged with context (thread ID, origin) before the same fallback-to-browser path executes. You can customize Macroscope's approvability policy. Learn more. |
Co-authored-by: codex <codex@users.noreply.github.com>


Summary
Validation
vp test apps/web/src/components/preview/openTerminalLinkInPreview.test.tsvp check(passes with existing warnings)vp run typecheckNote
Low Risk
Observability-only change in preview link handling with preserved fallback behavior; interrupt handling slightly changes UX by not opening the browser.
Overview
Terminal link preview no longer swallows failures when showing the context menu or opening preview. Both paths now
console.errortagged Effect schema errors (TerminalLinkContextMenuShowError,TerminalLinkPreviewOpenError) that carryenvironmentId,threadId, the fullcause, andtargetOriginderived fromURL.originso messages avoid path/query secrets.User-facing fallback to the external browser is unchanged for real failures. Interrupted preview commands are treated differently: no error log and no browser fallback.
New unit tests cover context-menu errors, combined preview failure causes, sanitized origins, and the interrupt path.
Reviewed by Cursor Bugbot for commit 799e005. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Preserve terminal preview link failure context with structured error reporting
TerminalLinkContextMenuShowErrorandTerminalLinkPreviewOpenError, each carryingenvironmentId,threadId,targetOrigin(sanitized to URL origin), and the original failure cause.openTerminalLinkInPreviewto catch context menu and preview open failures, log the appropriate structured error viaconsole.error, and callfallbackToBrowser.isAtomCommandInterrupted), the function returns silently without logging or falling back to the browser.Macroscope summarized 799e005.