Skip to content

[codex] Preserve desktop update state read failures#3370

Open
juliusmarminge wants to merge 2 commits into
mainfrom
codex/desktop-update-state-error
Open

[codex] Preserve desktop update state read failures#3370
juliusmarminge wants to merge 2 commits into
mainfrom
codex/desktop-update-state-error

Conversation

@juliusmarminge

@juliusmarminge juliusmarminge commented Jun 20, 2026

Copy link
Copy Markdown
Member

Summary

  • replace the silent initial desktop update state fallback with a structured Schema error
  • retain the exact bridge rejection cause and final retry count
  • recover through tagged catch semantics so the update event listener remains active
  • verify retries, structured logging, cause forwarding, and listener recovery

Validation

  • vp test apps/web/src/state/desktopUpdate.test.ts
  • vp check (passes with existing warnings)
  • vp run typecheck

Note

Low Risk
Localized desktop update atom bootstrap and logging; behavior on success is unchanged and failure still falls back to null while keeping the listener active.

Overview
Replaces the silent initial getUpdateState failure path in createDesktopUpdateStateAtom with a DesktopUpdateStateReadError tagged error, three retries, and Effect.logError using structured fields (errorTag, attemptCount, stack) before continuing with null so the update listener stays subscribed.

Tests add afterEach mock restoration and assert three bridge read attempts, the exact log message, and that logged context does not leak raw error/cause payloads while later events still update atom state.

Reviewed by Cursor Bugbot for commit 775fe69. Bugbot is set up for automated code reviews on this repo. Configure here.

Note

Log errors when desktop update state read fails after 3 attempts

  • Wraps the initial desktop update state fetch in Effect.tryPromise, retrying up to 3 times (via INITIAL_STATE_READ_ATTEMPT_COUNT) before falling back to a null initial state.
  • Introduces DesktopUpdateStateReadError, a tagged error class that captures attemptCount and cause, replacing the previous silent orElseSucceed(null) fallback.
  • On final failure, logs the error tag, attempt count, and stack before proceeding, making read failures observable.
  • Adds test coverage in desktopUpdate.test.ts asserting the retry count, error shape, and logged context structure.

Macroscope summarized 775fe69.

Co-authored-by: codex <codex@users.noreply.github.com>
@coderabbitai

coderabbitai Bot commented Jun 20, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 3f71bc2e-51e2-4ca3-b31d-cd840bc6db11

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/desktop-update-state-error

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:M 30-99 changed lines (additions + deletions). labels Jun 20, 2026
@macroscopeapp

macroscopeapp Bot commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved

This PR adds error logging for desktop update state read failures without changing runtime behavior - failures still result in null being returned, but now with structured error logging. The changes are self-contained and well-tested.

You can customize Macroscope's approvability policy. Learn more.

macroscopeapp[bot]
macroscopeapp Bot previously approved these changes Jun 20, 2026
Co-authored-by: codex <codex@users.noreply.github.com>
@macroscopeapp macroscopeapp Bot dismissed their stale review June 20, 2026 17:17

Dismissing prior approval to re-evaluate 775fe69

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M 30-99 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant