## 背景 enhance-0819.md P2.1 子代理护栏五维度: - 维度 1-4 + worktree 已落地 (PR #82/#99/#73) - **维度 5 背景默认 spawn** (line 577) 仍 ⏳ "延后单独 item" ## 现状 `shouldRunAsync` (AgentTool.tsx:884-891) = 5 个 force-async OR 条件 + `!isBackgroundTasksDisabled`: - `run_in_background === true` (显式) - `selectedAgent.background === true` (agent 定义) - `isCoordinator` (COORDINATOR_MODE feature) - `forceAsync` (fork subagent 实验) - `assistantForceAsync` (KAIROS assistant 模式) - `proactiveModule?.isProactiveActive()` (主动模式) async-from-start 基础设施**已存在**: `shouldRunAsync=true` → `registerAsyncAgent` (LocalAgentTask.tsx, `isBackgrounded: true` 立即, 无 timer) → `runAsyncAgentLifecycle` (agentToolUtils.ts)。line 1022 `if (shouldRunAsync)` 分支已接通。 ## 缺口 用户无 env 开关让**默认**子代理 spawn 即后台 (非队友), 解阻塞主 turn。item 12 (FUSION_SUBAGENT_AUTO_BACKGROUND_MS, PR #103) 是**正交**路径 — 只影响 foreground else 分支的 mid-run 后台化定时器, 非 async-from-start。 ## 落地方案 (surgical) 1 个 helper + 1 个 `||` 项 + 1 test: - `src/tools/AgentTool/autoBackground.ts` 加 `isSubagentDefaultBackground()` 解析 `FUSION_SUBAGENT_DEFAULT_BACKGROUND` (isEnvTruthy, default off) - `AgentTool.tsx` `shouldRunAsync` 加第 6 `||` 项: `(!isInProcessTeammate() && isSubagentDefaultBackground())` — `!isInProcessTeammate()` guard 复用 line 455 既有模式 (in-process 队友生命周期绑 leader 进程不可后台, 已有 throw) - 新 test sibling `subagentAutoBackground.test.ts` **default off** (env 未设 = false) → byte-identical 旧行为, 无独立 feature flag。对齐 PR #82/#94/#99 env-gated opt-in 模式。 ## 验证 typecheck 0 / 单测 pass / build:dev pass / biome changed 文件 clean。
Activity
feat(agent): 维度5 背景默认 spawn FUSION_SUBAGENT_DEFAULT_BACKGROUND (P2.1) (…