feat(agent): item 12 子代理自动后台化阈值 FUSION_SUBAGENT_AUTO_BACKGROUND_MS (CC 2.1.198/232) - #103
Merged
Merged
Conversation
…C 2.1.198/232) 扩 getAutoBackgroundMs 加 fusion env 分支 FUSION_SUBAGENT_AUTO_BACKGROUND_MS (并行 item 4 FUSION_MCP_AUTO_BACKGROUND_MS)。设正值 → subagent 运行该毫秒后 转后台, 复用现成 registerAgentForeground 定时器→backgroundSignal→mid-run 后台化解阻塞 turn。default 0=off, byte-identical 旧行为。无需 QueryEngine 解耦。 Closes #102 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
背景
Closes #102。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/GrowthBooktengu_auto_background_agents, default 0=off。OSS 构建 GrowthBook 不生效 → subagent 永不自动后台。item 4 (PR #94) 已为 MCP 落FUSION_MCP_AUTO_BACKGROUND_MS, 但 subagent 走独立路径 (AgentTool/LocalAgentTask), 不共享代码。方案 (surgical)
src/tools/AgentTool/autoBackground.ts:getSubagentAutoBackgroundMs()解析FUSION_SUBAGENT_AUTO_BACKGROUND_MSenv (parseInt, default 0=off, 负数/非数 fail-off)。getAutoBackgroundMs()加 fusion env 分支 (在 CLAUDE_AUTO_BACKGROUND_TASKS/GrowthBook 前), 正值即返回。registerAgentForeground定时器 (LocalAgentTask.tsx:590-616) →backgroundSignal→ mid-run 后台化 (AgentTool.tsx:1263) 解阻塞 turn。验证
subagentAutoBackground.test.ts7 pass (env 解析全 edge case)src/__tests__/187 pass, 0 fail跨工程规则
仅改 fusion-code。Commit trailer: Co-Authored-By: Claude Fable 5 noreply@anthropic.com