fix(serve): persist running->ready promotion in CLI liveness refresh - #101
Conversation
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>
rominf
left a comment
There was a problem hiding this comment.
LGTM. The running→ready promotion is genuinely persisted (returns true; both callers load_managed_service and load_managed_services then record.write()), idempotent (a second call finds status already ready and returns false — no write thrash), and only ever promotes running→ready, never the reverse. It faithfully mirrors the established providers.rs::ready_local_services() path, and readers that special-case ready now observe the persisted value. The regression test asserts the on-disk manifest (not just the returned Vec), so it would catch a "returned but not persisted" bug.
Approving.
|
🔴 Automated review · pr-review-watcher · 0561199 Summary
What the change does
Verification performedTwo independent reviewers (production logic + blast radius; test quality) plus cross-file synthesis. All findings were verified against source, including checking the pre-fix state. Production logic — clean.
Test — clean and meaningful.
Commit / PR quality — clean.
Minor note (non-blocking, description only — no code change needed)The PR description states chat's endpoint selection "requires the exact string Tradeoffs (deliberate, noted for awareness)
Positive signals
|
Summary
refresh_managed_service_runtime_liveness()inapps/rocm/src/main.rsalready runs the real HTTP readiness probe (managed_service_endpoint_model_ready()), but only used a passing probe to skip demotion — it never persisted therunning->readytransition. This means a service manifest can sit forever atstatus: "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 setsrecord.status = "ready"and writes the manifest back to disk.refresh_managed_service_runtime_liveness()(used byload_managed_services(), which backs theservicesMCP tool and — viapick_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 andrecord.status == "running", set it to"ready"and signal a change so the existing write-back logic inload_managed_services()/load_managed_service()persists it.Test Plan
load_managed_services_promotes_running_to_ready_once_probe_passes— spins up a mock/v1/modelsHTTP endpoint, writes a manifest withstatus: "running", callsload_managed_services, and asserts the in-memory and on-disk (load_managed_servicere-read) status is"ready".cargo build -p rocmcargo clippy -p rocm --all-targets --all-features -- -D warningscargo test -p rocm -- --test-threads=1(338 passed)Relates to EAI-7352