Repository navigation
fix(computer): 修复同步请求取消竞态并补齐终止追踪 - #1243
Conversation
…t-cancellation-f07
swjnxyf
left a comment
There was a problem hiding this comment.
Reviewed PR #1243 directly on MSI at aae5e956504b7e8f6f69ffc1b58d023180debd46.
The cancellation race is handled at the correct Runner Registry authority boundary. Before dequeue/dispatch, only a synchronous Computer request with no durable Job identity, a closed exact waiter, and dispatched=false is retired. Once dispatched, waiting-client loss remains uncertain; the implementation makes no claim of native cancellation, wire receipt, or effect replay safety. The tokio::time::timeout(..., &mut receiver) change retains waiter ownership through dispatch-certainty cleanup under the Registry lock, preventing abandoned-request sweeps from erasing not_started evidence.
I checked all three cancellation paths (poll, abandoned sweep, explicit cancel), bounded waiter_closed/explicit_cancel telemetry, the ordering of cancellation event before exact synchronous correlation finalization, preservation of durable Job ownership, and metadata-only/no-body trace projection. The WebSocket/QUIC streaming backpressure tests deliberately distinguish Registry dequeue from writer-channel transmission. No additional authority or automated re-dispatch was introduced.
Independent MSI tests:
cargo test -p webcodex-runner-registry --lib --offline: 380 passed, 1 ignored.- ToolRuntime timeout ownership race, WS/QUIC streaming backpressure, and exact-correlation cancellation regressions: 3 passed.
cargo test -p webcodex computer --lib --offline: 76 passed (including the dedicated tests above).cargo test -p webcodex tool_request_trace --lib --offline: 47 passed; exact queue metadata privacy test also independently passed.cargo fmt --all -- --check,git diff --check, and Markdown local links (1,129 checked; 0 missing): passed.- Exact-head GitHub Actions CI: 18/18 jobs succeeded, and no unresolved review threads.
No blocking findings, no corrective commits necessary. Approved for squash merge. This PR addresses queue cleanup, timeout evidence, and cancellation telemetry, but does not claim to fully resolve the broader F07 / #1170 original late-observation investigation.
关联 #1170(F07)、#1242
问题与改动
同步 Computer 请求失去等待方后仍可能从 Registry 队列派发;超时收尾还存在接收端提前释放、未派发证据被其他清理路径移除的竞态。不同取消入口的终止追踪也不一致。
本修改:
回归覆盖
验证
受检提交:023d18c7cdeac22960b3e172ae2e16f35ca90404,构建时工作区干净。
https://github.com/Corden404/webcodex/actions/runs/39569702452
范围
Registry 出队并标记派发之后,即使请求仍受 channel 背压阻塞,关闭等待方也不能证明它尚未进入传输。因此继续保留已派发状态,不新增效果重放或物理取消保证。
当前 PR 实现了队列清理、超时证据保留、取消追踪;F07 的解决仍需完成原始迟到现象的阶段归因、相应修复和固定条件复测。