fix(web): recover unknown prompt admissions - #492
Conversation
a5547ae to
82ee3ff
Compare
tt-a1i
left a comment
There was a problem hiding this comment.
Reviewed at exact head 82ee3ff.
Standards
[P1] sendPromptAsNew clears promptAdmissionRecovery before the replacement admission is attempted. If another preflight guard such as modelSelectionPending makes sendPrompt return false, the warning is gone although no new command crossed admission and the original remains unknown. Preserve recovery until the new command is actually admitted, atomically and on every failure path.
[P1] Matching late canonical accepted/settled/turn evidence clears recovery in the store, but Composer leaves the same restored text in its local draft. The next Enter creates a fresh command ID and can duplicate an already-handled side-effecting prompt. Reconcile recovery, optimistic projection, and editor text atomically when terminal evidence arrives.
Spec
[P1] checkPromptAdmissionRecovery() ignores the boolean result of refreshSnapshot() and unconditionally enables “Send as new.” A failed/stale refresh after the same outage that caused UNKNOWN therefore authorizes a duplicate from stale history. Keep recovery fail-closed until canonical refresh succeeds, or expose a verification-failed retry state.
[P2] setWorkspace() does not clear the old Session recovery, and clearing an edited draft makes “Send as new” silently fall back to the original uncertain text. Add coverage for refresh failure, workspace transition, empty edit, late evidence, and double-action concurrency.
c7ada14 to
4f5b0f3
Compare
|
主要调整:
被 #533 阻塞 |
Problem
修复 #463。
网络异常后,Web 会复用原来的
commandId重试消息。如果 Host 已经找不到这条请求的接收记录,会返回COMMAND_ADMISSION_UNKNOWN。此前前端会继续保留旧请求身份,后续重试一直失败,同时界面可能停留在“正在准备任务”。用户既无法判断上一条消息是否真正送达,也无法从当前界面安全地继续操作。
Value
让接收状态不确定的消息有明确的处理出口,同时保留现有的防重复执行保护。
前端不会再把 UNKNOWN 当成任务正在运行,也不会自动生成新身份重新发送。是否重新发送由用户决定,并明确提示可能产生重复消息。
Approach
COMMAND_ADMISSION_UNKNOWN。commandId后重新发送,并提示可能产生重复消息。Validation
bun run test:1351 个通过,9 个跳过,4 个无关的并发或环境时序用例失败;对应文件隔离重跑均通过。bun run check中配置检查、纪律检查、Web 类型检查和构建通过;全仓格式检查仍受当前 Windows 工作区已有 CRLF 问题影响,共报告 118 个无关文件。Impact