Problem
The bridge now keeps cancelled mutating assignments open for CANCELLED_WORKSPACE_SETTLEMENT_GRACE_MS after execution expiry so a clean rejected settlement can be acknowledged. However, the worker can still call settleWithRetry with localDeadlineAtMs for a clean atomic cancellation when the sandbox had started and the error does not require quarantine.
A Stop near the execution deadline therefore cuts off settlement retries before the bridge cancellation-grace poll completes. The client receives ASSIGNMENT_EXPIRED, and the durable workspace mutation guard can remain armed.
Locations
service/src/bridge/store.ts, cancelled workspace settlement grace in waitForSettlement
packages/code/src/worker.ts, clean rejection classification and the default settleWithRetry(..., localDeadlineAtMs, ...) path
Expected behavior
Clean cancelled workspace-tool rejections should retry settlement through a deadline aligned with the bridge cancellation grace. Add a regression for Stop arriving near the original execution deadline after the sandbox has started.
Reported while syncing #172 into ClickHouse/ai; Bugbot discussion: https://github.com/ClickHouse/ai/pull/3685#discussion_r3969043899
Problem
The bridge now keeps cancelled mutating assignments open for
CANCELLED_WORKSPACE_SETTLEMENT_GRACE_MSafter execution expiry so a clean rejected settlement can be acknowledged. However, the worker can still callsettleWithRetrywithlocalDeadlineAtMsfor a clean atomic cancellation when the sandbox had started and the error does not require quarantine.A Stop near the execution deadline therefore cuts off settlement retries before the bridge cancellation-grace poll completes. The client receives
ASSIGNMENT_EXPIRED, and the durable workspace mutation guard can remain armed.Locations
service/src/bridge/store.ts, cancelled workspace settlement grace inwaitForSettlementpackages/code/src/worker.ts, clean rejection classification and the defaultsettleWithRetry(..., localDeadlineAtMs, ...)pathExpected behavior
Clean cancelled workspace-tool rejections should retry settlement through a deadline aligned with the bridge cancellation grace. Add a regression for Stop arriving near the original execution deadline after the sandbox has started.
Reported while syncing #172 into ClickHouse/ai; Bugbot discussion: https://github.com/ClickHouse/ai/pull/3685#discussion_r3969043899