github / github/copilot-cli

400 "Missing namespace for function_call" for deferred/tool-search tools (e.g. extensions_manage) on 1.0.80

オープン
#4,519 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

area:models area:tools
主要言語
Shell
スター
11.2k
フォーク
1.9k
平均マージ
14時間 16分
マージ済み PR(30日)
6

説明

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 (plugin prwatch: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 defer to auto/tool-search deferral, so they're discovered lazily via tool_search_call, with call-id → namespace mapping carried in serverTools.functionCallNamespaces.
  • When that deferred function_call item is replayed on a later request without its namespace field, 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

  1. Per-extension: set defer: "never" on our own extension's tools so they're eagerly loaded (doesn't help built-in tools).
  2. Global: set "toolSearch": false in ~/.copilot/settings.json to disable deferred tool search app-wide. After this, both extensions_manage and 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

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

レポートで言及されている serverTools.functionCallNamespaces のマッピングを起点に、deferred tool_search_call の処理を function_call のシリアライズとリプレイまで追跡します。toolSearch を有効にした状態で deferred extensions_manage または拡張機能ツールを使って再現し、その後のリクエストで名前空間が維持され、CAPI 400 が発生しなくなることを確認します。

索引モデルが issue の本文から書いたものです。

評価

領域
api, cli
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
活発
明瞭さ
おおむね明確
初心者へのやさしさ
55/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。