[codex] structure desktop preview failures#3244
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: Timeline omits nested failure messages
- Restored cause-unwrapping logic in finalizeControlAction so that when a PreviewOperationError occurs, the timeline records the underlying error.cause.message instead of the generic wrapper message.
Or push these changes by commenting:
@cursor push 012e32aa35
Preview (012e32aa35)
diff --git a/apps/desktop/src/preview/Manager.ts b/apps/desktop/src/preview/Manager.ts
--- a/apps/desktop/src/preview/Manager.ts
+++ b/apps/desktop/src/preview/Manager.ts
@@ -851,11 +851,13 @@
} else {
const error = Option.getOrNull(Cause.findErrorOption(exit.cause));
const interrupted = isPreviewAutomationControlInterruptedError(error);
+ const underlying =
+ isPreviewOperationError(error) && error.cause instanceof Error ? error.cause : error;
yield* replaceAction(tabId, {
...actionEvent,
status: interrupted ? "interrupted" : "failed",
completedAt,
- error: error instanceof Error ? error.message : String(error),
+ error: underlying instanceof Error ? underlying.message : String(underlying),
});
}
const tabs = yield* SynchronizedRef.get(tabsRef);
@@ -2520,6 +2522,7 @@
export type PreviewManagerError = typeof PreviewManagerError.Type;
export const isPreviewManagerError = Schema.is(PreviewManagerError);
+export const isPreviewOperationError = Schema.is(PreviewOperationError);
export const isPreviewAutomationControlInterruptedError = Schema.is(
PreviewAutomationControlInterruptedError,
);You can send follow-ups to the cloud agent here.
Reviewed by Cursor Bugbot for commit d784409. Configure here.
ApprovabilityVerdict: Approved This PR refactors error handling to use structured, typed error classes instead of generic Error objects. The runtime behavior is unchanged; only error construction and message formatting improved. Tests updated accordingly. You can customize Macroscope's approvability policy. Learn more. |
Co-authored-by: codex <codex@users.noreply.github.com>
Dismissing prior approval to re-evaluate 6168586
Co-authored-by: codex <codex@users.noreply.github.com>
Dismissing prior approval to re-evaluate 2431a34


Summary
Validation
Note
Medium Risk
Large refactor across preview automation, CDP control, and artifact I/O error paths; behavior should be equivalent but any caller that matched on nested
causeor generic tags needs to use the new union and type guards.Overview
Desktop preview and Playwright injection now surface structured Effect Schema tagged errors instead of a single generic wrapper and ad-hoc
Errorobjects withname/detail.Preview manager: The old
PreviewManagerError+automationError/fail()pattern is replaced by a union of specific classes (tab/webview missing, artifact path outside directory, image load, recording conflict, DevTools/debugger conflicts, automation evaluation/selector/target/viewport/timeout/interrupted, etc.). Low-level failures usePreviewOperationErrorwithoperationplus optionaltabId,webContentsId, andartifactPath, while keeping the realcauseonly at that boundary. Automation action timelines pull user-facing detail viaPreviewOperationError.toTimelineMessage, separate from each error’s structuredmessage. Helpersattempt/attemptPromise/encodeJsonnow take aPreviewOperationContextinstead of a bare operation string.Playwright runtime: The monolithic
PlaywrightInjectedRuntimeErroris split into tagged errors (package resolve, bundle read, marker/terminator missing, evaluation, validation, options encode).extractPlaywrightInjectedRuntimeSourceis exported and tested for cause-free vs cause-bearing cases.Tests assert
_tag, context fields, and that domain errors are not wrapped in an extracause.Reviewed by Cursor Bugbot for commit 2431a34. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Replace generic preview errors with structured, tagged error classes in desktop preview
PreviewOperationError,PreviewAutomationControlInterruptedError,PreviewArtifactImageLoadError) that carry structured metadata likeoperation,tabId,webContentsId, andartifactPathinstead of wrapping genericErrorobjects.PlaywrightInjectedRuntimeErrorwith specific typed errors (PlaywrightSourceMarkerNotFoundError,PlaywrightSourceEvaluationError,PlaywrightSourceValidationError, etc.).PreviewOperationError.messageexcludes the underlying cause; the cause is accessible separately viatoTimelineMessage.error.causeor checksinstanceof Errorwithout checking the error name.Macroscope summarized 2431a34.