Repository navigation
fix(agent-runtime): 修复开启电脑操作后 Agent 拿不到 Computer 工具 - #2483
Merged
Merged
Conversation
…ntime Electron main already sends computerUseEnabled for Agent sessions with computer use switched on, and DesktopAgentRuntime gates the Computer tool on it, but the sidecar's runtimeFor dropped the flag. The runtime always saw it as off, so Computer never reached the tool catalog and ToolSearch answered "No matching on-demand tool". Forward the flag into the runtime and into the reuse config, so turning the switch on or off retires a runtime built under the old value. fixes vastsa#2468
There was a problem hiding this comment.
AIUO CodePilot · Preliminary review
Diff-only preliminary review: the change forwards `computerUseEnabled` from `runtimeFor` into `DesktopAgentRuntime` and includes it in the reuse comparison, plus a sidecar integration test. No evidenced defects found in the added lines. I could not run the sidecar test, typecheck, or inspect surrounding code; verification is limited to the supplied patch and does not confirm the DesktopAgentRuntime option name or RPC parameter match.
No evidenced findings in the supplied diff.
Head: 107e238
Base: 48a6558
CI: success; mergeable: true.
Validation: code/tests NOT EXECUTED. Diff-only preliminary analysis; not approval. Human review and repository gates remain required.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
问题
#2468:在设置里打开了电脑操作(Computer use),并配置了操作模型,但在 Agent 会话里看不到 Computer 工具。用 ToolSearch 精确搜索
Computer,返回的是No matching on-demand tool。原因
Electron 主进程在 Agent 会话、且电脑操作开关打开时,会给 sidecar 传
computerUseEnabled: true(apps/desktop/electron/main/runtime/session-launch.ts)。DesktopAgentRuntime也是按这个值决定要不要提供 Computer 工具。但
packages/agent-runtime/src/sidecar.ts里的runtimeFor没有把这个参数传下去,有两处遗漏:DesktopAgentRuntime,所以运行时一直当作开关是关着的,Computer 不会进工具目录;修复
在
runtimeFor中补上computerUseEnabled的转发,传给运行时,同时放进复用比较的配置。只改了 4 行,审批、授权和窗口拒绝等安全检查都没有改。测试
apps/desktop/test/sidecar-computer-use.test.mjs:启动真实的 sidecar,只模拟宿主和模型接口,检查发给模型的请求里有没有 Computer。覆盖四种情况:一开始就打开、一开始就关闭、从关到开、从开到关。不带修复时测试失败,带修复后通过。No matching on-demand tool,Computer 没有被调用。@pi-desktop/agent-runtime单元测试;agent-runtime 和 desktop 的 typecheck;lint;architecture 检查;pnpm check:pr-base。fixes #2468