Skip to content

fix: use action.query for web_search_call items to match OpenAI API#89

Merged
jpr5 merged 3 commits intoCopilotKit:mainfrom
erezcor:fix/web-search-action-query
Apr 7, 2026
Merged

fix: use action.query for web_search_call items to match OpenAI API#89
jpr5 merged 3 commits intoCopilotKit:mainfrom
erezcor:fix/web-search-action-query

Conversation

@erezcor
Copy link
Copy Markdown
Contributor

@erezcor erezcor commented Apr 7, 2026

Summary

  • web_search_call items in streaming and non-streaming Responses API output used query directly on the item object, but the real OpenAI Responses API nests it at item.action.query
  • Updated buildWebSearchStreamEvents and buildTextResponse in responses.ts
  • Updated collapseOpenAISSE in stream-collapse.ts to read from item.action.query
  • Updated tests to match
  • Added reasoning? and webSearches? to the Response Types docs table

Test plan

  • All 2068 existing tests pass

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Apr 7, 2026

Open in StackBlitz

npm i https://pkg.pr.new/@copilotkit/aimock@89

commit: d126d3c

erezcor added 3 commits April 7, 2026 20:07
…ormat

The web_search_call items were placing `query` directly on the item object,
but the real OpenAI Responses API nests it at `item.action.query`. This caused
consumers to crash with `Cannot read properties of undefined (reading 'query')`
when accessing `event.item.action.query`.
@erezcor erezcor force-pushed the fix/web-search-action-query branch from 30b8189 to d126d3c Compare April 7, 2026 17:07
Copy link
Copy Markdown
Contributor

@jpr5 jpr5 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clean fix — action.query nesting is correct across all touchpoints (responses.ts, stream-collapse.ts, tests, docs). LGTM.

Note: the workflow file change (pull_request_targetpull_request, -f removal) will be reverted in a follow-up commit after merge.

🤖 Reviewed with Claude Code

@jpr5 jpr5 merged commit c559111 into CopilotKit:main Apr 7, 2026
18 checks passed
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