[codex] Structure client RPC unavailable errors - #3260
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 |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
Bugbot Autofix prepared a fix for the issue found in the latest run.
- ✅ Fixed: RPC disconnect breaks transport matching
- Changed the regex pattern from
/\bis not connected\.$/i(end-of-string anchored) to/\bis not connected\b/i(word-boundary only) so it matches both the original message and the new method-suffixed format.
- Changed the regex pattern from
Or push these changes by commenting:
@cursor push dbd63952d5
Preview (dbd63952d5)
diff --git a/packages/client-runtime/src/errors/transport.test.ts b/packages/client-runtime/src/errors/transport.test.ts
--- a/packages/client-runtime/src/errors/transport.test.ts
+++ b/packages/client-runtime/src/errors/transport.test.ts
@@ -27,6 +27,11 @@
),
).toBe(true);
expect(isTransportConnectionErrorMessage("Test environment is not connected.")).toBe(true);
+ expect(
+ isTransportConnectionErrorMessage(
+ "Test environment is not connected for RPC method sendMessage.",
+ ),
+ ).toBe(true);
expect(isTransportConnectionErrorMessage("ClientProtocolError: socket closed")).toBe(true);
});
diff --git a/packages/client-runtime/src/errors/transport.ts b/packages/client-runtime/src/errors/transport.ts
--- a/packages/client-runtime/src/errors/transport.ts
+++ b/packages/client-runtime/src/errors/transport.ts
@@ -3,7 +3,7 @@
/\bSocketOpenError\b/i,
/\bSocket is not connected\b/i,
/Unable to connect to the T3 server WebSocket\./i,
- /\bis not connected\.$/i,
+ /\bis not connected\b/i,
/\bdisconnected\.$/i,
/\bcould not establish a WebSocket connection\.$/i,
/\bClientProtocolError\b/i,You can send follow-ups to the cloud agent here.
Reviewed by Cursor Bugbot for commit c840111. Configure here.
ApprovabilityVerdict: Approved Straightforward error handling improvement that restructures EnvironmentRpcUnavailableError with explicit fields and adds retry logic for this error type. Changes are self-contained, covered by tests, and low risk. You can customize Macroscope's approvability policy. Learn more. |
4d9e86a to
d16f379
Compare
ff04819 to
7ab7e1b
Compare
Dismissing prior approval to re-evaluate 7ab7e1b
d16f379 to
b39a73f
Compare
7ab7e1b to
f9aa01d
Compare
Dismissing prior approval to re-evaluate 05f1e8c
Dismissing prior approval to re-evaluate 05f1e8c
b87e64a to
3167aeb
Compare
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>
23df18d to
0c5fe3c
Compare
Dismissing prior approval to re-evaluate 0c5fe3c
b8a7cba
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>
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
catchTagssemantics for expected missing-registration cleanup pathsValidation
vp test packages/client-runtime/src/rpc/client.test.ts packages/client-runtime/src/connection/registry.test.tsvp check(passes with existing unrelated warnings)vp run typecheckStack
Note
Medium Risk
Changes error shape and retry behavior for queued mobile sends when the environment is disconnected; RPC clients must handle the new error fields, but scope is limited to client-runtime and mobile outbox.
Overview
EnvironmentRpcUnavailableErroris now a tagged schema error withenvironmentId,environmentLabel, and optionalmethodinstead of a free-form message; the user-facing text is computed from those fields. Unaryrequestand streamrunStreampass the RPC tag into session resolution so disconnected calls report which method was attempted.isEnvironmentRpcUnavailableErroris exported for callers.Mobile thread outbox treats this error as retriable alongside existing transport/transient connection failures, with a focused unit test.
Connection error tests are trimmed to redacted URL diagnostics for remote auth fetch/undeclared status (managed-relay mapping tests removed from this file). Durable subscription transport-loss logging drops
Cause.prettyin favor oferrorTag/reasonCountmetadata.Reviewed by Cursor Bugbot for commit 0c5fe3c. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Structure client RPC unavailable errors with environment label and method context
EnvironmentRpcUnavailableErrorin client.ts gainsenvironmentLabeland optionalmethodfields, with a computedmessagegetter combining both.isEnvironmentRpcUnavailableErrortype guard for reliable error detection by callers.currentSession,request, andrunStreamnow pass the method name intoEnvironmentRpcUnavailableErrorso errors identify the specific RPC call that failed.shouldRetryThreadOutboxDeliveryin thread-outbox-model.ts now returnstrueforEnvironmentRpcUnavailableError, treating disconnected environments as retryable.subscribereplacesCause.pretty(cause)with structurederrorTagandreasonCountfields.Macroscope summarized 0c5fe3c.