Skip to content

Allow clean cancelled BYOM settlements to retry through cancellation grace #173

Description

@danny-avila

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions