zai-org / zai-org/feedback

[Bug] WSL remote 模式下可写子 agent (general-purpose) 被降级为只读 Explore,无法执行写操作

Open
#73 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

priority: P2
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-remote
  • ZCODE_PROCESS_LABEL:server 侧未设置
  • 模型:builtin:bigmodel-coding-plan/GLM-5.2
  • 工作区:/zcode/ZCodeSentinel

核心矛盾:代码层可达,运行时不可达

代码层面一切正常,grep 已逐条确认:

  1. 客户端 zcode.cjssubagent_type 是自由字符串(无 enum 硬限):
    subagent_type: T.string().optional().describe("The type of specialized agent to use for this task")
    
  2. 客户端 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());
    }
    
  3. 客户端 cjs 中无任何 authorityMode / attached-remote 过滤逻辑(grep -c attached-remote = 0)。
  4. server zcode-server.cjs:204375 createBuiltInAgents() 中 general-purpose 与 Explore 对等定义,均 enabled: true
  5. 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 定位,推测在以下两处之一:

  1. remote 协议握手时,server 上报自身能力,客户端据此在内存中动态裁剪/替换 profiles(覆盖了 Obe 的结果);
  2. general-purpose profile(Iln())的 tools:["*"] 在 remote 模式被降级为 Explore 工具集。

请确认 desktop-attached-remote 模式下可写子 agent 的工具集是否被刻意限制:

  • 若是产品决策,请在文档 / UI 标注,避免用户误以为可用;
  • 若是 bug,望修复,以支持 WSL 下的 subagent-driven 工作流。

复现步骤

  1. Windows 桌面 app 打开任意 WSL2 remote workspace;
  2. 让 main agent 派一个 general-purpose 子 agent 去执行一个需要 Edit 的任务;
  3. 观察:子 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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.