Skip to content

Guard worker build and task queue retirement against live dependencies #519

Done

Description

@rmcdaniel

User problem and decision

Promotion does not make old pinned runs or recorded activity queues independent of the old fleet. An operator needs a supported answer to “can this build or queue be retired safely?” and a guarded action, not only a warning to manually keep workers forever.

This is the product capability behind durable-workflow/durable-workflow.github.io#262, #274 and #308. Retain their accurate current promotion/routing documentation; that does not deliver safe-retirement enforcement.

At DeploymentLifecycleService::drain, Core's planner receives no pinned-run/recorded-queue dependency inventory. DeploymentLifecyclePlan::evaluateDrain can permit an active deployment without proving those dependencies are gone. #317 already delivered routing diagnostics; it did not prevent unsafe retirement.

Acceptance

  • Expose a bounded, namespace/queue/build-scoped retirement inspection covering passive open pinned runs, continue-as-new chains, children, recorded activity queues, delayed retries and pending/leased tasks. An empty ready-task count is insufficient.
  • Add an explicit guarded retirement operation. Preserve the separate emergency-drain contract deliberately; do not silently change an existing operational action without compatibility review.
  • Refuse unsafe retirement with concrete blocker identities/counts, observation completeness and a safe recovery action. Missing/stale/incomplete inventory is unavailable, not permission to retire.
  • Make the check/action safe against concurrent starts, task creation, retries and continuation. A non-atomic zero-count preview is not an enforcement barrier.
  • Preserve recorded run build pins, activity queues, original history and deadlines. Do not automatically re-pin or reroute existing work. Compatible upgrades and any future migration API need their own explicit policy and tests; coordinate Changed Python workflow definitions silently strand in-flight runs #518.
  • Prove a parked old-build run and a delayed old-queue activity retry block retirement even while the promoted new fleet is healthy. Then complete/drain their real dependencies and prove retirement succeeds. Test isolation, cancellation, restart and continued chains.
  • Expose the workflow through CLI/SDK/operator views and publish the actual promotion, retirement and recovery journey. Keep existing BuildId filters useful as manual inspection without misrepresenting them as the guarded action.

Priority P2, additive operations-safety feature. General owns PHP/CLI/package implementation after an agreed source window. Native/shared adoption remains separately qualified under #325; frozen cohorts do not change through this issue.

Activity

  1. added
    kind:feature
    priority:P2
    status:ready
    on Oct 20, 2026
  2. rmcdaniel commented on Nov 4, 2026

    @rmcdaniel
    MemberAuthor

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

    Owner: Server for native bounded retirement inspection/guard, Workflow for definition/marker provenance, CLI/Waterline for consumers. Central220’s branch-use question belongs here with #325, not in a new competing retirement tracker. No current native endpoint is identified that proves open runs are independent of a change_id/version.

    Next source contract distinguishes recorded legacy markers from unknown/unreached runs on older or missing definitions, includes passive pinned runs/CAN/children/recorded queues/delayed retries and binds guarded retirement to inventory revision. Absence of a marker or ready task is never proof of safe removal. Workflow: return canonical admission/definition provenance; General reviews the unknown-state policy and source order before endpoint/consumer implementation.

  3. rmcdaniel commented on Nov 4, 2026

    @rmcdaniel
    MemberAuthor

    Core provenance fixture pointer requested in Server325/6643408164: public 2.20.3 WorkflowDefinitionFingerprint and FailedRunRedrivePlan bind declared definition and recorded marker/reuse history. In V2FailedRunRedriveTest, testServiceRunRequiresMatchingRecordedWorkerDefinitionFingerprint, testADefinitionThatDropsTheRecordedVersionNamesTheMarkerStep, testRedriveReusesOneMarkerForARepeatedPatchCall, testALaterRedriveOnTheSameDefinitionRecordsNoInheritedChange and testRedriveRefusesABrokenReuseProvenancePairWithoutMutation are the concrete positive/refusal fixtures. Marker absence on an unreached older definition is not a proven safe-cleanup zero; that separate visibility contract remains tracked in .github220/6642217365. Source lineage and a closed issue are not an installed native marker/definition receipt. Server owns that protocol/endpoint map before any native producer change.

    Delivery evidence remains the exact public Core 2.20.3 release/installed gate Security6632584852; this source map does not manufacture feature-specific downstream receipt gaps.

  4. rmcdaniel commented on Nov 11, 2026

    @rmcdaniel
    MemberAuthor

    Triage 2026-11-11: still open; drain has no pinned-run inventory. Backlog feature. Owner: server.

  5. rmcdaniel commented on Nov 25, 2026

    @rmcdaniel
    MemberAuthor

    Native retirement shipped in Server 3.14.0 (#1241):

    • Read-only inventory at GET .../retirement for deployments and task queues.
    • A guarded POST .../retire that repeats the check inside the serialized transition. It refuses with 409 and gives blocker counts, samples and recovery steps. It rejects incomplete inventory and a stale expected_inventory_revision.
    • Drain behavior, pins, routing and history are unchanged. The capability is advertised as worker_build_retirement.
    • rust/tests/execution/retirement.rs covers a parked old-build run, a delayed old-queue retry, isolation, restart and continue-as-new chains on all four backends.
    • The operator guide is docs/worker-build-retirement.md in this repo.

    The PHP Server and Core planner scope is obsolete: PHP Server is frozen at 2.11.8, and #325 is closed.

    Remaining:

    • cli: dw commands to inspect and retire a build or queue. CLI 2.11.0 has none.
    • durable-workflow.github.io: polyglot/worker-build-id-rollout.md and polyglot/worker-compatibility-routing.md still say there is no guarded retirement. Replace that with the promote, inspect, retire and recover journey, in all locales.
    • waterline (optional): a read-only retirement view.

    Next action: add the CLI inspect and retire commands, then update the docs site to use them.

  6. rmcdaniel commented on Nov 25, 2026

    @rmcdaniel
    MemberAuthor

    The CLI and docs parts are delivered. Server delivered its part in 3.14.0 (#1241).

    • CLI: Add task-queue:retirement and task-queue:retire (server#519) cli#172 (merged as c0e5b14) adds dw task-queue:retirement <queue> [--build-id X | --unversioned] and dw task-queue:retire <queue> [--build-id X | --unversioned] [--expected-revision R].
      • With neither --build-id nor --unversioned, both commands act on the whole queue.
      • Both commands check the worker_build_retirement capability first.
      • A 409 refusal is reported with its reason, blocker counts, samples and recovery steps.
      • Tests are included. The commands are not in a published CLI yet: the next release after 2.11.0 is needed.
    • Docs: Document guarded worker build and task queue retirement durable-workflow.github.io#609 (merged as 4ee1e8f) replaces the "no guarded retirement" text in polyglot/worker-build-id-rollout.md and polyglot/worker-compatibility-routing.md. Both pages now walk through promote, inspect, retire and recover, in all locales.

    The optional read-only Waterline view was not done and is not part of this issue's required outcome.

  7. rmcdaniel commented on Nov 25, 2026

    @rmcdaniel
    MemberAuthor

    The retirement commands are now published in CLI 2.12.0. The docs site CLI reference lists them and pins CLI 2.12.0 (durable-workflow/durable-workflow.github.io#610).

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

    kind:featurepriority:P2status:ready

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions