Skip to content

fix(proxy): emit text deltas for final response output - #504

Merged
Soju06 merged 2 commits into
Soju06:mainfrom
e1ektr0:fix/opencode-empty-responses
May 11, 2026
Merged

Soju06 merged 2 commits into
Soju06:mainfrom
e1ektr0:fix/opencode-empty-responses

Conversation

@e1ektr0

@e1ektr0 e1ektr0 commented Apr 27, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Synthesize response.output_text.delta for public Responses streams when upstream only provides assistant text in final output-item or terminal response output payloads.
  • Avoid duplicate deltas when upstream already emitted text for the same output item.
  • Add OpenSpec change artifacts and regression tests for item-done-only, terminal-output-only, existing-delta streams, and HTTP bridge stream expectations.

Related Issue

Issue Found

OpenCode's built-in OpenAI provider with baseURL overridden to codex-lb can complete a streamed /v1/responses request with usage/finish metadata but no visible assistant content if the stream lacks response.output_text.delta events. In the captured incident, codex-lb 1.15.0 logged the main gpt-5.5 request as successful with non-zero output/reasoning tokens, while OpenCode persisted only step-start and step-finish parts.

This matches the #430 class of new-session requests that appear successful/processed server-side but leave the client without a usable response.

Validation

  • uv run pytest tests\unit\test_proxy_api_responses_contract.py -q
  • uv run pytest tests\integration\test_proxy_responses.py -k "v1_responses_stream_preserves_done_text_events or v1_responses_stream_keeps_non_text_content_part_done_events" -q
  • uv run pytest tests\integration\test_http_responses_bridge.py::test_v1_responses_http_bridge_stream_matches_previous_response_error_to_anchor_with_two_followups -q
  • uv run pytest tests\integration\test_http_responses_bridge.py::test_v1_responses_http_bridge_cancellation_releases_queued_slot -q
  • uv run ruff check app\modules\proxy\api.py tests\unit\test_proxy_api_responses_contract.py tests\integration\test_http_responses_bridge.py
  • uv run ruff format --check app\modules\proxy\api.py tests\unit\test_proxy_api_responses_contract.py tests\integration\test_http_responses_bridge.py
  • openspec validate fix-empty-public-response-stream --strict
  • openspec validate --specs

Note: Running the full bridge slice locally on Windows now passes the changed assertions, but the run can hit an unrelated SQLite database is locked setup error after many tests. The CI bridge slice runs on Ubuntu.

@Soju06

Soju06 commented May 11, 2026

Copy link
Copy Markdown
Owner

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep them coming!

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@Soju06
Soju06 merged commit b9c2474 into Soju06:main May 11, 2026
18 checks passed
@Soju06

Soju06 commented May 11, 2026

Copy link
Copy Markdown
Owner

@all-contributors please add @e1ektr0 for code, test

@allcontributors

Copy link
Copy Markdown
Contributor

@Soju06

I've put up a pull request to add @e1ektr0! 🎉

vitalNohj pushed a commit to vitalNohj/codex-lb that referenced this pull request Jul 17, 2026
* fix(proxy): emit text deltas for final response output

* test(proxy): update bridge stream delta expectations

---------

Co-authored-by: Maxim Feofilov <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants