Repository navigation
fix(local-ai): prevent routing to an unverified managed model - #1212
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs real behavior proof before merge. Reviewed August 27, 2026, 8:15 PM ET / August 28, 2026, 00:15 UTC. ClawSweeper reviewWhat this changesThe PR requires a managed llama-server endpoint to prove the expected model state and path before the Windows companion publishes it to the gateway, and withdraws routing when that proof is lost. Merge readiness⛔ Blocked until real behavior proof from a real setup is added - 4 items remain Keep open. The branch implements the linked Local AI routing fix and addresses the prior quiesce-failure concern, but current main does not contain it and the required real llama-server plus WSL gateway proof is still absent. Priority: P2 Review scores
Verification
Live VerificationCommand: Result: FAIL (failed) — execution before step 1 Assertions:
How this fits togetherThe Windows companion starts a loopback llama-server router and probes its health and managed-model metadata. A verified endpoint is then published to the app-owned WSL gateway so Local AI requests can be routed safely. flowchart LR
A[Managed model install] --> B[Windows llama-server router]
B --> C[Loopback health and model probe]
C --> D{Owned endpoint and model verified?}
D -- Yes --> E[Publish provider to WSL gateway]
D -- No --> F[Withdraw gateway route]
E --> G[Local AI requests]
F --> H[Starting or failed runtime state]
Before merge
Agent review detailsSecurityNone. Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Retain the shared verified-model predicate and fail-closed route withdrawal, then demonstrate withdrawal and automatic recovery against a real managed llama-server and WSL gateway before landing. Do we have a high-confidence way to reproduce the issue? No for the full real stack. Source and focused tests clearly exercise the route-safety paths, but the PR confirms that a live managed llama-server plus WSL gateway run has not been captured. Is this the best way to solve the issue? Yes, with a proof gap. Reusing the existing gateway lifecycle owner while tightening the probe predicate is the narrowest fix for the reported unsafe publication behavior. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against f2a96a596c01. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
History |
e6a9313 to
ab038bf
Compare
Co-authored-by: Copilot App <[email protected]> Copilot-Session: 7ef70da5-e94c-4bcf-9cb6-a0acee52c9c4
ab038bf to
d3c1b43
Compare
karkarl
left a comment
There was a problem hiding this comment.
Adversarial review verdict: SHIP TODAY.
The release-blocking findings are resolved: readiness and exact ownership proof gate routing, every proof-loss path withdraws the published route, quiesce failure hard-stops the managed process, and recovery republishes the freshly verified endpoint rather than stale persisted state. Focused lifecycle coverage exercises ownership loss, missing endpoints, quiesce and publish failures, stale-endpoint recovery, and successful republish.
Dependency/overlap review found no remaining blocker with #1222. The previously observed Axe readiness timeout was a shared test-signalling flake, not an accessibility violation or Local AI regression; the latest rerun is green. Approved at d3c1b43.
Closes #1192
What Problem This Solves
Fixes an issue where Local AI could be published to the gateway and reported healthy when llama-server was reachable but the configured managed model was unknown, missing, reported from the wrong path, or no longer served by a proven owned endpoint.
Why This Change Was Made
Managed-model readiness now requires router health, a Verified or Loaded state, and an exact path match. Startup and refresh share that predicate. Every refresh branch that loses endpoint ownership or readiness quiesces the previously published route before returning. If route withdrawal fails or throws, the managed process is stopped and the runtime publishes a fail-closed state. Recovery persists and publishes the freshly verified owned endpoint rather than stale manifest data.
User Impact
The gateway no longer routes Local AI requests to an endpoint that cannot prove it serves the configured managed model. Temporary readiness loss withdraws routing safely and routing recovers automatically only after valid model and endpoint evidence returns.
Evidence
Change Type
Scope
winnodeValidation
Environment: Windows 11 ARM64, .NET SDK 10.0.400.
OPENCLAW_REPO_ROOTwas set to the isolated worktree; Tray tests used an isolatedOPENCLAW_TRAY_DATA_DIR.powershell.exe -NoProfile -ExecutionPolicy Bypass -File .\build.ps1: passed. Shared, Cli, WinNodeCli, SetupEngine, and WinUI built successfully for win-arm64.dotnet test .\tests\OpenClaw.Shared.Tests\OpenClaw.Shared.Tests.csproj --no-restore: passed, 3,819 passed, 0 failed, 32 skipped.dotnet test .\tests\OpenClaw.Tray.Tests\OpenClaw.Tray.Tests.csproj --no-restore: passed, 2,749 passed, 0 failed, 0 skipped.dotnet test .\tests\OpenClaw.Connection.Tests\OpenClaw.Connection.Tests.csproj --no-restore: passed, 705 passed, 0 failed, 0 skipped.dotnet test .\tests\OpenClaw.Connection.Tests\OpenClaw.Connection.Tests.csproj --no-restore --filter "FullyQualifiedName~LlamaServerClientTests|FullyQualifiedName~LocalAiPortLifecycleTests": passed, 40 passed, 0 failed, 0 skipped.git diff --check: passed.Real behavior proof
d3c1b433.LlamaRuntimeCatalog-driven manifest data and all readiness lifecycle cases.Refresh_QuiescesPublishedRouteWhenEndpointOwnershipIsLostobservesquiescebefore returning for incomplete ownership, conflict, and missing endpoint.Refresh_QuiesceFailureStopsUnverifiedManagedProcessobservesprobe, quiesce, stopand returnsFailedwith no runtime ownership or process ID.Refresh_QuiesceExceptionStopsManagedProcessBeforePropagatingobservesquiesce, stop, leaves a fail-closed snapshot, then propagates the lifecycle exception.Refresh_RecoveryRebindsFreshlyVerifiedEndpointBeforePublishingrewrites the persisted receipt to stale port 29999, verifies live port 28777, then observesprobe:28777, publish:28777and confirms the receipt is rebound to 28777.Refresh_UpdatesPublicationWhenManagedModelReadinessChangesobservesprobe, quiescefollowed byprobe, publishfor successful readiness recovery.Refresh_RecoveryPublishFailureRemainsFailedAndQuiescedproves a failed recovery publication does not report Healthy.LocalAiGatewayProviderCoordinator.Security Impact
Yes, explain the risk and mitigation: refresh now withdraws managed gateway routing whenever endpoint ownership or model readiness cannot be proven. Failed route withdrawal stops the managed process, and publication occurs only after the live owned endpoint and exact managed model are verified.Compatibility and Migration
Review Conversations