← Back to Pull requests

fix(core): retain failed initial launches for admitted cleanup #6109

Closed
unknown closed this pull request without merging on Nov 15, 2026 03:53 UTC
View on GitHub
unknown unknown commented on Nov 14, 2026 12:18 UTC
Author

What happens

An initial model launch can fail while the control authority is unavailable. Its rollback is rejected before recording the instance error or releasing the UID, and the launch remains stuck after authority returns. A subsequent launch with the same UID is rejected as a duplicate. Cleanup can also lose track of partially launched Worker models or support actors when termination or destruction fails after admission.

Retained cleanup can then block UID reuse after an acknowledged Worker shutdown. Conversely, dropping a target after a heartbeat or reverse-ping timeout can let the UID relaunch while an unreachable Worker still holds the old replica. A failed StatusGuard error write can skip rollback or prevent ownership release after cleanup succeeds.

Cause

The ordinary and sharded failure handlers await termination before recording ERROR. Termination revalidates authority before its body runs, while the launch completion callback releases the operation even when rollback did not finish. Admitted rollback can also suppress Worker termination failures and clear routing; support cleanup drops references before destruction succeeds.

Retained Worker targets need reconciliation against acknowledged shutdown or verified resource absence. A liveness timeout is not proof that the Worker or its replica is gone. An empty model catalog alone is insufficient because rank-zero actors and in-progress launches are omitted. Worker references can also be reused across registrations at the same address, so reference equality alone cannot validate a queued death observation.

Status reporting shared the rollback try block, and a final status exception could mask a cleanup error or leave the operation retained after its resources were removed.

