Fix: Codex on Cursor - perf_metrics crash and missing SSE event prefix#235
Closed
rodrigorodriguescosta wants to merge 1 commit intodecolua:masterfrom
Closed
Conversation
- formatSSE: emit event: prefix for openai-responses flat objects (.type) so Cursor receives proper SSE events instead of raw data: lines - cleanUsagePayload: remove perf_metrics regardless of value (not just null) fixing "Cannot read properties of null (reading 'perf_metrics')" - stream.js passthrough: strip perf_metrics from usage before forwarding Fixes decolua#223 Made-with: Cursor
66375bf to
f9d8bab
Compare
Contributor
Author
|
this PR resolves this issue #223 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
event:prefix for openai-responses flat objects informatSSEso Cursor receives proper SSE events instead of rawdata:lines.perf_metricsfrom usage payload regardless of value (not only when null), fixing "Cannot read properties of null (reading 'perf_metrics')".perf_metricsin passthrough mode instream.jsbefore forwarding.Problem
When using Codex (OpenAI provider) in Cursor IDE, the UI could crash with
Cannot read properties of null (reading 'perf_metrics'). The Codex API returnsusage.perf_metrics: nullin streamed responses; clients that access this field without null checks fail. Additionally, when source and target format are both openai-responses, the stream was emitted withoutevent:prefix, breaking clients that rely on it.Files changed
open-sse/utils/streamHelpers.js—cleanUsagePayloadandformatSSE(event prefix for response.* types)open-sse/utils/stream.js— passthrough: stripperf_metricsfrom usage/response.usageHow to test
Fixes #223
Made with Cursor