Files
coder/coderd/x/chatd/chattest
Mathias Fredriksson 48a3d3ff12 fix: keep OpenAI web searches in later turns (#31355)
OpenAI chats dropped every earlier web search from the next request
with store false, so on later turns the model said it made no tool
calls. Fantasy replayed a search only as an item_reference, which
OpenAI cannot resolve for an unstored item.

The fantasy pin moves to coder_2_33 with coder/fantasy#78, which sends
a search inline as an id-less web_search_call, rebuilt from its result
metadata, whenever it does not go back as an item_reference. With
store true it also covers searches from an unstored response, as when a
chat moves to a stored model config or a zero data retention org, and
searches with no reasoning before them. The model gets the action it
took, not the page contents, which OpenAI does not keep for references
either.

TestChatOpenAIResponsesWebSearch now sends a second turn and asserts
the exact inline item for each action shape through the chat API and
chatd's prompt builder. The fake OpenAI server accepts inline searches
without an id, returns OpenAI's 404 for references to items it served
with store false, and sends sources only on search actions. The tests'
reference checks now also catch references without a type, which
openai-go omits.

Relates to CODAGT-1482
2026-10-29 19:50:34 +00:00
..