[codex] Structure client RPC unavailable errors#3260
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 |
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.
| override get message(): string { | ||
| const method = this.method === undefined ? "" : ` for RPC method ${this.method}`; | ||
| return `${this.environmentLabel} is not connected${method}.`; | ||
| } |
There was a problem hiding this comment.
RPC disconnect breaks transport matching
Medium Severity
The EnvironmentRpcUnavailableError message now includes the RPC method, which breaks isTransportConnectionErrorMessage's heuristic for identifying transport connection issues. This causes mobile outbox messages to be incorrectly classified as non-retryable, potentially leading to dropped messages.
Reviewed by Cursor Bugbot for commit c840111. Configure here.
ApprovabilityVerdict: Needs human review An unresolved review comment identifies that the new error message format may break You can customize Macroscope's approvability policy. Learn more. |



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
Low Risk
Localized error-shape and Effect catch API changes in client-runtime RPC and registry; no auth or persistence changes.
Overview
EnvironmentRpcUnavailableErrorno longer carries a freeformmessage. It now exposesenvironmentId,environmentLabel, and an optionalmethod, with the user-facing text built from those fields (including the RPC method when unary/stream calls fail).Disconnected unary and stream-command RPC paths pass the requested method into session resolution so failures are attributable to a specific call. Registry cleanup paths switch from
catchTagtocatchTagsfor expectedEnvironmentNotRegisteredErrorhandling during start, relay removal, and retry.Adds a test that a disconnected unary
requestreturns the structured error and expected message.Reviewed by Cursor Bugbot for commit c840111. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Structure
EnvironmentRpcUnavailableErrorto include environment label and RPC methodEnvironmentRpcUnavailableErrornow carriesenvironmentId,environmentLabel, and an optionalmethodfield instead of a static message string.messagegetter dynamically formats as"{environmentLabel} is not connected", appending" for RPC method {method}"when a method is present.EnvironmentRpc.currentSession,request, andrunStreamin client.ts now pass the RPC tag through so disconnection errors include the failing method name.EnvironmentRpcUnavailableErrorwill see a different error shape —messageis no longer a schema field andenvironmentLabel/methodare new fields.Macroscope summarized c840111.