[codex] Preserve client connection error causes#3242
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 |
ApprovabilityVerdict: Approved This PR adds You can customize Macroscope's approvability policy. Learn more. |
Summary
causewhen translating into connection classificationsManagedRelayRequestFailedError, use tag-directed retry handling, and inline a no-value proof-error field wrapperThe undeclared-status conversion is intentionally left for the SSH follow-up because its current
instanceofconsumer is being changed by #3206.Validation
vp checkvp run typecheckvp test packages/client-runtime/src/connection/errors.test.ts packages/client-runtime/src/authorization/remote.test.ts packages/client-runtime/src/authorization/layer.test.ts packages/client-runtime/src/rpc/session.test.ts packages/client-runtime/src/relay/managedRelay.test.ts packages/client-runtime/src/connection/onboarding.test.tsNote
Medium Risk
Touches authentication and connection error paths across relay and remote environment flows; behavior is mostly additive (cause preservation) but changes error shapes and messaging used during connect.
Overview
Connection failures now keep a structured
causeonConnectionBlockedErrorandConnectionTransientError, so relay, remote auth, DPoP, and RPC errors are not dropped when they are classified for the UI.Remote HTTP auth errors (
RemoteEnvironmentAuthFetchError, invalid JSON, timeout) are modeled withrequestUrl(and related fields) and user-facing messages that do not embed the underlying transport error string.Relay client HTTP failures go through
ManagedRelayRequestFailedError.fromHttpRequest; DPoP proof mapping nests the signer error ascause. Invalid-bearer retry usesEffect.catchTagsonManagedRelayRequestFailedErrorinstead of a broadcatch.Mappers in
connection/errors.tsand DPoP paths in authorization/session setcauseto the immediate failure (e.g. the relay request wrapper when a protected relay error is surfaced).New
connection/errors.test.tsasserts classification metadata and full cause chains, including that fetch messages stay free of sensitive transport text.Reviewed by Cursor Bugbot for commit b7ae7f0. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Preserve original error causes in client connection errors
causefield (typed asSchema.Defect) toConnectionBlockedErrorandConnectionTransientErrorin model.ts, so underlying errors are no longer silently discarded.mapManagedRelayError,mapRemoteEnvironmentError,mapInitialConfigError, and DPoP authorization helpers) to attach the originating error ascausewhen constructing connection errors.RemoteEnvironmentAuthFetchError,RemoteEnvironmentAuthInvalidJsonError, andRemoteEnvironmentAuthTimeoutErrorin http.ts to schema-based classes with structured fields; fetch error messages no longer embed the cause text.ManagedRelayRequestFailedError.fromHttpRequestfactory in managedRelay.ts to consistently populaterelayErrorandtraceIdfrom HTTP request errors.cause).Macroscope summarized b7ae7f0.