Skip to content

refactor(miles): drop unused router engine metadata#8

Open
TianyeGGBond wants to merge 1 commit into
rlops:zhenyu/m11-mvp-testfrom
TianyeGGBond:zhenyu/remove-unused-router-engine-index
Open

refactor(miles): drop unused router engine metadata#8
TianyeGGBond wants to merge 1 commit into
rlops:zhenyu/m11-mvp-testfrom
TianyeGGBond:zhenyu/remove-unused-router-engine-index

Conversation

@TianyeGGBond
Copy link
Copy Markdown

@TianyeGGBond TianyeGGBond commented May 30, 2026

Context

This PR is intentionally separate from the health-check admission fix so reviewers can evaluate the dead-code cleanup independently.

plans/miles-port-unified-plan.md:4338 originally described miles_engine_index and miles_worker_url as the data source for _is_scheduler_preempt(output). That was the plan's original design: _is_scheduler_preempt was expected to read those two fields from router-injected response metadata.

The implementation later converged to a simpler contract. In multi_turn.py, _is_scheduler_preempt(output) only reads meta_info["miles_admission_disabled"]. It does not read miles_engine_index or miles_worker_url.

That means the plan was over-designed for the final implementation. The reader side was simplified, but the router writer side was never cleaned up, leaving one-sided dead metadata fields.

A repo-wide search confirms this:

  • meta_info["miles_engine_index"] has no consumer.
  • meta_info["miles_worker_url"] has no consumer.
  • worker_engine_index_map only exists to support the unused miles_engine_index injection path.
  • multi_turn only consumes miles_admission_disabled for redispatch classification.

Keeping the unused parser/storage/injection path makes the router admission code look more coupled than it is, and it diverges from the upstream-style minimal router surface without functional benefit.

Change

  • Remove worker_engine_index_map from MilesRouter.
  • Stop parsing engine_index from /add_worker query/body payloads.
  • Stop injecting meta_info["miles_engine_index"] into /generate responses.
  • Stop injecting unused meta_info["miles_worker_url"] into /generate responses.
  • Remove worker_engine_index_map from the dev-only admission_state endpoint.
  • Update tests and docstrings to reflect that the only required RLix router metadata field is miles_admission_disabled.

Validation

Passed syntax/whitespace checks:

python -m compileall miles/router/router.py miles/rollout/base_types.py tests/test_partial_sleep_wake.py
git diff --check

Passed stale-reference checks:

rg -n miles_engine_index miles tests -g *.py
rg -n miles_worker_url miles tests -g *.py
rg -n worker_engine_index_map miles tests -g *.py
# no matches

Passed affected router admission tests using a temporary local Ray import stub, because this Windows environment does not have the real Ray package installed:

python -m pytest tests/test_partial_sleep_wake.py::TestRouterAdmissionLifecycle -q
# 3 passed, 1 warning

@TianyeGGBond TianyeGGBond force-pushed the zhenyu/remove-unused-router-engine-index branch from dc33d2f to 1922974 Compare May 30, 2026 04:02
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