Skip to content

fix(client): fall back when HTTP snapshots fail#3863

Open
PixPMusic wants to merge 2 commits into
pingdotgg:t3code/codex-turn-mappingfrom
PixPMusic:pixpmusic/fix-snapshot-fallback
Open

fix(client): fall back when HTTP snapshots fail#3863
PixPMusic wants to merge 2 commits into
pingdotgg:t3code/codex-turn-mappingfrom
PixPMusic:pixpmusic/fix-snapshot-fallback

Conversation

@PixPMusic

@PixPMusic PixPMusic commented Jul 10, 2026

Copy link
Copy Markdown

Summary

  • recover cold-cache HTTP snapshot failures without aborting synchronization
  • continue into the WebSocket subscription and use its embedded shell or thread snapshot
  • cover both environment-shell and thread-detail bootstrap paths

Validation

  • vp check
  • vp run typecheck
  • vp test packages/client-runtime/src/state/shell-sync.test.ts packages/client-runtime/src/state/threads-sync.test.ts

Addresses review feedback on #2829.


Note

Medium Risk
Touches environment shell and thread synchronization bootstrap paths, but only changes failure handling and leaves the successful HTTP-first path intact.

Overview
Cold-cache bootstrap no longer aborts when the HTTP shell or thread snapshot request fails. shell.ts and threads.ts now Effect.catch on snapshotLoader.load, log a warning with safeErrorLogAttributes, and treat the result as no HTTP base snapshot so sync continues on the WebSocket stream.

With no base snapshot, subscriptions start without afterSequence, so the first socket snapshot frame seeds live state instead of resuming from a missing HTTP sequence.

ShellSnapshotLoader and ThreadSnapshotLoader now expose RemoteEnvironmentRequestError on load. New shell-sync and threads-sync tests assert HTTP failure still reaches live state from the socket snapshot.

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

Note

Fall back to WebSocket snapshot when HTTP snapshot load fails in shell and thread state

  • When snapshotLoader.load fails in shell.ts or threads.ts, the error is now caught, a warning is logged, and the system continues with Option.none instead of failing the stream.
  • This causes subscribeShell/thread subscription to proceed without afterSequence, using the socket-provided snapshot as the base state.
  • The load method's Effect error channel is explicitly typed as RemoteEnvironmentRequestError in both shellSnapshotHttp.ts and threadSnapshotHttp.ts.
  • Behavioral Change: HTTP snapshot failures no longer propagate as stream errors; they silently degrade to socket-only snapshots with a warning log.

Macroscope summarized bdcfd6a.

@coderabbitai

coderabbitai Bot commented Jul 10, 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: 5be13e40-7391-40e6-b578-4dc4e823750a

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

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@github-actions github-actions Bot added size:S 10-29 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list. labels Jul 10, 2026
Comment thread packages/client-runtime/src/state/shell.ts Outdated
@macroscopeapp

macroscopeapp Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved

This PR adds graceful error handling for HTTP snapshot loading failures, falling back to socket snapshots with warning logs. The changes are self-contained defensive improvements with comprehensive test coverage (~95 lines of tests), affecting only error scenarios.

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

@github-actions github-actions Bot added size:M 30-99 changed lines (additions + deletions). and removed size:S 10-29 changed lines (additions + deletions). labels Jul 10, 2026
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:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant