[codex] Report preview action failures#3351
Conversation
|
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: Open session failures not reported
- Added an explicit check for
result._tag === "Failure"after awaitingopenPreviewSession, callingreportPreviewActionFailurewith the squashed cause so open-session failures get structured[preview]diagnostics instead of silently resolving.
- Added an explicit check for
Or push these changes by commenting:
@cursor push 2d48ae75fc
Preview (2d48ae75fc)
diff --git a/apps/web/src/components/preview/PreviewView.tsx b/apps/web/src/components/preview/PreviewView.tsx
--- a/apps/web/src/components/preview/PreviewView.tsx
+++ b/apps/web/src/components/preview/PreviewView.tsx
@@ -4,6 +4,7 @@
import { type ScopedThreadRef } from "@t3tools/contracts";
import { useCallback, useEffect, useRef, useState } from "react";
+import { squashAtomCommandFailure } from "@t3tools/client-runtime/state/runtime";
import { useComposerDraftStore } from "~/composerDraftStore";
import { previewAnnotationScreenshotFile } from "~/lib/previewAnnotation";
import { ensureLocalApi } from "~/localApi";
@@ -109,11 +110,17 @@
rememberPreviewUrl(threadRef, resolvedUrl);
} else {
operation = "open-session";
- await openPreviewSession({
+ const result = await openPreviewSession({
openPreview: open,
threadRef,
url: resolvedUrl,
});
+ if (result._tag === "Failure") {
+ reportPreviewActionFailure(
+ { operation, threadKey, url: targetUrl },
+ squashAtomCommandFailure(result),
+ );
+ }
}
} catch (cause) {
reportPreviewActionFailure(You can send follow-ups to the cloud agent here.
Reviewed by Cursor Bugbot for commit df0a48f. Configure here.
ApprovabilityVerdict: Approved This PR replaces silent error swallowing with console.error logging for preview action failures. No runtime behavior changes to actual functionality - purely a debugging/observability improvement with tests and careful handling to avoid logging sensitive URL data. You can customize Macroscope's approvability policy. Learn more. |
Dismissing prior approval to re-evaluate 3280e2c
Co-authored-by: codex <codex@users.noreply.github.com>
Dismissing prior approval to re-evaluate 260cf6d
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
260cf6d to
8fe6259
Compare
Dismissing prior approval to re-evaluate 8fe6259
b87e64a to
3167aeb
Compare
303b165
into
codex/redact-dpop-request-target
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>


Summary
Stack dependency
@t3tools/shared/urlDiagnostics.Validation
vp test run apps/web/src/components/preview/reportPreviewActionFailure.test.ts(1 test)vp check(passes with 20 pre-existing warnings)vp run typecheckNote
Low Risk
Observability-only change: user-visible behavior and toasts are largely unchanged except more console noise on failures. URL redaction reduces accidental credential leakage in logs.
Overview
Preview bridge and related failures are no longer swallowed with empty
.catch()handlers. A sharedreportPreviewActionFailurehelper logs[preview] action failedtoconsole.errorwith structured context (operation,threadKey,tabId, artifact/annotation ids where relevant) and passes through the original cause.PreviewViewandPreviewMoreMenunow route navigation, zoom, history, refresh, DevTools, cache/cookies, recordings, screenshots, clipboard, element picker, and open-external errors through that helper. URL-related context usespreviewUrlFailureContext, backed by newgetUrlDiagnosticsin@t3tools/shared/urlDiagnostics, so logs keep hostname, protocol, and length only—not full URLs, credentials, or query tokens.openPreviewSessionatom failures are reported when not interrupted; picker failures stay silent in the UI but are logged.Shared also adds
redactDpopRequestTarget(scheme/host/path only) with tests; it is not wired into callers in this PR.Reviewed by Cursor Bugbot for commit 8fe6259. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Report preview action failures via console.error with sanitized context
reportPreviewActionFailurein reportPreviewActionFailure.ts that logs a structuredconsole.errorwith operation name and context, replacing silent error swallowing across preview components.previewUrlFailureContextto derive sanitized URL diagnostics (hostname, protocol, input length) without leaking raw URLs, credentials, or query params.console.errorentries with structured metadata.Macroscope summarized 8fe6259.