[Bug] WSL remote 模式下可写子 agent (general-purpose) 被降级为只读 Explore,无法执行写操作
Nobody has claimed this yet.
- Dominant language
- No language data
- Stars
- 22
- Forks
- 1
- PR merge metrics
- No merged PRs in 30d
Description
问题描述
同样的代码库、同样的模型 (GLM-5.2),在 Windows 本地 workspace 下 main agent 可成功派发 general-purpose 子 agent(可写,tools:["*"]);但连到 WSL2 remote workspace 时,无论 subagent_type 传什么值(包括显式传 general-purpose),派出的子 agent 始终是只读的 Explore(工具集仅 Bash/Glob/Grep/Read/WebFetch/WebSearch/TodoWrite,无 Edit/Write)。
可写子 agent 在 WSL remote 模式下不可用,导致 subagent-driven-development、并行实现任务、子 agent 写代码等关键工作流无法在 WSL 上运行,只能回退到 main agent 串行处理。
环境
- ZCode 版本:
3.2.2(ZCODE_APP_VERSION=3.2.2) - 平台:Windows 桌面 app 连 WSL2(Ubuntu-24.04)remote workspace
ZCODE_SERVICE_AUTHORITY_MODE=desktop-attached-remoteZCODE_PROCESS_LABEL:server 侧未设置- 模型:
builtin:bigmodel-coding-plan/GLM-5.2 - 工作区:
/zcode/ZCodeSentinel
核心矛盾:代码层可达,运行时不可达
代码层面一切正常,grep 已逐条确认:
- 客户端
zcode.cjs中subagent_type是自由字符串(无 enum 硬限):subagent_type: T.string().optional().describe("The type of specialized agent to use for this task") - 客户端 builtIn profile 合并函数 无条件注入 general-purpose:
function Obe(e){ let t = new Map; t.set(Rbe, Iln()); // general-purpose (tools:["*"], 可写) t.set(Fu, Sln()); // Explore (tools:[受限只读]) for(let r of e) t.set(r.name, r); return Array.from(t.values()); } - 客户端 cjs 中无任何
authorityMode/attached-remote过滤逻辑(grep -c attached-remote= 0)。 - server
zcode-server.cjs:204375createBuiltInAgents()中 general-purpose 与 Explore 对等定义,均enabled: true。 - agent 执行处
r.subagent_type ?? t4t.GeneralPurpose—— 省略 subagent_type 时默认 general-purpose。
但运行时实测(WSL cli log),派出的子 agent 永远是 Explore:
"agentType":"Explore" ×249
"agentType":"general-purpose" ×0 ← 始终为 0
即便显式传 subagent_type: "general-purpose",子 agent 自检工具集仍报告"无 Edit 工具",确认被路由为 Explore。
Windows 本地 vs WSL remote 对照(同一天、同一台机器)
| 指标 | Windows 本地 | WSL remote |
|---|---|---|
同日 cli log agentType |
general-purpose ×25 ✅ |
general-purpose ×0,Explore ×249 ❌ |
| 子 agent 可写(Edit/Write) | ✅ | ❌(受限只读集) |
ZCODE_SERVICE_AUTHORITY_MODE |
desktop-local |
desktop-attached-remote |
已排除的可能
- ❌
~/.zcode/agents/目录缺失 —— builtIn 不依赖目录扫描(已验证:从 Windows 拷贝该目录到 WSL 后无效,问题依旧) - ❌
isDesktopRuntime/ capability —— server 唯一注册点已传{ isDesktopRuntime: true } - ❌ schema enum 硬限 ——
subagent_type是自由 string,任何值都能传 - ❌ provider apiKey —— WSL 侧 Explore 子 agent 能正常调通模型,证明 key 非阻塞因素
疑点(请团队在进程内确认)
决定"传 general-purpose 却拿到 Explore 工具集"的逻辑,无法通过静态阅读混淆后的 cjs 定位,推测在以下两处之一:
- remote 协议握手时,server 上报自身能力,客户端据此在内存中动态裁剪/替换 profiles(覆盖了
Obe的结果); general-purposeprofile(Iln())的tools:["*"]在 remote 模式被降级为 Explore 工具集。
请确认 desktop-attached-remote 模式下可写子 agent 的工具集是否被刻意限制:
- 若是产品决策,请在文档 / UI 标注,避免用户误以为可用;
- 若是 bug,望修复,以支持 WSL 下的 subagent-driven 工作流。
复现步骤
- Windows 桌面 app 打开任意 WSL2 remote workspace;
- 让 main agent 派一个
general-purpose子 agent 去执行一个需要Edit的任务; - 观察:子 agent 报告无 Edit 工具,cli log 中
agentType=Explore。
最小日志样本
- WSL:
~/.zcode/cli/log/zcode-2026-07-02.jsonl(本会话,agentType全为 Explore) - Windows:
C:\Users\<user>\.zcode\cli\log\zcode-2026-07-02.jsonl(含 25 次general-purpose成功记录作对照)
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
Reproduce the behavior in a Windows desktop app connected to a WSL2 workspace, using the agentType values in the cited CLI logs as the comparison. Read the built-in agent definitions in zcode.cjs and zcode-server.cjs around createBuiltInAgents(), then trace remote capability handling. Done means the remote mode is documented as intentionally read-only or general-purpose agents retain the expected writable tools.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, linux, ubuntu
- Domain
- devtools, operating-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100