Skip to content

Rust #325: serve worker sessions like Server 2.11.1 #736

Closed

Description

@rmcdaniel

Goal

Native serves worker sessions exactly as published Server 2.11.1 does. A shared fixture recorded against published PHP proves it.

Routes in scope (native answers 501 today):

  • POST /api/worker/sessions
  • POST /api/worker/sessions/{sessionId}/heartbeat
  • DELETE /api/worker/sessions/{sessionId}
  • GET /api/worker-sessions
  • GET /api/worker-sessions/{sessionId}

The port also covers the places sessions touch other routes:

  • activity scheduling with worker_session;
  • activity task delivery, heartbeat and renew-lease (the worker_session field);
  • registration and capability advertisement (PHP serves worker_sessions as an object with the verbs create, heartbeat and close);
  • operator metrics;
  • namespace cleanup;
  • takeover of PHP data that holds sessions.

Published behavior to match

  • The routes need protocol 1.8 or newer. Older headers get 409 worker_sessions_unavailable. Creating sessions from a workflow task needs 1.18 or newer and the worker_sessions capability.
  • Create checks run in this order: protocol, validation, registration (412), queue (409), requirements (409). It answers 201 created or 200 reused / reacquired, and the body repeats the status.
  • Sessions expire only when they are read; there is no background sweeper. A holder becomes orphaned after deregistration or after 30 seconds without a worker heartbeat.
  • Session times are kept in whole seconds.

Acceptance

  • A fixture recorded against published 2.11.1 first, on its own queues. It covers create, reuse and reacquire, heartbeat, close, expiry on read, holder loss, listing order, the refusals in order, and activity delivery tied to a session.
  • Native passes it on SQLite, the MySQL family and PostgreSQL, with execution-test counterfactuals.
  • No expected result is changed to make native pass. Where published PHP itself misbehaves, an explicit, documented boundary separates that from native behavior, and the defect is reported to the PHP owner.

Activity

  1. rmcdaniel commented on Oct 24, 2026

    @rmcdaniel
    MemberAuthor

    Progress (Rust Server owner):

    • Fixtures recorded against published 2.11.1, each in 3 identical recordings, published PHP and embedded pass:
      • worker-sessions: lifecycle routes, gates and refusals, expiry and orphaning on read, listing and metrics.
      • worker-session-activities: schedule_activity guards, lazy creation on the first admitted claim, the claim pre-filter and held session, heartbeat and renew-lease renewal, the compact form on status, the closed-session refusals, the activity limit, an unclaimable queue, operator metrics, and the capability object.
    • One published PHP defect is bounded explicitly and reported as Reacquired worker session keeps its previous failure_reason #737: a reacquired session keeps its old failure_reason.
    • Native, implemented locally: all five routes, session-bound activities (completion guards, claim admission, heartbeat, renew-lease and status), the worker_sessions capability object with its verbs, and operator metrics.
      • Both fixtures pass against native locally.
      • Native execution tests pass on SQLite, PostgreSQL and MySQL.
    • Landing: stacked after Serve synchronous update validation like Server 2.11.1 #712 and Rust #325: fence held workflow and activity polls against replaced worker registrations #734 (same claim path); PR follows once those land.
    • Remaining in scope: revisit the takeover refusal for PHP data that holds session rows (upgrade_source_worker_sessions_unsupported).
  2. added a commit that references this issue on Oct 25, 2026
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