Repository navigation
Description
Workflow #863 and draft #1129 implement opt-in deadline-triggered cleanup for embedded queue workers. Native delivery needs the same agreed contract in workflow/docs/architecture/timeout-cleanup.md; embedded publication alone does not complete the service-mode behavior.
Owners: Server owns native runtime and capability admission. Workflow owns the portable contract and embedded runtime. PHP, Python and Rust SDK owners own worker delivery. Their current parser/subtype PRs (sdk-php#402, sdk-python#311, sdk-rust#248) are preparatory and must not advertise end-to-end support yet.
Acceptance:
- Immutable admission: finite allowance 1–86,400 seconds, smaller than each configured hard timeout; work deadline = hard deadline minus allowance. No clock is based on detection or worker restart. Native reads the admitted values from WorkflowStarted, with no new native column required.
- Under the run lock, enter once at the earliest work deadline and before the earliest hard deadline. Record WorkflowTimeoutCleanupStarted with timeout_kind, work_deadline_at, cleanup_deadline_at, hard_deadline_at and detected_at, plus an engine-owned cooperative request.
- Deliver a top-level optional cancellation-context v1/v2
cause(timeoutorcancellation; absent means cancellation). Preserve explicit cancellation on round-trip. Descendants, including scoped children, do not inherit the root's cause. The kind and work deadline are event fields, not context fields. Reuse cancellation cleanup delivery and its original deadline. - Publish
timeout_cleanup: {supported: true, version: 1}only after runtime support, and refuse an opted-in start when no eligible worker on the queue advertises support. Do not silently fall back to hard timeout. The capability check is admission-only. - Every final cleanup result is WorkflowTimedOut with failure_category timeout and a separate timeout_cleanup outcome: completed, failed with linked failure_id, expired, or preempted on hard cancel/terminate. Describe, export and failure lists say cleanup failed plainly. Repairable replay/version/history errors remain blocked for repair.
- A user cooperative request during timeout cleanup is audited without replacing the engine request or renewing the deadline. An earlier cooperative request owns cleanup; if the hard timeout wins, mark that cooperative cleanup preempted. Keep activity cancellation-policy semantics, including settlement before terminal history.
- Continue-as-new and redrive inherit the allowance and execution clocks; new run clocks are derived as today. Run contract vectors 1–12 plus task-boundary expiry, scoped descendants, replay-blocking precedence, user/hard cancellation, and worker replacement.
The rethrow marker must be language-neutral. Proposed portable failure field for review: interruption: "timeout_cleanup" on fail_workflow.failure. SDK workers set it only for an uncaught timeout-cleanup interruption. The runtime maps it to timeout_cleanup.outcome completed only while the run's canonical engine-owned timeout request is active; other failures remain cleanup failed. Never infer interruption from PHP/Python exception class names or let this marker initiate cleanup. The marker is gated by timeout_cleanup capability, and malformed/unknown markers are refused before writes. Server and SDK owners should confirm the exact wire placement here before implementation.
Next action: Server reviews the marker placement and owns an isolated native implementation PR. Workflow will link the qualified embedded release and exact published-tuple acceptance here; ordinary SDK parsing alone is not conformance evidence.
Activity
rmcdaniel commentedon Nov 13, 2026
Rust SDK review: fail_workflow.failure.interruption = "timeout_cleanup" is a suitable language-neutral placement. Rust can set it only when an uncaught Error::CooperativeCancellationRequested carries CancellationRequest::cause() == CancellationCause::Timeout, and only after exact timeout_cleanup capability admission. A caught interruption followed by application failure must remain failed. The runtime must verify its active canonical engine-owned timeout request before interpreting the marker; the marker cannot initiate cleanup, change deadlines or turn any other run into a successful cleanup. Unknown/malformed values should refuse before writes. Parser-only sdk-rust#248 is preparatory and will not emit this marker or advertise runtime support; worker delivery/settlement follows the qualified Server implementation here. Owner for that Rust follow-through: sdk-rust.
rmcdaniel commentedon Nov 13, 2026
Python confirms the proposed exact placement: commands[].type=fail_workflow with failure.interruption="timeout_cleanup", only for an uncaught WorkflowTimeoutCleanupRequested and only after timeout_cleanup capability admission. The runtime must require the canonical active engine timeout request and original deadline; the marker cannot start cleanup or override a non-timeout failure. Parser/subtype PR sdk-python#311 remains preparatory and does not add this marker or advertise capability. Owner: sdk-python for the later worker mapping, Server for runtime/marker admission.
rmcdaniel commentedon Nov 13, 2026
PHP owner review: sdk-php#402 remains cause-only parser/subtype preparation; it does not advertise timeout_cleanup or send an interruption marker. The proposed nested fail_workflow.failure.interruption="timeout_cleanup" placement is suitable as a language-neutral marker, provided only a canonical active engine-owned cleanup request authorizes the completed outcome and unknown/malformed markers refuse before writes, as stated here. PHP will add the marker in a separate capability-gated worker change after the native wire contract is final, with retained-history replay coverage. Ordinary failures and a caught/returned timeout interruption must keep the runtime-defined outcomes.
rmcdaniel commentedon Nov 13, 2026
Native wire review:
fail_workflow.failure.interruption: "timeout_cleanup"is an appropriate language-neutral placement. Reserve that exact string as an engine-interruption discriminator; do not derive it from exception class names or a user-supplied failure category.Before any state write, native must validate a closed marker set and its type, require the negotiated timeout-cleanup capability, and verify the run's canonical engine-owned timeout request is already active under the transition lock. The marker cannot initiate cleanup, replace a request, extend a deadline, or change a scoped descendant's cause. A valid uncaught interruption then means cleanup completed and the run still closes as timed out; an ordinary failure remains cleanup failed. Include malformed/unknown marker, unsupported capability, inactive or user-cancellation context, wrong run/scope, hard-deadline race, and replacement-worker controls in the shared vectors.
Owner/next action: server implements native admission/delivery only after the portable contract and the current #934 release correction. The proposed marker and SDK parser/subtype changes do not advertise runtime support. Capability publication still needs the runtime and installed cross-language evidence described in this issue.
rmcdaniel commentedon Nov 13, 2026
Python follow-through owner remains sdk-python. Parser/exception PR sdk-python#311 is refreshed on published 2.17.1 source, with all 21 checks green and final Security countercheck requested. General confirmed it may merge as experimental preparation, with no capability advertisement and no standalone version-alignment release. Next action when the producer is qualified: sdk-python adds the agreed failure.interruption mapping and capability admission, then publishes and verifies a named installed SDK/Server tuple. The preparatory parser itself is not end-to-end timeout-cleanup acceptance.
Timeout cleanup: child opt-in, claim/completion entry, describe state (…
rmcdaniel commentedon Nov 25, 2026
The native implementation shipped dark in Server 3.14.0 (#1235):
WorkflowStarted, with one-time entry under the run lock (WorkflowTimeoutCleanupStarted).cause: "timeout"is set on the root context only.WorkflowTimedOutrecords the completed, failed, expired or preempted outcome. User requests are audited.failure.interruption: "timeout_cleanup"marker is validated before any write.timeout_cleanup::ADVERTISEDis stillfalse, so the capability is not published.Remaining:
timeout_cleanup {supported, version: 1}in the worker capability manifest, and sendfailure.interruption: "timeout_cleanup"only for an uncaught timeout-cleanup interruption. The merged parser PRs (Read the timeout cleanup cause on the cancellation context (workflow#863) sdk-php#402, Read the timeout-cleanup cause on cancellation contexts sdk-python#311, Read the cancellation context's timeout-cleanup cause sdk-rust#248) readcauseonly. No SDK release advertises the capability or sends the marker.ADVERTISED, and publish the named SDK/Server tuple.Next action: implement the capability and marker in one SDK worker (Rust is the smallest surface) against Server 3.28.0, then run the installed vectors.
rmcdaniel commentedon Nov 25, 2026
The PHP SDK worker side is merged in durable-workflow/sdk-php#481 (merge
840be2c235115360488f318efeb790f7b98da7e2). A worker with cooperative cancellation enabled registerstimeout_cleanupwith manifest{supported: true, minimum_protocol_version: "1.20", version: 1}. When the deliveredWorkflowTimeoutCleanupRequestedescapes, uncaught or rethrown, the worker sendsfail_workflow.failure.interruption: "timeout_cleanup". The marker requires the engine's root context withcause: timeout. Constructed, wrapped and ordinary-cancellation failures are not marked.I ran a source-checkout check against published native 3.28.0 (
sha256:43242a89…):timeout_cleanup_not_supported.WorkflowTimedOutwith outcomecompleted.failedwithfailure_id.expired.Each run had one
WorkflowTimeoutCleanupStartedand closedfailed/timed_out.Next: a PHP SDK minor release. Server can then run installed vectors 1 to 12 against that published tuple and flip
ADVERTISED.rmcdaniel commentedon Nov 25, 2026
PHP SDK 3.31.0 is published (Packagist reference
ab9e1238) with this issue's PHP worker support (the `timeout_cleanup` capability and interruption marker, sdk-php#481).rmcdaniel commentedon Nov 25, 2026
Native now advertises
timeout_cleanup: {supported: true, version: 1}in cluster info and in worker responses (#1336, merge6d03a7d1). It is unreleased: it will ship in the next native release.sha256:a2f588ec…, SQLite) with workers on the published PHP SDK 3.31.0. The run covers admission refusals, completed (returned and rethrown), failed withfailure_id, expired, preempted by terminate and hard cancel, late detection, worker SIGKILL and replacement, continue-as-new on execution and run clocks, earliest-deadline kind, user-request preemption, unchanged default, and allowance validation.scripts/conformance/timeout-cleanup/run.sh. After the release, rerun it with the new image andEXPECT_ADVERTISED=true.outcome: "running"while cleanup is open, matching Workflow 2.40.0.failure.interruption: "timeout_cleanup", the same as PHP:fc68dbea)93ffd31b)Remaining for this issue:
timeout_cleanupas the contract says. Add it or register a divergence.🤖 Generated with Claude Code
Prepare native Server 3.30.0
Prepare native Server 3.30.0
Prepare native Server 3.30.0
Prepare native Server 3.30.0
rmcdaniel commentedon Nov 26, 2026
Released: native Server 3.30.0 advertises
timeout_cleanup: {supported: true, version: 1}(#1336) and returns the run observation (#1344). The supporting workers are PHP SDK 3.31.0+ (3.32.0 for the stricter marker rule), Rust SDK 4.25.0 and Python SDK 2.24.0. The 3.30.0 release notes carry the mixed-queue upgrade paragraph.Published-tuple vectors (server#1363): against image
sha256:b7bb6007…(3.30.0) withEXPECT_ADVERTISED=true, PHP SDK 3.32.0, Python SDK 2.24.0 and Rust SDK 4.25.0 each pass 110/110: vectors 1–12, admission refusal and discovery. A Python run under 2-CPU contention hit an SDK spawn-readiness timeout and then passed on rerun; that is tracked in sdk-python#388.This stays open for the acceptance items the harness doesn't cover: task-boundary expiry, scoped descendants not inheriting the cause, replay-blocking precedence, redrive inheritance, and refusal of a malformed marker or one from a non-capable worker, all against the published tuple.
rmcdaniel commentedon Nov 26, 2026
The remaining cases pass against the published tuple, so this issue is done.
Run: native Server 3.30.0 image
sha256:b7bb6007…(SQLite, advertisestimeout_cleanupv1) with PHP SDK 3.32.0 workers. The harness change is #1373 (merge118d05ce). The full default run passed 188 of 188 checks: vectors 1–12 plus admission and discovery (110), and the new extended cases (78). After review tightened the scoped-descendant checks, the final extended run passed 80 of 80.WorkflowTimedOutexpiredat the original deadline, never completed.cause; the timeoutcausestays only on its root context. A child cancelled by the parent's cleanup (try_cancel) gets a request with nocause, rooted at the parent's request, and its code sees an ordinaryWorkflowCancelled.next_task_id: null, nothing claimable), not failed cleanup, until the hard deadline expires it. An ordinary failure is retried instead."cancellation",1,trueor an object is refused with 422invalid_workflow_failure_interruptionbefore any write. A marker sent before cleanup starts is refused with 409timeout_cleanup_interruption_not_active.timeout_cleanup_not_supportedfor the marker. Its unmarked failure recordsfailed.No native defect was found, so nothing new ships in the next release for this issue.
Recorded decision on marker normalization. Native normalizes every request body like Laravel does (TrimStrings, then ConvertEmptyStringsToNull), and the marker is no exception:
interruption: ""is treated as absent, so it is an ordinary failure recorded asfailed." timeout_cleanup "is trimmed to the reserved value. On a turn that holds the active engine request and negotiated the capability, it recordscompleted.Neither case can create a false completion. That would still need the active engine request and a capable claim. The harness locks both behaviours in.
Closing.
🤖 Generated with Claude Code