Skip to content

feat(agent): 维度5 背景默认 spawn FUSION_SUBAGENT_DEFAULT_BACKGROUND (P2.1, #126) - #127

Merged
dahai80 merged 1 commit into
mainfrom
feat/subagent-default-bg-dim5
Aug 22, 2026
Merged

dahai80 merged 1 commit into
mainfrom
feat/subagent-default-bg-dim5

Conversation

@dahai80

@dahai80 dahai80 commented Aug 22, 2026

Copy link
Copy Markdown
Owner

背景

closes #126

enhance-0819.md P2.1 子代理护栏五维度:

缺口

shouldRunAsync (AgentTool.tsx) = 5 个 force-async OR 条件, 用户无 env 开关让默认子代理 spawn 即后台 (非队友) 解阻塞主 turn。item 12 (FUSION_SUBAGENT_AUTO_BACKGROUND_MS, PR #103) 是正交路径 — 只影响 foreground else 分支 mid-run 后台化定时器, 非 async-from-start。

落地 (surgical, +90/-1, 3 文件)

  • autoBackground.ts 加 isSubagentDefaultBackground() 解析 FUSION_SUBAGENT_DEFAULT_BACKGROUND (isEnvTruthy, default off)
  • AgentTool.tsx shouldRunAsync 加第 6 || 项: (!isInProcessTeammate() && isSubagentDefaultBackground())
    • async-from-start 复用既有 registerAsyncAgent (isBackgrounded:true 立即, 无 timer) + runAsyncAgentLifecycle
    • !isInProcessTeammate() guard 复用 line 455 既有 throw 模式 (in-process 队友生命周期绑 leader 进程不可后台)
  • subagentAutoBackground.test.ts +11 单测 (truthy/fail-off/default-off 全覆盖)

设计

gates

  • typecheck 0
  • 18 单测 pass (7 item12 旧 + 11 维度5 新)
  • 407 全套 pass, 0 回归
  • build:dev pass
  • biome: 变更文件 0 新 error (AgentTool.tsx baseline 既有 noise 未动)

影响范围

默认行为零变更。仅当用户显式设 FUSION_SUBAGENT_DEFAULT_BACKGROUND=1 (或 true/yes/on) 时, 默认子代理 spawn 即后台化 (非 in-process 队友)。失控子代理仍受维度 1-4 护栏 (并发/会话/深度/预算) 约束。

Co-Authored-By: Claude Fable 5 [email protected]

shouldRunAsync 加第 6 || 项: (!isInProcessTeammate() && isSubagentDefaultBackground())。
env 开关让默认子代理 spawn 即后台 (非队友) 解阻塞主 turn。async-from-start
复用既有 registerAsyncAgent (isBackgrounded:true 立即, 无 timer) + runAsyncAgentLifecycle。

与 item 12 FUSION_SUBAGENT_AUTO_BACKGROUND_MS 正交: item 12 是 foreground else
分支 mid-run 后台化定时器; 本开关是 async-from-start。

!isInProcessTeammate() guard 复用 line 455 既有 throw 模式 (in-process 队友生命周期
绑 leader 进程不可后台)。default off (isEnvTruthy 未设/空/false/0 → false),
byte-identical 旧行为, 无独立 feature flag。对齐 PR #82/#94/#99 env-gated opt-in。

新 isSubagentDefaultBackground() helper (autoBackground.ts, sibling item 12 模式),
+11 单测 (truthy/fail-off/default-off 全覆盖)。

gates: typecheck 0 / 18 新+旧单测 pass / 407 全套无回归 / build:dev pass /
biome baseline 不变 (变更文件 0 新 error)。

closes #126

Co-Authored-By: Claude Fable 5 <[email protected]>
@dahai80
dahai80 merged commit 23fde84 into main Aug 22, 2026
1 check passed
@dahai80
dahai80 deleted the feat/subagent-default-bg-dim5 branch August 22, 2026 13:29
dahai80 added a commit that referenced this pull request Aug 22, 2026
Patch release bundling 17 commits since v0.4.23:
- item 15(a) MLX OOM auto-recovery gc+retry (#129)
- #7 one-click diagnostic fixAction framework (#131)
- 维度5 background-default spawn FUSION_SUBAGENT_DEFAULT_BACKGROUND (#127)
- #4 proactive MLX OOM detection via /v1/health (#125)
- item 17 fullscreen pre-compact history + :598 synthetic decouple (#123)
- item 25B workflow stagger fan-out (#122)
- item 21 auto-mode local rule classifier test coverage (#120)
- item 23 archive plugin source + SHA-256 lock (#118)
- item 24 marketplace command source (#116)
- item 6 transcript disk trimming + crash-safe checkpoint (#114)
- item 5 normalizeMessages secondary normalize cache (#112)
- item 19 screen-reader plaintext render (#110)
- item 16 compact retry countdown + stall hint (#108)
- item 25A workflow execution runtime docs (#106)
- item 25A minimal workflow execution runtime (#105)
- item 12 subagent auto-background threshold (#103)
- item 20 vimInsertModeRemaps dual-key INSERT sequence (#101)

Co-Authored-By: Claude Fable 5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

维度5 背景默认 spawn: FUSION_SUBAGENT_DEFAULT_BACKGROUND env-gate (CC P2.1 维度5)

1 participant