Parallel tool calling non-deterministic response order results in confused bots
まだ誰も着手していません。
- 主要言語
- Shell
- スター
- 11.2k
- フォーク
- 1.9k
- 平均マージ
- 14時間 16分
- マージ済み PR(30日)
- 6
説明
Describe the bug
Copilot harness loses request correlation for parallel tool calls
Summary
The Copilot harness does not preserve a reliable association between parallel tool requests and their responses.
The harness can return parallel responses without the original request, a caller-defined alias, or another usable
correlation value. The agent can then associate a response with the wrong request.
Observed behaviour
The agent sent separate service searches for these filters:
{ "type": ["application"] }
{ "type": ["data-product"] }
{ "type": ["kafka-connect"] }
The responses contained different totals. The harness did not return a request alias or the original request with each response. The agent matched the totals to the wrong filters and reported an incorrect breakdown.
The response position was not a safe correlation method.
Expected behaviour
The harness must preserve the association for every parallel invocation.
The parallel call format can accept an optional caller-defined alias:
{
"request_alias": "kafka-connect-count",
"tool": "delivery_platform_search_services",
"arguments": {
"type": ["kafka-connect"],
"environment": "prod"
}
}
Each response must return the alias and the request:
{
"request_alias": "kafka-connect-count",
"request": {
"type": ["kafka-connect"],
"environment": "prod"
},
"result": {
"pagination": {
"total_items": 71
}
}
}
The harness must not require response order to match request order.
If the caller does not provide an alias, the harness can return its internal call ID. The internal ID alone is not
enough for semantic correlation. The response must also include the original request or another stable request
description.
Suggested fix
Add request metadata to the parallel tool runner.
The runner must:
- Accept an optional
request_aliasfor each invocation. - Keep the alias with the invocation while the tool runs.
- Return the alias, original arguments, and result together.
- Preserve the association when responses complete out of order.
- Keep aliases out of the arguments sent to the underlying tool API.
The same response envelope can apply to single tool calls for consistent behaviour.
Workaround
I did a poor-mans implementation of the above, by wrapping our server.registerTool function with something that:
- Adds an optional
request_aliasfield to registered tool input schemas. - Removes
request_aliasbefore the tool handler runs. - Adds the alias to
structuredContent.request_aliasin the response. - Extends declared output schemas when they exist.
- Covers JSON, text, generated, and proxied tools.
I also added the following to our instruction file:
- Assign a unique alias to every parallel invocation.
- Put the alias in the actual tool arguments.
- Match responses by alias and exact arguments.
- Run calls sequentially when a tool does not support aliases.
- Treat a response without the expected alias as uncorrelated.
That worked well:
But only works for tools we register.
Affected version
1.0.78
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
まず、workaround で説明されている parallel tool runner と server.registerTool ラッパーを追跡します。呼び出しメタデータがレスポンスにどのように引き継がれるか、また引数が基盤となるツール API にどのように渡されるかを確認します。呼び出しが順不同で完了しても、エイリアス、元のリクエスト、結果の対応関係が維持され、エイリアスがツール引数として転送されなければ完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- shell
- 領域
- cli, tooling
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 静か
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 55/100