Repository navigation
fix(antigravity): 防止工具执行期间误报空闲并修正回收顺序 - #3791
Conversation
deepcoldy
left a comment
There was a problem hiding this comment.
复审结论:发现 2 个本补丁新增的阻断问题,暂不建议合入。详见 src/adapters/cli/antigravity.ts:556 与 src/adapters/cli/antigravity.ts:353 的行内评论。
评审基于本地 498d2ad1ac20f824189838fcba07398c2bc09e8d(基线 3d0de8711d),与远端 4a92d06a1147820c8a2c68f6f0c2dab78fa93195 的补丁 range-diff 为 =。
【实际验证】
bun run build通过。- PR 相关 10 个单测套件:Vitest 314/314;同一批在 Bun 1.4.4 下也 314/314。
- 隔离集成:worker agy delivery 11/11、restart/reattach 2/2、busy bounded fallback 3/3、agy ACP 3/3、ACP reattach 2/2。
- 临时行为探针使用真实 adapter、实际 worker probe/recovery 函数与假时钟;当前 head 复现两个行内问题,同一探针在
3d0de8711d基线上不出现这两个等待行为。探针与临时 baseline worktree 均已清理,评审树无改动。 - 扩展跑
worker-agy-full-transcript时,:296/:304两个 adopt 用例在当前 head 单文件复跑及基线均同样超时,故不作为本 PR 增量回归。
【既有边界,不计入本 PR 新增阻断】
src/adapters/cli/antigravity.ts:362-363 仍把 transcript 读取异常映射成 undefined/非忙碌。探针从有效 busy transcript 变为触发 readSync 的 EISDIR 后,当前 head 与基线均得到 true → false。这是既有 fail-open;若后续要彻底关闭前台工具期间误就绪,需要区分“读取未知”与“确认完成”。
【CI】test (3/4) 已在 test/backend-outage-worker-report.integration.test.ts:53 失败,日志为 read-isolation 的 tmux liveness probe unknown;其余多个 job 仍排队。该失败点不在本 PR 修改文件,但当前合码门禁确实未绿。
| // racy when multiple botmux sessions run in parallel. | ||
| coldResumeTail = undefined; | ||
| if (resume && resumeSessionId) { | ||
| const path = !reattach && resolveAntigravityTranscriptPath(resumeSessionId); |
There was a problem hiding this comment.
阻断:reattach 的遗留尾部没有释放路径。 coldResumeTail 只在 !reattach 时生成,而 :789 的普通 composer 释放必须匹配它。worker 重新接入存活 agy 时,若已中断回合留下 PLANNER_RESPONSE(tool_calls),且 Interrupted 已滚出视口、只剩空 composer + ? for shortcuts,每次 isSessionBusy 都返回 true,排队输入无法释放。src/utils/busy-ready-fallback.ts:87-99 对 sessionStateBusy 直接 veto,bounded fallback 也不能兜底。
探针(真实 adapter + 实际 worker probe/recovery 函数、假时钟):reattach + 上述屏幕推进 60 秒,markPromptReady 为 0 次;只把屏幕恢复为明确的 Interrupted 后,1 秒内变为 1 次。相同探针在 3d0de8711d 基线上立即 ready。请补 reattach 的 stale-tail 恢复及“中断提示已滚出视口”回归;不能简单对 reattach 武装同一个 composer override,否则在途长工具会重新被误判 idle,需要能区分“存活进程仍在执行”与“中断遗留尾部”的证据。
| if (type === 'PLANNER_RESPONSE' || type === 'GENERIC' || type === 'USER_INPUT') { | ||
| return Number.isSafeInteger(rec.step_index) | ||
| ? JSON.stringify([rec.step_index, type, rec.status, rec.created_at]) | ||
| : JSON.stringify([transcriptPath, stats.ino, lineStart, type, rec.status]); |
There was a problem hiding this comment.
阻断:无 step_index 的记录身份在 compact/full 切换后不稳定。 这个回退指纹包含 transcript 路径、inode 和 offset,而 resolveAntigravityTranscriptPath 会优先选择后出现的 transcript_full.jsonl。冷恢复快照来自 compact 后,即使 full 携带相同 type / status / created_at 的同一记录,指纹仍不相等,:789 的 composer 释放永久失效。边界限于没有 safe-integer step_index 的记录;有索引的路径不受影响。
探针:cold resume 的 compact 尾部为无 step_index、带 created_at 的 USER_INPUT,第一次 compact probe 可以释放;在 ZMX settle continuation 发布就绪前写入内容相同的 full,推进假时钟 60 秒仍未 ready,删除 full 后 1 秒内 ready。基线在同一序列下立即 ready。请改用跨 compact/full sibling 稳定的记录身份,并补“无索引记录 + settle 窗口出现 full”的回归用例。
Co-Authored-By: Claude Code <[email protected]>
|
增量提交
独立对抗复核中发现并处理的计时误放、full 掩盖进展、同时间戳碰撞三项问题及探针证据已写入 PR 描述。新 head CI 正在排队,合码以首跑全绿为准。 |
Co-Authored-By: Claude Code <[email protected]>
|
测试补强提交
PR 描述已同步更新。新 head CI 首跑待执行,合码以其全绿为准。 |
|
感谢贡献,已 squash 合入 master(0bf90b5b89)。 合入前评审中确认并补齐的两点:
后续 follow-up(不在本 PR 范围):
这是自动评审的初步意见落地记录,最终以维护者审阅为准。 |
|
🚀 Released in v3.59.32 |
共享 worker 达到数量上限时,一个长任务可能在发出最终回复前被挂起。可独立复现两个环节。
? for shortcuts且暂时没有esc to cancel。旧探针会用该输入框覆盖 transcript 中已发出的 tool call,向 daemon 发送prompt_ready。修复
设计取舍
验证
prompt_ready;补丁经历两次探测均未收到,写入最终回复后收到就绪事件。bun run build通过。bun x vitest run --project unit test/antigravity-{idle-composer,cot,submit,interruption,transcript,subagent-finals}.test.ts test/{idle-worker-sweeper,idle-reclaim-unsettled-turn,worker-ready-keeps-busy-turn-authority,worker-busy-ready-recovery}.test.ts,10 个套件、314 项通过。bun x vitest run test/worker-agy-delivery.integration.test.ts,完整 worker 投递集成套件 11 项通过,覆盖本次前台工具回归、原生错误、中断恢复和延迟提交。增量修复(5b453aaf1a)
step_index的记录身份:使用跨 compact/full 稳定的内容头尾、时间戳、来源及 tool-call 身份,不再依赖路径、inode 或字节偏移。相同时间戳但内容不同的新输入不会被误认为旧尾部;没有稳定字段时仍保留保守位置身份。/restart走全新非 reattach 冷恢复解除。agy DB schema / ACP 权威状态调研留作后续工作,本 PR 不声称已有该信号。独立对抗复核与探针证据
t0=true → t30s=true → t60s=false,证明固定静默窗只会延后原问题;该实现及对应测试已整体撤除,未进入提交。[type,status,created_at]而误判旧尾部;现加入内容头尾与 tool-call 身份,不同时间戳对照仍判忙。/restart交叠。/restart用例先跨越真实 probe 间隔确认排队消息未提交且无prompt_ready,再验证 cold resume 后消息恰好投递一次、restart receipt 成功。增量验证
bun run build通过;test-hygiene28/28。restart-reattach-antigravity+worker-agy-delivery合计 14/14,含上述/restart逃生用例。测试补强(f144327453)
a newer closed compact final overtakes an older busy full tail,覆盖 compact 已写 final(更新、closed)而 full 仍挂旧 tool_calls(更旧、busy)的常态释放方向。busy=true),其余 43 项仍绿;还原后聚焦 44 项复绿,完整相关套件双引擎均为 320/320。🤖 Generated with Claude Code