Skip to content

fix(serve): persist running->ready promotion in CLI liveness refresh#101

Open
michaelroy-amd wants to merge 3 commits into
mainfrom
fix/serve-ready-promotion
Open

fix(serve): persist running->ready promotion in CLI liveness refresh#101
michaelroy-amd wants to merge 3 commits into
mainfrom
fix/serve-ready-promotion

Conversation

@michaelroy-amd

Copy link
Copy Markdown
Member

Summary

refresh_managed_service_runtime_liveness() in apps/rocm/src/main.rs already runs the real HTTP readiness probe (managed_service_endpoint_model_ready()), but only used a passing probe to skip demotion — it never persisted the running -> ready transition. This means a service manifest can sit forever at status: "running" even after the model has actually finished loading and is serving requests.

Root cause

The twin code path in apps/rocm/src/providers.rs::ready_local_services() already does this correctly: on a passing probe it sets record.status = "ready" and writes the manifest back to disk. refresh_managed_service_runtime_liveness() (used by load_managed_services(), which backs the services MCP tool and — via pick_managed_chat_endpoint() — chat's endpoint selection, which requires the exact string "ready") never got the same fix. As a result chat could never discover a genuinely ready local server if the record had been left at "running".

Fix

Mirror ready_local_services()'s promotion: when the probe passes and record.status == "running", set it to "ready" and signal a change so the existing write-back logic in load_managed_services() / load_managed_service() persists it.

Test Plan

  • Added load_managed_services_promotes_running_to_ready_once_probe_passes — spins up a mock /v1/models HTTP endpoint, writes a manifest with status: "running", calls load_managed_services, and asserts the in-memory and on-disk (load_managed_service re-read) status is "ready".
  • cargo build -p rocm
  • cargo clippy -p rocm --all-targets --all-features -- -D warnings
  • cargo test -p rocm -- --test-threads=1 (338 passed)

Relates to EAI-7352

refresh_managed_service_runtime_liveness() ran the real HTTP model-ready
probe but only used a passing result to skip demotion, never to persist
the running->ready transition. Its twin in providers.rs::ready_local_services()
already promotes correctly; mirror that here so load_managed_services()
(and therefore the "services" MCP tool and chat's pick_managed_chat_endpoint,
which requires exact status "ready") see the true state instead of a
manifest stuck at "running" forever.

Relates to EAI-7352

Signed-off-by: Michael Roy <michael.roy@amd.com>
load_managed_services_promotes_running_to_ready_once_probe_passes re-read
the record via load_managed_service() to check persistence, but that
function itself calls refresh_managed_service_runtime_liveness() on every
read -- including on an already-"ready" record, since the endpoint-ready
check also matches "ready". So the second assertion would pass even if
load_managed_services() never wrote the promotion to disk; it wasn't
actually proving persistence.

Add a direct read of the manifest file's raw JSON in between the two calls
and assert its status field is exactly "ready", which only load_managed_services()
could have produced.

Relates to EAI-7352

Signed-off-by: Michael Roy <michael.roy@amd.com>
…o dep change)

Signed-off-by: Michael Roy <michael.roy@amd.com>
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