Skip to content

fix(server): handle JSON-RPC error responses without a message field#1247

Open
lopes-felipe wants to merge 2 commits intopingdotgg:mainfrom
lopes-felipe:fix/jsonrpc-error-handling
Open

fix(server): handle JSON-RPC error responses without a message field#1247
lopes-felipe wants to merge 2 commits intopingdotgg:mainfrom
lopes-felipe:fix/jsonrpc-error-handling

Conversation

@lopes-felipe
Copy link

@lopes-felipe lopes-felipe commented Mar 20, 2026

What Changed

handleResponse in codexAppServerManager.ts now checks for response.error instead of response.error?.message when deciding whether to reject a pending JSON-RPC request.

Why

The JsonRpcError type defines message as optional (message?: string). If the Codex app-server sends an error response that has a code but no message (or an empty string message), the old condition response.error?.message evaluates to falsy, causing the code to fall through to pending.resolve(response.result). This silently treats the error as a successful response with an undefined result, which can cause unpredictable failures downstream far from the actual source of the problem.

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • I included before/after screenshots for any UI changes
  • I included a video for animation/interaction changes

Note

Fix handleResponse to reject JSON-RPC error responses that lack a message field

Previously, a JSON-RPC error response without a message field would fall through to resolve the pending request instead of rejecting it. Now, any response containing an error object triggers a rejection, using error.message if present or falling back to "error code <code>" when only a code is available. Tests covering all three cases (success, error with message, error with code only) are added in codexAppServerManager.test.ts.

Macroscope summarized fb7f34f.

@coderabbitai
Copy link

coderabbitai bot commented Mar 20, 2026

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 9f6c4228-a73e-447f-b7ca-545d68d6c2ed

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Tip

CodeRabbit can use your project's `biome` configuration to improve the quality of JS/TS/CSS/JSON code reviews.

Add a configuration file to your project to customize how CodeRabbit runs biome.

@github-actions github-actions bot added size:M 30-99 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list. labels Mar 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M 30-99 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant