You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
chatd: OpenAI web searches without a preceding reasoning item are never replayed #30528
Hosted OpenAI web searches that have no reasoning item right before them are never sent back to the model in later requests, so the model loses what the search found.
Details
coder/fantasy only sends a web_search_call item reference right after a reasoning item from a stored response. OpenAI also returns web searches with no reasoning before them. In review probes on coder/fantasy#63, gpt-4.1-mini did this for search, and gpt-5.4-mini and gpt-5.5 at effort none did it for open_page. Those searches are dropped from every later request. For open_page this loses the page contents (gpt-5.5: 11,485 input tokens with the reference, 4,574 without). For search it loses only the query.
This affects configs that send store: true. Hosted web search can only be turned on through an OpenAI options block, and a config with that block defaults Store to true (coderd/x/chatd/chatopenai/options.go). So web search configs that leave store unset are affected. Configs that set store: false are not.
From the same probes (OpenAI does not document this): with store: true, a reference to the ws_ item on its own is accepted. When a reasoning item came before the search, sending the reference without that reasoning item returns a 400 that names the rs_ item.
Possible fix
For each search, record whether its source response was stored and which reasoning item, if any, came right before it, in both Generate and Stream.
Send a reference on its own only when no reasoning came before the search, or when that reasoning item is also in the input.
Apply the same rule in validateResponsesItemReferences.
Keep today's rule for searches saved without that record.
The previous prompt part cannot decide this on its own: chatd drops legacy reasoning with an empty summary, and Generate drops reasoning with neither a summary nor encrypted_content. Either leaves a reference on its own that returns a 400.
Activity
linear-code commentedon Oct 8, 2026
ENG-3457
fix: replay stateless OpenAI reasoning across chat turns (#30298)