Change

  • Mark failed initial launches as cleanup pending and attempt to record instance ERROR before rollback admission. Attempt rollback independently of status reporting, preserving the original launch exception. Final status writes are best effort: they cannot mask cleanup errors or prevent ownership release after successful cleanup.

  • Retain the existing operation, controlled Worker targets, and actual support-actor references while resource cleanup remains unresolved.

  • Resolve Worker targets after acknowledged termination, a graceful remove_worker notification for the still-registered Worker, or successful catalog and launch-status observations proving absence within the same registration generation. Heartbeat and reverse-ping removals retain targets even after the Worker leaves the registry. Recheck health-observation generations under the Worker ownership lock before registry removal. Refused or timed-out RPCs and re-registration alone do not establish absence.

  • Remove support-actor targets only after acknowledged destruction. Validate current authority before destruction, retain uncertain results, and confirm target absence before accepting ActorNotExist as completed cleanup. Preserve destruction order and nonfatal cleanup notifications.

  • Let an admitted launch retry or termination finish pending cleanup under the existing replica lock. Retry cleanup precedes GPU placement validation. Queued requests recheck operation identity, and replacement launch starts only after retained resources are resolved. Explicit termination also deletes the failed instance record.
  • Fencing, fixed-session semantics, documented child-task interception, explicit cancellation ownership, and initial-launch publication points are unchanged. Recovery records remain process local; authority restoration alone does not replay cleanup.

    The ordinary bookkeeping is shared across Transformers, llama.cpp, vLLM, SGLang, MLX, and TRT-LLM, as well as other model families using that launch path. Coverage includes vLLM sharding and rank zero, Xavier collective and shared-cache configurations, Xavier P/D for vLLM/SGLang/MLX/TRT-LLM, heterogeneous MLX/vLLM history and host sources, and native NIXL P/D configurations for vLLM/SGLang/TRT-LLM.

    Existing configuration restrictions remain in place: P/D requires vLLM, SGLang, MLX, or TRT-LLM; MLX and cross-engine P/D require Xavier transport; LMCache does not support multi-worker sharded launch. This change adds no engine or transport support. Model execution and service actors are stubbed in these regressions, so configuration coverage does not establish native engine, GPU, or Metal execution.

    Recovery after a Worker timeout

    After timeout removal, explicit termination or a same-UID launch retry attempts cleanup through the retained Worker reference. Successful termination can resolve that target even before the Worker re-registers. Inventory-based recovery requires the Worker to register again, followed by a cleanup retry that observes both catalog absence and no launch status within one registration generation.

    If the Worker never becomes reachable, its unresolved target can keep the UID reserved for the Supervisor's lifetime. A graceful shutdown notification received after timeout removal also cannot release the target through remove_worker, because the Worker is already absent from the registry. This change adds no force-forget API.

    Restore Worker connectivity and retry termination when possible. If the Worker cannot return, independently stop and verify the old Worker, model processes, and any other retained resources before performing a planned Supervisor restart to clear the process-local recovery records. Restarting the Supervisor alone does not establish that those resources are gone.

    Tests

    The original 52 regression cases cover foreground/background rollback rejection, partially launched parallel replicas, retry and termination recovery, rejection after Supervisor admission, partial sharding without early route publication, rank zero, retained support actors, uncertain destruction, repeated cleanup failure, cancellation/timeout results, and queued recovery observing a replacement operation. They use supported model specifications, normal Worker registration, production placement and hub-selection paths, and the production status guard. Assertions check Worker and service inventories as well as Supervisor state.

    Seven follow-up cases cover Worker retirement and same-UID relaunch on a healthy Worker, refused cleanup with unavailable or nonempty inventories, failed re-registration without confirmed retirement, verified inventory absence, failures of the first/final/all StatusGuard error writes, and preservation of a Worker cleanup error when final status reporting also fails.

    Four further cases cover live resources omitted from the catalog, including rank zero and an in-progress launch, inventory spanning re-registration, and retirement queued behind re-registration. These reuse failed_launch_runtime; the hidden-resource cases use the production Worker catalog and launch-status methods. The shared fake catalog also omits rank zero.

    Four health-check cases cover a live Worker with failing reverse-ping and termination RPCs, removed by the production health-check loop through heartbeat or reverse-ping thresholds. They assert retained cleanup ownership and blocked same-UID relaunch, followed by recovery through successful termination or fresh inventory proving absence after re-registration.

    Validation

    Linux validation of the source tree at ef15fbc0, on Ubuntu 24.04.5 LTS:

    | Configuration | Changed suites |
    | --- | --- |
    | Python 3.12.3, Transformers 5.23.0 | 177 passed |
    | Python 3.12.3, Transformers 4.57.6 CI pin | 177 passed |
    | Python 3.10.22 | 177 passed |

    The changed suites were test_supervisor_control.py and test_launch_strategy.py.

  • Twelve consumer test files covering token routing, autostart, metrics, heartbeat, model listing/catalogs, monitoring, router orchestration, Worker handoff, and Worker relaunch: 346 passed on Python 3.12.

  • Pre-commit passed for the changed files and the additional types.py and engine_family.py files included in the check.

  • Running the changed tests with production files from 4eed69cc failed as expected. That run includes missing-helper failures; the targeted timeout regressions below establish the specific failure on the preceding revision.
  • Windows validation of the source tree at ef15fbc0 used Python 3.10.20 and 3.14.6, offline settings, isolated temporary directories, and one test file per invocation:

    | Suite | Python 3.10 | Python 3.14 |
    | --- | --- | --- |
    | test_supervisor_control.py | 124 passed, 1 existing failure | 125 passed |
    | test_launch_strategy.py | 52 passed | 52 passed |
    | test_initial_launch_cancellation.py | 23 passed | 23 passed |
    | test_model_replica_scale.py | 61 passed | 61 passed |
    | test_autostart.py | 14 passed | 14 passed |

    All four new health-check cases failed on unchanged production files from f4cfec9a on both Python versions: the health check discarded the cleanup target while the live replica remained allocated. They pass with the change, including both termination and inventory recovery. The existing graceful-retirement and stale-registration cases also pass.

    The Python 3.10 supervisor-control failure is test_registration_is_not_subject_to_the_report_timeout, which uses a 10 ms report timeout. It also failed in a separate run on unchanged f4cfec9a. Black 25.1.0, the diff whitespace check, and the changed-test CI platform coverage check passed on Windows.

    Earlier Windows validation established that all 52 original regression cases failed on 4eed69cc and passed with the initial fix on Python 3.10 and 3.14. The seven initial follow-up regressions also failed against 4f869a89 on both versions. Earlier P/D runs had 184 passes and the same 40 POSIX-path failures on base and fix. The control-session unit subset passed 53 cases on each Python; full native-process control-session runs failed or stalled on both base and fix. Those P/D and native-process runs were not repeated for ef15fbc0.

    Full Linux P/D and native-process control-session runs, native model engines, GPU/Metal execution, and the complete CI platform matrix are not established by these results.

    AI disclosure: this was prepared with AI assistance (Claude Opus 5.5 and Claude Sonnet 5.5).

    🤖 Generated with Claude Code

    https://claude.ai/code/session_01JfvcPZyKcKQUG9fQGYfRMw

    Diff: 650 lines (+487 / -163) across 8 files Reviewer: Jackmeson1 Review duration: 935m
    All Vouch review confidence checks passed
    Residual risk 0.21 = Change Risk (0.52) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.52 · 650 lines diff across 8 files
    0.52
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.388
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #6109"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 52% (MEDIUM) · Higher = larger blast radius
    52%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 20.5% · Safe to merge
    20.5%