Parallel tool calling non-deterministic response order results in confused bots
还没有人认领这个 Issue。
- 主要语言
- Shell
- 星标
- 11.2k
- 派生
- 1.9k
- 平均合并
- 14 小时 16 分钟
- 30 天内合并 PR
- 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 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
首先跟踪 workaround 中描述的 parallel tool runner 和 server.registerTool 包装器。检查调用元数据如何传递到响应中,以及参数如何传递给底层工具 API。完成的标准是:即使调用按不同顺序完成,别名、原始请求和结果仍保持关联,并且不会将别名作为工具参数转发。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- shell
- 领域
- cli, tooling
- Issue 类型
- 缺陷
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 冷清
- 描述清晰度
- 基本清楚
- 新手友好度
- 55/100