[codex] Structure cloud HTTP boundary errors#3246
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 refactors error handling to use explicit tag-based matching instead of type predicates, and introduces structured error classes that intentionally redact sensitive upstream information from error messages. The changes are defensive, well-tested, and don't alter business logic. You can customize Macroscope's approvability policy. Learn more. |
Stacked on #3243.
Summary
Validation
Note
Medium Risk
Touches cloud link reconciliation and credential/health handlers where mis-mapped catchTags could change which errors surface to clients, though behavior is largely preserved with safer messaging.
Overview
Introduces structured Schema errors for T3 Connect relay boundaries:
CloudRelayConfigurationErrorfor invalidT3CODE_RELAY_URL, andCloudRelayRequestErrorwith operation, phase, method, URL, optional status, and full cause. Publicmessagestrings are fixed templates and no longer include upstream/cause text; failures are still logged with the full cause viafailEnvironmentCloudInternalError.Relay client calls (
relayClientRequest) map encode/send/status/decode failures throughCloudRelayRequestError.fromClientFailureinstead ofString(cause)in 500 responses. Link reconciliation and other cloud handlers now use explicitEffect.catchTagsfor secret-store, auth, CLI token, relay config/request, and schema errors rather than broadcatchIfpredicates.Tests add a
reconcileWithharness, assertions that relay errors redact sensitive transport/upstream details, and updated Effect HTTP namespace imports.Reviewed by Cursor Bugbot for commit 6c12fe1. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Structure cloud HTTP boundary errors with typed
CloudRelayRequestErrorandCloudRelayConfigurationErrorCloudRelayRequestErrorin http.ts to classify relay client failures by operation and phase (encode-request,send-request,check-response-status,decode-response), producing stable structured messages that do not leak upstream cause details.CloudRelayConfigurationErrorfor invalid relay URL config, replacing a generic internal error with a fixed guidance message referencingT3CODE_RELAY_URL.catchIf/SecretStoreErrorcatches across all cloud handlers with granularcatchTagstargeting specific error variants, so unhandled error types now propagate instead of being silently coerced.consumeCloudReplayGuardsto treat onlySecretStorePersistErroras an "already exists" signal; other secret store errors now propagate.Macroscope summarized 6c12fe1.