fix(openai): preserve streamed encrypted reasoning - #39635
Conversation
|
Review note from the Codex triage assistant: the converter approach looks correct, including same-index aggregation for both output versions and filtering empty encrypted payloads from stateless replay. The current VCR failures appear to be cassette misses caused by the corrected request shape, not product failures: |
Co-authored-by: open-swe[bot] <open-swe@users.noreply.github.com>
|
FWIW this is impacting us pretty hard - we started getting 404s from OpenAI earlier because LangChain was not preserving the encrypted reasoning content. We're working around it but look forward to pulling in this patch when it's released. |
Co-authored-by: open-swe[bot] <open-swe@users.noreply.github.com>
4190a80
Address review feedback on the streamed encrypted reasoning fix: - Only match the reasoning `response.output_item.done` branch when the item actually carries encrypted content. Previously the branch matched every reasoning item and fell through to build a chunk with empty content, adding a spurious `on_llm_new_token` callback to every reasoning stream. - Restore the non-empty `encrypted_content` on the streamed `output_item.added` fixture so the deduplicating `pop()` is actually pinned; without it the line could be deleted with the suite still green. - Cover the stateless (`store=False`) replay of a streamed message end to end, and re-add the reasoning block shape with no `encrypted_content` key at all.
|
thanks for the quick patch, we also got hit by this today dropping the reasoning item can leave its |
|
Confirmed this also affects DeepAgents using LangChain's Codex OAuth (ChatOpenAICodex), with the exact rs* 404 under store=False. |
|
Released in langchain-openai 1.5.1. |
Jordan Hayashi (@jhhayashi) heads up that if you do that, you're dropping reasoning on subsequent turns, which could decrease performance (e.g. the model will lose track of what it was doing and need to re-reason) |
ChatOpenAIpreserves encrypted reasoning from streamed Responses API calls for stateless replay.OpenAI emits an empty placeholder on
response.output_item.addedand the final encrypted payload onresponse.output_item.done. ChatOpenAI now merges the completed payload into streamed output and skips empty payloads during stateless replay.Made by Open SWE