400 "Missing namespace for function_call" for deferred/tool-search tools (e.g. extensions_manage) on 1.0.80
Chưa có ai nhận issue này.
- Ngôn ngữ chính
- Shell
- Star
- 11.2k
- Fork
- 1.9k
- Merge trung bình
- 14 giờ 16 phút
- Pull request đã merge (30 ngày)
- 6
Mô tả
Describe the bug
Description
On Copilot CLI 1.0.80, calls to tools discovered via deferred tool search intermittently fail with:
Execution failed: CAPIError: 400 Missing namespace for function_call '<tool_name>'. It does not exist in the default namespace. Round-trip the model's function_call item with its namespace field included. (Request ID: )
Observed against:
- A locally installed extension tool:
agenttools-prwatch_pool(pluginprwatch:prwatch) - A built-in tool:
extensions_manage
Both are (or can be) discovered via deferred tool_search_call rather than eager loading, and the model's function_call item appears to lose its namespace field when round-tripped back to CAPI on a subsequent turn, producing the 400 above.
Impact
Any session that discovers the affected tool via deferred tool search becomes unable to invoke it at all, with no recovery path other than avoiding the tool. This is not scoped to third-party extensions — it also hit a built-in tool (extensions_manage), suggesting the root cause is in the deferred-tool-search/round-trip serialization path itself.
Root cause (as best diagnosed locally)
- Tools default
deferto auto/tool-search deferral, so they're discovered lazily viatool_search_call, with call-id → namespace mapping carried inserverTools.functionCallNamespaces. - When that deferred
function_callitem is replayed on a later request without itsnamespacefield, CAPI rejects it with the 400 above. - Matches a similar reported issue in a sibling CLI: openai/codex#23839 ("Namespaced MCP tool calls fail after deferred tool discovery"), same error text, same likely cause.
Workarounds applied locally
- Per-extension: set
defer: "never"on our own extension's tools so they're eagerly loaded (doesn't help built-in tools). - Global: set
"toolSearch": falsein~/.copilot/settings.jsonto disable deferred tool search app-wide. After this, bothextensions_manageand the previously-failing extension tool succeeded with no further namespace errors.
Neither is a real fix — (1) doesn't cover built-ins, (2) disables a supported performance feature entirely.
Expected behavior
Deferred tool calls should retain their namespace field when round-tripped back to the model/CAPI on subsequent turns, regardless of whether the tool is built-in or from an installed extension, so toolSearch can stay enabled without risking a 400 on invocation.
Environment
- Copilot CLI version: 1.0.80
- OS: Windows
- Reproduced with: a locally installed plugin extension (
prwatch:prwatch) and a built-in tool (extensions_manage)
Related
- openai/codex#23839 — same error text and same deferred-tool-discovery/namespace-round-trip root cause in a related CLI.
Suggested fix direction
Cache the call_id → namespace mapping (as captured in serverTools.functionCallNamespaces) and reattach namespace when serializing/replaying the corresponding function_call item on the next request, instead of relying on the model to carry it forward verbatim.
Affected version
1.0.80
Steps to reproduce the behavior
No response
Expected behavior
No response
Additional context
No response
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Hướng nghiên cứu
Theo dõi việc xử lý deferred tool_search_call đến quá trình tuần tự hóa và phát lại function_call, bắt đầu với ánh xạ serverTools.functionCallNamespaces được đề cập trong báo cáo. Tái hiện bằng deferred extensions_manage hoặc một công cụ extension khi toolSearch được bật, sau đó xác minh rằng namespace vẫn được duy trì trong request tiếp theo và CAPI 400 không còn xảy ra.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Lĩnh vực
- api, cli
- Loại issue
- Lỗi
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức độ hoạt động
- Sôi nổi
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 55/100