Skip to content

fix: send stream:true on Responses and parse Codex SSE - #6

Open
felipeinf wants to merge 1 commit into
tinyhumansai:mainfrom
felipeinf:fix/codex-responses-stream-true
Open

fix: send stream:true on Responses and parse Codex SSE#6
felipeinf wants to merge 1 commit into
tinyhumansai:mainfrom
felipeinf:fix/codex-responses-stream-true

Conversation

@felipeinf

Copy link
Copy Markdown

Summary

Codex OAuth chat against /backend-api/codex/responses returns HTTP 400 Stream must be set to true and an SSE body. The Responses path was still sending a unary JSON call (stream omitted) and parsing the whole body as one object.

This sets stream: true on Responses requests, aggregates Codex SSE (response.completed plus output_text.delta / output_text.done when output is empty), and uses the streaming HTTP timeout for that POST.

Related issue

OpenHuman: Closes tinyhumansai/openhuman#5497 (the Stream must be set to true failure). Sibling symptoms in that issue (steering 404, .deb PATH) are out of scope.

Also related: tinyhumansai/openhuman#3201 (same Codex Responses constraint; store=false was already fixed).

API or behavior changes

  • Responses-primary OpenAiModel always sends stream: true.
  • Unary invoke still returns one ModelResponse; it now accepts either a JSON envelope or aggregated SSE.
  • Chat Completions is unchanged.
  • Incremental ChatModel::stream on Responses is still a folded unary call (same as before).

Validation

Commands actually run, with their outcome:

  • cargo fmt --all -- --check
  • cargo clippy --all-targets --all-features -- -D warnings
  • cargo build --all-targets --all-features (via clippy + test compile)
  • cargo test --all-features (276 lib tests + 1 integration + doctests)

Tests

  • SSE response.completed with output_text
  • Empty completed.output filled from output_text.done
  • Mock TCP server: 400 unless "stream":true, then SSE → ok
  • Existing Responses translation test now asserts stream: true

Documentation

No public API docs: this is wire-shape behavior on an existing with_responses_api_primary path.

Checklist

  • The change is focused on one logical change
  • No new #[allow(...)], #[ignore], or relaxed lints
  • No secrets, tokens, or .env contents in the diff or the description

Codex OAuth backends reject unary Responses calls with HTTP 400
Stream must be set to true and return SSE instead of a JSON envelope.
@coderabbitai

coderabbitai Bot commented Sep 3, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Team

Run ID: 6a040ffa-bba9-4293-938e-d9795aca177e

Warning

Your free Security trial is over. An organization admin can upgrade to Advanced for continuous pull request security review or dismiss this notice.


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

@tinysweeper tinysweeper Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tinysweeper found nothing blocking. Approving.

$0.0000 · 0 in / 0 out

@tinysweeper

tinysweeper Bot commented Sep 3, 2026

Copy link
Copy Markdown

How this change flows

1 changed behaviour across 10 relationships. 6 surrounding behaviours are shown (60 graph nodes walked). 46 further behaviours left out to keep the diagram readable.

flowchart LR
  n0["..._continuation_format_and_provider_options<br/>changed"]:::changed
  n1["Result"]:::impacted
  n2["parse_responses_response"]:::impacted
  n3["translate_responses_request"]:::impacted
  n4["ModelRequest"]:::impacted
  n5["invoke_responses"]:::impacted
  n6["translate_request"]:::impacted
  n0 -->|calls| n3
  n0 -->|tests| n3
  n3 -->|uses| n1
  n3 -->|uses| n4
  n5 -->|uses| n1
  n5 -->|calls| n2
  n5 -->|calls| n3
  n5 -->|uses| n4
  n6 -->|uses| n1
  n6 -->|uses| n4
  classDef changed fill:#0d4429,stroke:#238636,color:#e6edf3
  classDef impacted fill:#161b22,stroke:#6e7681,color:#c9d1d9
  classDef flagged fill:#5a1e02,stroke:#d93f0b,color:#ffffff
  classDef blocking fill:#67060c,stroke:#f85149,color:#ffffff
Loading

Green: changed behaviour. Grey: surrounding behaviour. Arrows name the call, use, implementation, or test relationship. Orange: has findings. Red: has a finding that blocks the merge.

tinysweeper 0.1.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

LLM hard-fails every turn (HTTP 400 stream=true missing), /orchestration/v1/steering 404, and .deb PATH broken on non-bash shells

1 participant