Skip to content

fix(gateway): declare hosted web_search for replayed history - #504

Merged
qxcnm merged 2 commits into
qxcnm:mainfrom
Yicheng-1218:fix/web-search-history-compat
Oct 15, 2026
Merged

qxcnm merged 2 commits into
qxcnm:mainfrom
Yicheng-1218:fix/web-search-history-compat

Conversation

@Yicheng-1218

Copy link
Copy Markdown
Contributor

Codex can replay historical web_search_call input during context compaction while sending tools: [], causing upstream internal_error: response protection is unavailable (openai/codex#51962). This patch conditionally declares web_search with external_web_access false for Codex /v1/responses requests, sets tool_choice none when no tools were originally requested, avoids duplicate declarations, and leaves other endpoints and providers untouched. Regression tests cover historical replay, existing tools, already-declared search, ordinary requests, and non-Codex upstreams. A local middleware applying the equivalent transformation successfully restored compaction of the original failing session (13 requests, 1 patched). Rust compilation and formatting await CI because cargo is unavailable locally. Related error-handling report: #501.

@Yicheng-1218
Yicheng-1218 marked this pull request as ready for review October 15, 2026 06:03
@qxcnm
qxcnm merged commit 4793385 into qxcnm:main Oct 15, 2026
3 checks passed
@Yicheng-1218
Yicheng-1218 deleted the fix/web-search-history-compat branch October 16, 2026 01:03
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