MoonshotAI / MoonshotAI/kimi-code
Bug: web-tools-abort-signal
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 7.5k
- Forks
- 1.2k
- Avg merge
- 11h 53m
- Merged PRs (30d)
- 350
Description
What version of Kimi Code is running?
0.19.2
Which open platform/subscription were you using?
Kimi Code OAuth
Which model were you using?
kimi-for-coding
What platform is your computer?
Microsoft Windows NT 10.0.26200.0 x64
What issue are you seeing?
WebSearch 和 FetchURL 这两个工具会忽略每次调用的取消信号。当一次请求正在进行时按 ctrl c 中断本回合,底层的 http 请求不会被取消,会在后台继续跑,遇到慢或挂起的服务器会一直挂到 undici 的默认超时
代码事实:
- ExecutableToolContext 带有 signal(packages/agent-core/src/loop/types.ts:119)
- 但 FetchURLTool.execution / WebSearchTool.execution 只解构了 toolCallId,丢了 signal
- UrlFetcher.fetch / WebSearchProvider.search 的 options 没有 signal 字段
- LocalFetchURLProvider / MoonshotFetchURLProvider / MoonshotWebSearchProvider
调 fetch() 时既不传 signal 也没有超时
其它 I/O 工具都把 ctx.signal 透传进实际工作,
这两个网络工具是例外,但是没有注释说明,可能并非有意。
What steps can reproduce the bug?
- 让 FetchURL/WebSearch 走本地抓取路径(LocalFetchURLProvider),目标是一个
会长时间不返回 body 的慢速服务器。 - 工具调用进行中按 ctrl c 中断回合。
- 观察:底层请求没有被取消,而不是随回合中止立即结束。
单元层面可复现:给 provider.fetch(url, { signal }) 传入一个 AbortController 的
signal,可以发现 signal 没有被转发到底层 fetch()。
What is the expected behavior?
ctrl c 时,正在进行的 WebSearch / FetchURL 的底层 http 请求应当被立即取消,和其它 I/O 工具一致(把 ctx.signal 一路透传到 fetch 的 signal 选项)
Additional information
修复方向:给 UrlFetcher / WebSearchProvider 的 options 增加可选 signal,从工具透传 ctx.signal,在各 provider 把它传给 fetch(url, { signal })。我已准备好相应补丁(改动大概 80多行,含测试)。是否愿意我提 PR?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with ExecutableToolContext in packages/agent-core/src/loop/types.ts:119, then trace FetchURLTool.execution and WebSearchTool.execution into UrlFetcher.fetch and WebSearchProvider.search. Check the LocalFetchURLProvider, MoonshotFetchURLProvider, and MoonshotWebSearchProvider fetch calls and their unit-level cancellation coverage. Done means Ctrl+C aborts the underlying HTTP request for both tools, with tests confirming the signal reaches fetch().
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- cli, networking
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 74/100