Make SSH endpoint placement dynamic#581
Merged
Merged
Conversation
wang-tong0
marked this pull request as ready for review
July 16, 2026 06:29
Collaborator
|
Bug: single-endpoint deployments deadlock after the first challenger win There is a gap in the
The only self-healing path is the next task-pool refresh: it clears champion runtime state and the champion redeploy goes through the identity-matching path, whose reserve rewrites the role back to Minimal repro (passes on this branch): def test_post_win_single_endpoint_cannot_start_next_battle():
# Endpoint exactly as left after a challenger win: current champion
# (uid=2) holds the only endpoint, DB row still says role="challenger".
endpoint = _EndpointStub(
"only-endpoint",
assigned_uid=2,
assigned_hotkey="winner_hk",
assigned_model="org/winner",
assigned_revision="winner_rev",
assignment_role="challenger", # never relabeled after the win
assignment_token="owner",
assignment_status="ready",
deployment_id="ssh:only-endpoint:affine-sglang-current",
)
target = _target() # next challenger, different identity -> no match
with pytest.raises(EndpointReservationConflict):
_select_ssh_endpoints([endpoint], target, role="challenger")Suggested fix (either direction works):
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
assignment_role=activerows and reclaim expired endpoint reservationsWhy
The fixed primary-slot convention caused unnecessary endpoint switching and model reloads. It also made cleanup and recovery brittle when a pre-deployed model was promoted or an endpoint changed while teardown was still converging.
Runtime roles are now independent from physical endpoint position. This keeps healthy deployments in place and makes both one-endpoint and multi-endpoint operation explicit.
Validation
PYTHONPATH=/home/ubuntu/workspace/affine-cortex-dynamic-endpoints pytest -q(793 passed)ruff checkon all changed Python filesgit diff --check