Skip to content

Rank the same candidates in the replacement peer pre-check as the frame selector - #2017

Merged
dmlguq456 merged 1 commit into
mainfrom
replacement-precheck-1129
Nov 29, 2026
Merged

dmlguq456 merged 1 commit into
mainfrom
replacement-precheck-1129

Conversation

@dmlguq456

Copy link
Copy Markdown
Owner

Summary

The replacement pre-check split out of the folded #2007 (commit 2375618): only the _capacity_hold peer pre-check piece, nothing else from that PR.

When a frame leg's original harness is at a real usage limit, _capacity_hold decides whether the replacement may go to the same-role successful peer or must wait (replacement-capacity-wait). Its ranking considered every currently enabled harness, but the ordinary frame selector (dispatch-owner) ranks only:

  • the route's sealed depth-1 evidence (route_authority.depth1_supported_harnesses(route, worker_type='frame')),
  • for a top leg, harnesses that declare top,
  • ordered by the allocation's owner_order (preference_order).

Counter-example (recent attempts X 3, O 0, no list order involved): the pre-check picks O, which is outside the sealed evidence, returns replacement-capacity-wait, while the real selector would pick X, the successful peer.

Changes

  • utilities/dispatch_replacement.py: the pre-check filters candidates like the selector (sealed evidence, top declaration) and passes preference_order=allocation.get('owner_order').
  • utilities/model_profile.py: new declares_runtime_profile(adapter, profile); dispatch-owner._declares_top calls it (same answer, one place).
  • utilities/dispatch_replacement.test.py: test_peer_precheck_ranks_the_candidates_the_frame_selector_ranks (fails on origin/main 5088ccb at the sealed-evidence, top, and owner_order cases; passes here).

Pin, explicit harness, original retry (no peer) and the legacy allocation strategy path are unchanged.

What changes for users

Situation Before After
Original harness at its limit, a successful same-role peer is what the frame selector would pick Could wait for the original's limit when the pre-check ranked a harness the selector never sees Goes to the peer without waiting
Pin, explicit harness, original retry, legacy strategy as is unchanged
Everything else as is unchanged

🤖 Generated with Claude Code

…me selector

The frame-peer pre-check in `_capacity_hold` decides whether a replacement may
go to the successful peer instead of waiting for the original harness's limit.
It ranked every currently enabled harness, but the ordinary frame selector
(dispatch-owner) only ranks the route's sealed depth-1 evidence, drops
harnesses that do not declare `top` for a `top` leg, and applies the
allocation's `owner_order`. With recent attempts X 3 and O 0 the pre-check
picked O, which the selector never sees, and returned
`replacement-capacity-wait` although the selector would pick X (the peer).

The pre-check now applies the same filters and `preference_order`. The `top`
declaration is one shared `model_profile.declares_runtime_profile`, which
dispatch-owner's `_declares_top` now calls (same answer as before).

Extracted from the folded PR #2007 (commit 2375618).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@dmlguq456
dmlguq456 merged commit 44e9193 into main Nov 29, 2026
15 checks passed
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