When selecting the AI provider as OpenAI Codex (Subscription), OpenAlice returns:
[Codex API error: Cannot read properties of undefined (reading 'map')]
Observed stack/log points to the SDK stream finalizer:
OpenAIError: Cannot read properties of undefined (reading 'map')
caused by: TypeError: Cannot read properties of undefined (reading 'map')
at maybeParseResponse (.../openai/src/lib/ResponsesParser.ts:37:31)
at finalizeResponse (.../openai/src/lib/responses/ResponseStream.ts:367:10)
Likely cause: the ChatGPT Codex subscription endpoint sometimes completes the stream with a response.completed payload that does not include the response.output shape expected by client.responses.stream(). The text deltas have already streamed correctly, but the SDK helper crashes during final response parsing.
Expected behavior:
- Codex subscription streaming should not fail after completion if text deltas were received.
- Real API errors should still be surfaced clearly.
Suggested fix:
- Avoid client.responses.stream() for the Codex subscription path.
- Use raw streaming via:
await client.responses.create({
model,
instructions,
input,
tools,
store: false,
stream: true,
})
- Iterate raw stream events directly.
- Explicitly handle error, response.failed, and response.incomplete events.
Environment:
When selecting the AI provider as OpenAI Codex (Subscription), OpenAlice returns:
[Codex API error: Cannot read properties of undefined (reading 'map')]
Observed stack/log points to the SDK stream finalizer:
OpenAIError: Cannot read properties of undefined (reading 'map')
caused by: TypeError: Cannot read properties of undefined (reading 'map')
at maybeParseResponse (.../openai/src/lib/ResponsesParser.ts:37:31)
at finalizeResponse (.../openai/src/lib/responses/ResponseStream.ts:367:10)
Likely cause: the ChatGPT Codex subscription endpoint sometimes completes the stream with a response.completed payload that does not include the response.output shape expected by client.responses.stream(). The text deltas have already streamed correctly, but the SDK helper crashes during final response parsing.
Expected behavior:
Suggested fix:
await client.responses.create({
model,
instructions,
input,
tools,
store: false,
stream: true,
})
Environment: