Skip to content

Native: abandoned remote activities must outlive their run (cancellation_policy abandon) #971

Open

Description

@rmcdaniel

Split from #958 / #969 after Security's review (#969 (comment)).

Today: native refuses an explicit cancellation_policy: abandon on schedule_activity with 409 activity_cancellation_policy_not_supported and unavailable: ["installed_runtime_activity_policy"] (#969). try_cancel and wait_cancellation_completed are supported.

Why: under Core 2.15.12, an abandoned remote activity keeps running after its parent run reaches its cooperative-cancelled terminal state, until it finishes or its own schedule_to_close deadline expires (DefaultActivityTaskBridge::poll, ActivityAbandonment::allows). Native ties activity work to an active parent:

  • both activity candidate queries (TASK_CANDIDATES_SQL and the cross-kind poll) require the parent pending, running or waiting;
  • complete_activity (and failure, heartbeat and lease paths, to be audited) go through active_run and refuse run_closed.

An abandoned task would be stranded once the run closes.

Needed: a narrow, fail-closed post-run authority. It requires the exact ActivityScheduled abandon snapshot, its schedule_to_close_deadline_at, and the run's matching canonical cooperative-cancelled close. Ordinary activities keep today's refusals. Cases from Security's review:

  1. an unclaimed ready abandoned activity stays pollable after the parent canonically cancels;
  2. a previously leased abandoned activity can complete or fail after that close, and records its terminal history;
  3. ordinary activities, and runs closed as completed, failed or terminated (or with corrupt history), stay refused;
  4. expiry still closes the activity at its original schedule-to-close deadline.

Then admit abandon again: the policy, its finite schedule_to_close_timeout (422), the snapshot deadline, and delivery without cancelling are already in #969's history.

Activity

  1. rmcdaniel commented on Nov 4, 2026

    @rmcdaniel
    MemberAuthor

    Server open-item pass, 2026-11-04.

    Owner: Server. I retained the Security-derived four-boundary plan: only a canonical cooperative-cancel close plus the exact abandon snapshot/original schedule-to-close deadline can authorize post-run activity polling/completion/failure. Completed, failed, terminated, corrupt and ordinary activity cases remain refused.

    Next source artifact audits candidate selection, heartbeat/renewal, failure/completion and deadline expiry together, with retained ready and already-leased cases plus negative controls. The current explicit abandon refusal stays until that complete bounded authority is qualified; removing active_run checks alone would widen authority incorrectly. General: schedule this native cancellation-parity slice after the current accepted train or name a higher-priority consumer dependency. No new runtime, schema or advertised support was introduced.

  2. rmcdaniel commented on Nov 11, 2026

    @rmcdaniel
    MemberAuthor

    Triage 2026-11-11: native still refuses cancellation_policy abandon explicitly (store.rs). Next: post-run authority for abandoned activities plus the four Security cases. Owner: server.

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

    agent:serverkind:defectA public product behavior is incorrectpriority:P3Lower-priority product improvementstatus:readyReady for implementation

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions