fix(client): fall back when HTTP snapshots fail#3863
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)
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. Comment |
ApprovabilityVerdict: 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. |
Summary
Validation
vp checkvp run typecheckvp test packages/client-runtime/src/state/shell-sync.test.ts packages/client-runtime/src/state/threads-sync.test.tsAddresses 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.tsandthreads.tsnowEffect.catchonsnapshotLoader.load, log a warning withsafeErrorLogAttributes, 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.ShellSnapshotLoaderandThreadSnapshotLoadernow exposeRemoteEnvironmentRequestErroronload. Newshell-syncandthreads-synctests 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
snapshotLoader.loadfails inshell.tsorthreads.ts, the error is now caught, a warning is logged, and the system continues withOption.noneinstead of failing the stream.subscribeShell/thread subscription to proceed withoutafterSequence, using the socket-provided snapshot as the base state.loadmethod's Effect error channel is explicitly typed asRemoteEnvironmentRequestErrorin bothshellSnapshotHttp.tsandthreadSnapshotHttp.ts.Macroscope summarized bdcfd6a.