Skip to content

fix(llmcore): handle Responses API incomplete/failed terminal events + reasoning_text - #718

Merged
lsdefine merged 1 commit into
lsdefine:mainfrom
amm10090:fix/deepseek-responses-terminal-events
Jul 31, 2026
Merged

fix(llmcore): handle Responses API incomplete/failed terminal events + reasoning_text#718
lsdefine merged 1 commit into
lsdefine:mainfrom
amm10090:fix/deepseek-responses-terminal-events

Conversation

@amm10090

Copy link
Copy Markdown
Contributor

…+ reasoning_text

  • response.incomplete/response.failed now record usage, emit truncation marker and stop cleanly instead of being misread as ConnectionError (retry storm)
  • collect response.reasoning_text.delta/.done into thinking content blocks
  • non-stream Responses JSON: parse reasoning items and failed/incomplete status

…+ reasoning_text

- response.incomplete/response.failed now record usage, emit truncation marker
  and stop cleanly instead of being misread as ConnectionError (retry storm)
- collect response.reasoning_text.delta/.done into thinking content blocks
- non-stream Responses JSON: parse reasoning items and failed/incomplete status
@lsdefine

Copy link
Copy Markdown
Owner

Reviewed and verified locally by replaying simulated SSE streams against this branch:

  • response.incomplete/response.failed with no prior output previously fell through the loop end -> empty blocks + no yields -> ConnectionError("empty response") retry storm (llmcore.py L415-416 on main). This PR fixes the real root cause; usage is recorded and a terminal marker/!!!Error: is surfaced, consistent with existing conventions.
  • reasoning_text collection mirrors the chat_completions path (thinking blocks), and non-stream reasoning item parsing checked out.
  • Style matches the codebase; no unrelated changes.

One minor note (not blocking): when partial text was already streamed before response.incomplete, no truncation marker is appended — conservative and acceptable.

Merging. Thanks for the clean, well-scoped fix!

@lsdefine
lsdefine merged commit 9355c22 into lsdefine:main Jul 31, 2026
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