/v1/responses SSE frames omit the in-payload type field — OpenAI-SDK-style clients (ZeroClaw) see an unparseable stream #156

Closed
opened 2026-07-15 05:00:04 +00:00 by grenade · 0 comments
Owner

Symptom

ZeroClaw (on bob, podman) pointed at cortex via the OpenAI Responses API: prompts arrive at neuron on beast, generation runs to completion (~25s streams, response.completed emitted), but ZeroClaw chat sessions never show an answer.

Root cause

neuron's Responses SSE projection (crates/neuron/src/wire/openai_responses.rs, project_responses_stream) carries the event name only in the SSE event: field. Real OpenAI additionally stamps the event name into the JSON payload as "type" (plus a sequence_number), e.g.

event: response.output_text.delta
data: {"type":"response.output_text.delta","sequence_number":7,"item_id":"msg_...","output_index":0,"content_index":0,"delta":"Hello"}

Official SDKs — and ZeroClaw's parser (zeroclaw-providers/src/openai_codex.rs, match event.get("type")) — dispatch on data.type and ignore the SSE event: line entirely. With no type field, every frame is unrecognized: no text deltas, no completion, no answer surfaced.

Verified live 2026-07-15: replaying ZeroClaw's exact request (instructions + user message) against cortex /v1/responses streams a correct answer; the frames just lack type/sequence_number.

Fix

Stamp "type": <event name> and a monotonic "sequence_number" into every frame's data object in project_responses_stream. Additive — clients keying on the event: line (opencode, a0) are unaffected.

## Symptom ZeroClaw (on bob, podman) pointed at cortex via the OpenAI Responses API: prompts arrive at neuron on beast, generation runs to completion (~25s streams, `response.completed` emitted), but ZeroClaw chat sessions never show an answer. ## Root cause neuron's Responses SSE projection (`crates/neuron/src/wire/openai_responses.rs`, `project_responses_stream`) carries the event name **only** in the SSE `event:` field. Real OpenAI additionally stamps the event name into the JSON payload as `"type"` (plus a `sequence_number`), e.g. ``` event: response.output_text.delta data: {"type":"response.output_text.delta","sequence_number":7,"item_id":"msg_...","output_index":0,"content_index":0,"delta":"Hello"} ``` Official SDKs — and ZeroClaw's parser (`zeroclaw-providers/src/openai_codex.rs`, `match event.get("type")`) — dispatch on `data.type` and ignore the SSE `event:` line entirely. With no `type` field, every frame is unrecognized: no text deltas, no completion, no answer surfaced. Verified live 2026-07-15: replaying ZeroClaw's exact request (instructions + user message) against cortex `/v1/responses` streams a correct answer; the frames just lack `type`/`sequence_number`. ## Fix Stamp `"type": <event name>` and a monotonic `"sequence_number"` into every frame's data object in `project_responses_stream`. Additive — clients keying on the `event:` line (opencode, a0) are unaffected.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: helexa/helexa#156