Skip to content

sub2api sometimes returns a stream without a terminal signal, causing opencodex to wait indefinitely #735

Description

@jinbaizhe

Client or integration

Codex App

Area

Proxy and routing

Summary

I’m using opencodex as a local proxy, and I found that some models routed through sub2api can get stuck in a “waiting” state.

Observed error:
stream disconnected before completion: Provider stream error: upstream stream ended without a terminal signal ([DONE] or finish_reason) — possible truncation
What I observed:
The request often returns HTTP 200.
firstOutputMs is normal, so the upstream is not completely silent.
But the final terminal signal is missing, so opencodex keeps waiting for completion.
In practice, this shows up as a 300000ms timeout or a permanently spinning / waiting Desktop session.
Additional note:
When I configure sub2api directly under ~/.codex/.config.toml, the same model can work normally.
The issue appears more reliably when the request goes through opencodex.
My current suspicion is:
sub2api does not consistently emit a terminal SSE signal such as [DONE] or finish_reason
or opencodex is not handling this stream-ending behavior robustly enough when that signal is missing
Environment:
opencodex: 2.7.43
Codex Desktop: 0.146.0-alpha.3.1
Affected models:office/gpt-5.6-terra(using the model provided by sub2api)

Reproduction

Reproduction steps:
Use Codex Desktop through opencodex.
Select office/gpt-5.6-terra(Using the model provided by sub2api)
Send a normal prompt.
The request starts streaming output, but it never finishes cleanly. The UI keeps waiting until timeout or manual interruption.
Observed error:
stream disconnected before completion: Provider stream error: upstream stream ended without a terminal signal ([DONE] or finish_reason) — possible truncation

Version

2.7.43

Operating system

macos 15.7

Provider and model

No response

Logs or error output

stream disconnected before completion: Provider stream error: upstream stream ended without a terminal signal ([DONE] or finish_reason) — possible truncation

Screenshots and supporting files

Image

Redacted configuration

Checks

  • I searched existing issues and documentation.
  • I removed secrets, tokens, account details, request credentials, and personal data.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions