[codex] Structure relay environment connector errors#3331
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)
Comment |
ApprovabilityVerdict: Approved This PR adds structured diagnostic fields to error classes and redacts sensitive URL components (credentials, paths, query params) from logs and telemetry. The underlying verification and connection logic remains unchanged - the refactoring improves error messages without altering behavior. You can customize Macroscope's approvability policy. Learn more. |
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
07aacdc to
de7427d
Compare
Dismissing prior approval to re-evaluate de7427d
Co-authored-by: codex <codex@users.noreply.github.com>
Dismissing prior approval to re-evaluate 86ee1b0
fddc7a2
into
codex/redact-dpop-request-target
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Summary
Validation
vp test infra/relay/src/environments/EnvironmentConnector.test.ts --no-cachevp checkvp run typecheckvpr typecheckOverlap audit
Note
Medium Risk
Changes authentication-adjacent connect/mint error shapes and observability; consumers matching on old fields or message strings must update, but wire protocol behavior is largely unchanged aside from richer failures.
Overview
Relay
EnvironmentConnectormint/health failures now expose structured tagged errors instead of sparse booleans and raw endpoint strings.EnvironmentMintRequestFailed,EnvironmentMintResponseInvalid, andEnvironmentMintRequestTimedOutgainuserId, optionaldeviceId, request stage or validation reason, and redactedhttpBaseUrlfields (length, protocol, hostname) viagetUrlDiagnosticsandfromEndpointhelpers. JWT verification paths return discriminated outcomes so invalid responses carry reasons likeproof_verification_failedand optional underlying cause; request failures are attributed to stages such assend_request.Telemetry and logs for managed-endpoint resolution and health warnings record the same redacted URL diagnostics rather than full URLs, reducing credential/path leakage in traces and serialized errors.
Tests assert secret redaction in errors and span attributes and assert structured failure shapes for proof mismatch, HTTP 500, and timeouts.
Reviewed by Cursor Bugbot for commit 86ee1b0. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Structure relay environment connector errors with redacted URL diagnostics and typed reasons
userId,deviceId,stage, and redactedhttpBaseUrldiagnostics (input length, protocol, hostname) toEnvironmentMintRequestFailed,EnvironmentMintRequestTimedOut, andEnvironmentMintResponseInvaliderror classes in EnvironmentConnector.ts.urlDiagnosticSpanAttributesandhttpBaseUrlDiagnosticFieldshelpers.verifyWithEnvironmentKeys,verifyEnvironmentResponse, andverifyEnvironmentHealthResponseto return discriminated results with structured reason codes and optional causes instead of booleans orOptionvalues.static fromEndpointconstructors to all three error classes to enforce consistent redaction at construction sites.Macroscope summarized 86ee1b0.