Skip to content

Serve the task repair pass like published PHP 2.11 - #687

Closed
rmcdaniel wants to merge 1 commit into
rust-325-payload-cleanupfrom
rust-325-repair-pass
Closed

rmcdaniel wants to merge 1 commit into
rust-325-payload-cleanupfrom
rust-325-repair-pass

Conversation

@rmcdaniel

Copy link
Copy Markdown
Member

Part of #325. Stacked on #686 (payload cleanup).

Native now serves POST /api/system/repair/pass like published Server 2.11.1 (SystemController::repairPass over TaskWatchdog::runPass).

What the pass does. It is server-wide. It is admin-only and also allowed in named namespaces.

  • Request rules. run_ids (at most 100 strings of 1–128 characters), instance_id, connection and queue (comma-separated; default also matches a null or empty column), and respect_throttle. Strings are trimmed and empty ones read as null. Invalid input answers Laravel's 422.
  • Throttle. A pass that respects the 5-second loop throttle reports throttled: true within 5 seconds of the previous pass. Any other pass runs and restarts it. The server's namespaces share the throttle.
  • Selection. PHP's poll-mode selection: up to 25 repairable tasks and 25 runs that need a task, taken one per connection, queue and compatibility scope in turn, oldest first.
  • Recovery.
    • A ready task overdue for dispatch counts one more repair and is marked dispatched.
    • An expired workflow lease returns its task to ready.
    • A closed run's task is settled.
    • A lost workflow task is recreated.
    • A run past its deadline gets a deadline_expired task.
    • An expired cancellation cleanup deadline is enforced.
    • Expired activity deadlines are enforced.

Not ported yet. Two recoveries are reported as their candidate's failure, so the pass answers 207 instead of claiming a repair:

  • An expired lease on a running activity. PHP consumes its retry policy. The message is also kept as the task's last_error.
  • A missing task for a run waiting on an activity, a timer, a timer-backed condition, an update, a signal or a child.

The lease-expiry gap is the next slice.

Shared rule. GET /api/system/repair and the pass now share one candidate query. It carries 2.11's extra availability condition on the overdue branch and binds the redispatch cutoff with microseconds. Native's per-task recheck uses availability after the last dispatch as the redispatch reference, like dispatchOverdue.

Evidence.

  • New native tests pass on SQLite, PostgreSQL and MySQL. They cover the queue filter, the throttle, an overdue task, an expired workflow lease, a lost task, a deadline task, and the 207 report.
  • The full native suite with --all-targets passes on SQLite (236 unit and 418 integration tests).
  • New fixture repair-pass: 9 requests whose answers were checked against a fresh 2.11.1 server. A local copy of the parity step passed all 56 fixtures on published PHP, embedded and native. Its contract unit test has 16 cases.

Checkpoint: docs/rust-server-port-checkpoints/2026-10-23-repair-pass.md.

POST /api/system/repair/pass recovers overdue ready tasks and expired leases, creates lost workflow tasks and deadline tasks, and enforces expired activity deadlines, with PHP's request rules, scope-fair selection and loop throttle. Recoveries native does not perform yet (an expired running activity lease, a missing task for a run waiting on an activity, timer, update, signal or child) are reported as candidate failures with 207. Repair status now shares the pass's candidate query, with PHP 2.11's availability rule and microsecond cutoff.
@rmcdaniel

Copy link
Copy Markdown
Member Author

Superseded by #696, which carries this change unchanged, rebased on main. Its tests pass in #696 on SQLite, PostgreSQL and MySQL. The branch stays until #696 merges and this head is in main.

@rmcdaniel rmcdaniel closed this Oct 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant