Repository navigation
fix: keep OpenAI web searches in later turns - #31355
Conversation
This comment has been minimized.
This comment has been minimized.
|
Chat: Review posted | View chat Review history
deep-review v0.13.0 | Round 7 | Last posted: Round 7, 30 findings (1 P2, 5 P3, 14 P4, 10 Nit), COMMENT. Review Finding inventoryFindings
Contested and acknowledgedCRF-1 (P3, integration_responses_test.go:41) - unstored search dropped on a stored follow-up
CRF-5 (P2, go.mod:126) - pre-#62 metadata replays without required fields
CRF-6 (P3, go.mod:126) - inline items sent without the web_search tool
CRF-8 (Nit, exp_chats_test.go:11019) - select re-implements testutil.RequireReceive
Round logRound 1Round type: round 1, full panel. Netero first pass: 1 P2, 1 P3, 2 Notes, no P0, panel proceeded. Panel (focused, Go only): ging-go, melody, ryosuke (triggered specialists), pariston, mafuuu (core), bisky (tests changed), gon, leorio (once-per-PR floor), meruem (wildcard, random). 8 plus wildcard. Round 2Fix round (no files added or moved, no change of goal, effective additions 179 to 205; the ActionType rename is the CRF-16 fix). Churn guard PROCEED: 9 addressed, 3 contested, 1 deferred. Netero: no findings. Panel: melody, ryosuke, meruem, ging-go (contested raisers, R1 agents reused), gon, leorio (comments and error messages changed), bisky, komugi (follow-up wait loop rewritten), mafuuu (wildcard, random). No new agents were needed for contested personas. Round 3Restructure round: the PR goal widened from store:false to every search not sent as an item_reference (title changed, pin 50bf6c5 changes store:true behavior). Churn guard PROCEED: CRF-1, 22, 23, 24 addressed; CRF-20 (OOS) fixed by the pin. Netero (post-panel, advisory): CRF-26 P3, CRF-27 P4. Full panel (focused, Go only): ging-go, melody, ryosuke (triggered specialists), pariston, mafuuu (core), bisky (tests changed), gon, leorio (restructure floor), meruem (wildcard, random). Fixes for CRF-1, 20, 22, 23, 24 verified (Netero, Bisky, Meruem, Ryosuke). Round 4Fix round (only fixes prior findings; the fantasy rewrite in 9bd1001 is the CRF-26 fix). Churn guard PROCEED: CRF-26 to 31 addressed. Netero: no findings; CRF-26 and CRF-27 fixes verified (pin equals #78 head b4d4cde; CRF-27 by mutation). Panel: meruem, gon, leorio (raisers of findings whose code changed), ging-go, ryosuke, melody (Go and wire-format specialists), bisky (tests changed), hisoka (part-order edge cases in the new adjacency rule), chopper (wildcard, random). Fixes for CRF-26 to 31 verified (Netero, Bisky, Meruem, Leorio, Gon). Melody verified that fantasy streams call, sources, result and chatd stores them in that order, so the call is always at referenceAt; the reference path holds with sources present. CRF-33 (OOS R3) addressed by the pin. Round 5Fix round. Churn guard PROCEED: CRF-37 addressed (9e4efa6). Netero: no findings; pin e782df27fe0e equals #78 head, fantasy diff from b4d4cde is one comment. Panel: gon (CRF-37 raiser), leorio (comment touched), ging-go (Go files), kite (wildcard, random). Leorio, Ging-Go, Kite: no findings. Round 6Fix round. Churn guard PROCEED: CRF-39 addressed (fd7fb0d). Netero: no findings; PR diff equals R5 apart from the rename; pin e782df27fe0e still equals the coder/fantasy#78 head. Panel: gon (CRF-39 raiser), ging-go (Go file), bisky (test file), knov (wildcard, random). No findings. No open findings remain; review posted with APPROVE (downgraded to COMMENT by the tool). Round 7Fix round (changes fix prior out-of-scope items CRF-21, 34, 35, 36; no files added; effective additions 193 to 313). Churn guard PROCEED with no open findings. Netero: no findings; CRF-34, 35, 36 verified (CRF-35 by mutation). Panel: meruem (CRF-34/35), ging-go (CRF-36), ryosuke (CRF-21), melody, takumi (new mutex in the fake), bisky (new test), gon, leorio (new doc comments and error message), hisoka (reference heuristic edge cases), razor (wildcard, random). Takumi verified the fake records ids under the lock before writing the event; race tests pass. Razor verified CRF-35 through chatd by mutating fantasy to reference an unstored search (404). About deep-reviewCRF = Coder Review Finding (P0-P4, Nit, Note)
|
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
This comment has been minimized.
This comment has been minimized.
086bf50 to
8484794
Compare
This comment has been minimized.
This comment has been minimized.
1012e55 to
ddeb891
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
ddeb891 to
8c1b9e7
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
8c1b9e7 to
611c9a5
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
611c9a5 to
8dd4ec0
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
The stateless case only checked that some web_search_call was sent, so it passed with the item moved or missing its action or status.
coder/fantasy#78 now sends a search inline whenever it does not go back as an item reference, not only when store is false. A stored turn after an unstored one, and stored searches with no reasoning before them, now keep their searches; the tests expect the inline item in those cases.
Counting streamed requests would hand the follow-up answer to a retried first turn.
The head references a search only from the part right after its reasoning and replays each search once, so a search is never sent both inline and as a reference.
The stored full-replay case now fails if the referenced search is also sent inline. The web_search_call id check duplicated the ws_ id check below it, so it is gone, and the no-stale test says what stale means.
The head changes only comments and a test field name since 9bd1001.
The new head warns when a tool message drops a provider-executed result.
openai-go leaves out the optional type on item references, so the checks for type item_reference could never fail.
OpenAI returns 404 for an item_reference to an item from a store: false response, but the fake server accepted it, so chatd tests could not catch a replay that references unstored items.
The server returns on the first unstored reference, so the reasoning reference alone decided the old test and the web search id was never checked.
The validator and the unstored-reference check disagreed on which untyped items are references; both now use ResponsesItemReferenceID.
OpenAI adds a store hint to the message when the referencing request is also store: false. Also checks a typed reference and renames the helpers for what they do.
main now decodes the request into a pointer.
5bf23e0 to
eb3d4d0
Compare
With
store: false, an OpenAI chat drops every earlier web search from the next request, so on later turns the model says it made no tool calls (dogfood chat6a4a3462-3426-496c-8268-28faedceb818). Fantasy replays a search only as anitem_reference, and OpenAI cannot resolve a reference to an unstored item.This moves the fantasy pin to coder/fantasy#78, which resends a search inline as
{"type":"web_search_call","status":...,"action":{...}}, built from the tool result's metadata with noidand no sources, whenever the search does not go back as anitem_reference. A reference still needs a stored request, a stored source response and a reasoning item right before the search, and each search is replayed once, so a referenced search is not also sent inline. So withstore: falseevery search is sent inline, and withstore: truetwo cases that were dropped are now sent inline too: searches from an unstored response (a chat moved to a stored model config) and searches with no reasoning before them (gpt-4o). The model gets the action it took, not the page content, since an item without anidgives OpenAI nothing to look up. Thego.modfork notes gain item 17, and the pin iscoder_2_33ate1c559d, where #78 merged.TestChatOpenAIResponsesWebSearchnow sends a second turn and checks the request body: the input must be[user, web_search_call, assistant, user]with the exact inline item. Withstore: falseit covers search,open_page,find_in_pageand a failed search; with the defaultstore: trueon gpt-4o, which produces no reasoning, it covers search and a failed search. The test runs through the chat API, the database and chatd's prompt builder, so it also shows chatd keeps the result's provider metadata and the provider-executed result in the assistant message.Three test fixtures matched the old behavior. The fake OpenAI server rejected any
web_search_callwithout a reasoning item before it; live probes show OpenAI accepts one without anid, so the fake now requires reasoning only when the item has anid. It also sentaction.sourcesonopen_pageandfind_in_page, which live OpenAI sends only onsearch.TestOpenAIResponsesNoStaleWebSearchReplayfailed everyweb_search_callin the follow-up; it now fails only one with anidor anitem_reference, and both its stateless and switch-to-stored cases expect the exact inline item right after the reasoning item.TestOpenAIResponsesFullReplayPairsReasoningAndWebSearchnow also fails if a referenced stored search is sent inline as well.The fake server now returns OpenAI's 404 for an
item_referenceto an item it served withstore: false, so a replay that references unstored items fails in chatd tests as it does live. The tests' reference checks looked fortype: "item_reference", which openai-go leaves out, so they could never fail; they now also catch a reference sent as just{"id": ...}.Relates to CODAGT-1482
Verification
2e8e2cb), all sixTestChatOpenAIResponsesWebSearchcases and bothTestOpenAIResponsesNoStaleWebSearchReplaycases fail. On the previous chore: Update pion/ice fork to resolve goroutine leak #78 head (a410684, inline only withstore: false), the two stored cases andswitch to storedfail and the rest pass.go.modandgo.sumwere restored afterward.make pre-commitpasses.go testpasses on every package that imports fantasy (coderd/x/chatd/...,coderd/database/db2sdk,coderd/mcp), andgo test ./coderd -run 'TestChat'passes.store: false, gpt-5-mini returned HTTP 200 for a pre-ci: Pin the golangci-lint version to prevent breakage #62{"type":"find_in_page"}or{"type":"open_page"}action with nourlorpattern, and for an inlineweb_search_callwith noweb_searchtool in the request (also on gpt-6.1-sol). With turn 1 unstored and turn 2store: true, inline items without anidreturned HTTP 200 on gpt-5-mini and gpt-6.1-sol in 12 of 12 runs, while anitem_referencereturned 404. fix(providers/openai): replay unreferenced web searches inline fantasy#78 reports the other live probes.