Skip to content

item 12: 子代理自动后台化阈值 FUSION_SUBAGENT_AUTO_BACKGROUND_MS (CC 2.1.198/232) #102

Closed

Description

@dahai80

背景

enhance-0819.md item 12 (CC 2.1.198/232): 子代理默认后台化。现 subagent 走 sync foreground 阻塞 turn (toolExecution.ts:1392 await), getAutoBackgroundMs() (AgentTool.tsx:161) 仅读 CLAUDE_AUTO_BACKGROUND_TASKS/GrowthBook, default 0=off。OSS 构建 GrowthBook 不生效 → subagent 永不自动后台。

缺口

无 fusion 可配阈值。item 4 (PR #94) 已为 MCP 落 FUSION_MCP_AUTO_BACKGROUND_MS, 但 subagent 走独立路径 (AgentTool/LocalAgentTask), 不共享代码。

方案 (surgical)

扩 getAutoBackgroundMs() 加 FUSION_SUBAGENT_AUTO_BACKGROUND_MS env 分支 (并行 item 4 MCP 模式), 解析 ms default 0=off。复用现成 registerAgentForeground 定时器→backgroundSignal→mid-run 后台化 (:1263) 解阻塞。default off, byte-identical 旧行为。无需 QueryEngine 解耦。

验收

  • env 未设/0 → 行为不变 (sync 阻塞)
  • env=60000 → subagent 60s 后转后台, turn 解锁
  • typecheck 0, 全测 pass, build pass

跨工程规则

仅改 fusion-code。Commit trailer: Co-Authored-By: Claude Fable 5 [email protected]

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions