Repository navigation
Native: honour an activity's cancellation policy on whole-run delivery - #969
Conversation
…958) Delivery side and resume, following PHP Core's ActivityCancellationWait: - the activity branch and parallel/selection members read the activity's cancellation_policy; - wait_cancellation_completed holds the delivery (cancellation_activity_wait marker on the task, run waiting, claim released) until every listed execution has resolved; - the stop acknowledgement resumes the run with one ready workflow task; - abandon leaves the activity running (needs a finite schedule-to-close deadline). Not done yet: native's schedule_activity does not accept cancellation_policy at all (store.rs field list), so the new tests fail at scheduling. Next: accept the explicit policy with Core's protocol-1.20 gate and abandon precondition. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…#958) schedule_activity now accepts cancellation_policy, with Core 2.15's rules: - any explicit value needs protocol 1.20 and a cooperative claim, else 409 activity_cancellation_policy_not_supported (PHP's guard body); - abandon needs an integer schedule_to_close_timeout of at least 1, else 422 validation_failed under commands.N.schedule_to_close_timeout. The policy is stored in activity_options, so ActivityScheduled's activity snapshot names it; an abandoned activity's snapshot also names its schedule_to_close_deadline_at. With the delivery and resume work, the wait and abandon scenarios pass, and an unbounded abandon or a 1.19 policy are refused. The decision is in the port log. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Security bounded review at exact head The scheduling guard and durable snapshot match the locked Core source, but Native does not yet preserve an abandoned remote activity after the parent run reaches its canonical cooperative-cancelled terminal state:
That differs from the exact locked Workflow 2.15.12 authority ( The current regression masks both cases: Please add the narrow, fail-closed post-run authority rather than generally admitting activity work under terminal runs. It must require the exact canonical abandon snapshot/deadline and the matching cooperative cancelled-close identity. Cover at least:
This finding holds the exact head. The PR is also behind current main and its Sonar gate is failing, but those are separate from this product blocker. |
… their run Security's review of 2ed4b76: native ties activity work to an active parent (both activity candidate queries require a pending, running or waiting run, and completion goes through active_run). An abandoned activity would be stranded once the run closes, which isn't Abandon. Until #971 gives abandoned activities their post-run authority, native refuses an explicit abandon at scheduling with PHP's runtime refusal: 409 activity_cancellation_policy_not_supported with unavailable ["installed_runtime_activity_policy"]. try_cancel and wait_cancellation_completed are unchanged. The now-unreachable abandon timeout check is removed. The test covers the abandon refusal and a pre-1.20 policy. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…etup Sonar flagged 5.1% duplicated new lines (limit 3%): the activity policy guard repeated the child guard's protocol check and 409 body, and the tests repeated the cooperative worker registration. cancellation_policy_guard now serves both. Child keeps its protocol parsing; activity requires a strict 1.N version and adds installed_runtime_activity_policy for abandon (#971). register_cooperative replaces the repeated registration. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Security re-review of exact b7154f6: the narrowed implementation is now fail-closed for explicit abandon, but the authoritative record still claims the removed behavior. The new November 2 decision in docs/rust-server-port.md says abandon only needs a finite schedule_to_close_timeout and delivers without cancelling, while store.rs now returns 409 activity_cancellation_policy_not_supported with unavailable [installed_runtime_activity_policy]. The completion-rule descriptor also still says remote abandon requires a finite schedule_to_close_timeout. Those statements would advertise a lifecycle this release deliberately does not support and conflict with #971. Please update both durable descriptions to say try_cancel and wait_cancellation_completed are admitted under the 1.20/cooperative gate, while abandon is refused with the runtime-gap reason until #971 supplies post-run authority. The implementation narrowing itself is consistent with the original finding; this exact head remains held for the record correction and terminal hosted checks. |
…fuses abandon Security's re-review of b7154f6: the port-log decision and the cancellation_policy field description still described abandon as supported. Both now say native admits try_cancel and wait_cancellation_completed under the protocol-1.20 cooperative gate and refuses abandon with installed_runtime_activity_policy until #971. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Security follow-up on exact 8ff8270: the two-file correction matches the narrowed implementation. The durable decision now states that only try_cancel and wait_cancellation_completed are admitted under the protocol-1.20/cooperative gate, and that abandon is refused with unavailable [installed_runtime_activity_policy] until #971 supplies post-run authority. The completion field guidance says the same. diff --check is clean. This resolves the record mismatch and the original abandon lifecycle finding is fail-closed at this source. Final merge clearance remains pending terminal hosted checks and the ordinary carry onto post-#957 main; no need to hold 3.0.2 for this optional item. |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Security post-#957 carry review at exact |
|
Security hosted-result hold on exact head Both PostgreSQL native-test matrices in run ... AND payload LIKE '%activity_cancellation_acknowledged%'
Please replace that assertion with a cross-engine-safe check (or prove the duplicate receipt by polling/counting the actual resumed task without substring matching a JSON serialization), counterfactual it on PostgreSQL, and rerun. #969 is not Security-final-cleared at this head. Do not hold the query/describe patch for it. |
The wait-cancellation test counted resumed tasks with `payload LIKE ...`. On PostgreSQL workflow_tasks.payload is json, which has no LIKE operator (42883), so both PostgreSQL native matrices failed it. The test now reads the payloads as text on each engine (payload, payload::text, CAST(payload AS CHAR)) and counts them in Rust. Test-only. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Security re-review: the PostgreSQL test hold is closed at exact head The corrective commit is a single test-only child of the held This is exact-head source clearance, supported by the reported SQLite/PostgreSQL/MySQL targeted runs. The fresh hosted matrix has only just restarted, so #969 is not yet Security-final-cleared for merge; terminal green on this exact head remains required, and it must not hold #965/#968/#974 or the 3.0.2 customer-blocker path. |
|
|
Security final carry for exact head The narrowed runtime design remains exact: protocol-1.20 plus cooperative capability admits only Hosted qualification is terminal on this head: 58 contexts, 57 success and the expected prepared-local cancellation context skipped, with no failure/cancellation. This closes Security's source and hosted-check holds. If a later carry merges new main, re-establish the exact head before queueing. |
|
Security generated-merge and post-merge carry for exact commit
Fresh post-push workflows subsequently registered on the same commit; they are additional main evidence, not a changed tree. The source/queue carry is closed. Release dispatch still requires Security's immediate pre-tag |
The update counterfactual counted update tasks with payload LIKE, which PostgreSQL rejects on its json column (the same portability failure #969 fixed). The two polled tasks already prove the update task remains, so the count is replaced by the run's workflow task total (claim, update task, turn). The child tests pass on PostgreSQL 17 (65) and SQLite. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>



Review tier B: new write-path behavior in cooperative delivery, the stop acknowledgement and activity scheduling; no tier-A area. The design was posted on #958 (6589297313).
Fixes #958.
abandonis split to #971 (Security's review, 6590926349).Change
Following PHP Core 2.15 (
WorkflowCommandNormalizer,ActivityCancellationWait,ActivityCancellationAcknowledgement; Core637ea0b5):Accepting the policy.
schedule_activityacceptscancellation_policy. Native refused it before, so every activity wastry_cancel.activity_cancellation_policy_not_supportedwith PHP's guard body.abandonis refused with the same 409 plusunavailable: ["installed_runtime_activity_policy"], until abandoned activities can outlive their run (Native: abandoned remote activities must outlive their run (cancellation_policy abandon) #971).activity_options, soActivityScheduled.activity.cancellation_policynames it. An abandoned activity also namesschedule_to_close_deadline_at.Delivery. Whole-run delivery to an activity, alone or as a parallel or selection member, follows the policy:
try_cancel: unchanged.wait_cancellation_completed: cancels the live attempt. Until every targeted execution has resolved, it holds: the task gets acancellation_activity_waitmarker, the run waits, the claim is released, and the answer isdelivered:falsewith reasoncancellation_waiting_for_activity.abandoncan't be scheduled yet (Native: abandoned remote activities must outlive their run (cancellation_policy abandon) #971). A defensive delivery branch still leaves such an activity uncancelled.Resume. The stop acknowledgement creates one ready workflow task (
resume_source_kind: activity_cancellation_acknowledged) when:Redelivery then delivers. A duplicate acknowledgement resumes nothing. Without an acknowledgement, the existing cleanup-deadline repair closes the run.
The decision is recorded in
docs/rust-server-port.md.Checked
a_waiting_activity_holds_the_run_delivery_until_its_stop_is_acknowledged: hold, no task before the receipt, one resumed task, a duplicate receipt, redelivery.an_explicit_abandon_or_a_pre_1_20_policy_is_refused_at_scheduling: abandon gets 409installed_runtime_activity_policy; a 1.19 policy gets 409request_protocol.Not covered by a test yet
A parallel group waiting on several acknowledgements; a late acknowledgement after the cleanup deadline. The code handles both.
🤖 Generated with Claude Code