Repository navigation
Commit 4706178
committed
fix(agent): 切工作目录闪 2 次 (initRuntime 二次 reload)
根因: setCwd 写 APP_CWD 后 reload, reload 后 initRuntime 走 hostCwd 兜底
检查时仍命中 reload 条件 → 二次 reload 表现为 '切工作目录闪 2 次'.
原条件 (web/src/service/agent.ts:111):
if (hostCwd && cwd !== hostCwd && APP_CWD_FALLBACK !== hostCwd) { reload; }
// 注释说 '无 APP_CWD' 但代码没检查 cwd 是否空
复现: 用户初始 APP_CWD='' (hostCwd 兜底), 选非 hostCwd 目录:
1. setCwd 写 APP_CWD=新值, reload anomalyco#1
2. reload 后 initRuntime: cwd=新值 (有 APP_CWD), hostCwd 不等 → 二次 reload anomalyco#2
修复: 加 '!cwd' 短路 — 仅在无 APP_CWD (纯 hostCwd 兜底) 场景才 reload
重建 codeblitz 根, 已在 setCwd 写过 APP_CWD 后不再触发.1 parent 20c92fd commit 4706178
1 file changed
Lines changed: 6 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
103 | 103 | | |
104 | 104 | | |
105 | 105 | | |
106 | | - | |
107 | | - | |
108 | | - | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
109 | 109 | | |
110 | 110 | | |
111 | | - | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
112 | 114 | | |
113 | 115 | | |
114 | 116 | | |
| |||
0 commit comments