Skip to content

refactor(local-ai): clarify managed-model probe contract - #1210

Merged
shanselman merged 2 commits into
openclaw:mainfrom
joelagnel:fix/1198-managed-model-api
Aug 26, 2026
Merged

shanselman merged 2 commits into
openclaw:mainfrom
joelagnel:fix/1198-managed-model-api

Conversation

@joelagnel

@joelagnel joelagnel commented Aug 24, 2026 •

Copy link
Copy Markdown
Collaborator

Closes #1198
Related: #1192

What Problem This Solves

The Local AI probe name implied that it checked only router health, even though the operation also verifies one configured model alias and expected managed path. The setup-time inference verification contract was also documented only at the class level, leaving callers and generated method documentation without the full boundary.

Why This Change Was Made

Rename the internal probe consistently to ProbeManagedModelAsync across the client contract, runtime callers, and test fake. Preserve the existing public ProbeRouterAsync source contract as an obsolete forwarding wrapper. Add method-level XML summaries to both the inference interface and implementation that describe the bounded request, intentional lazy model load, response and token/timing verification, and content-handling boundary.

This PR does not change readiness behavior. Issue #1192 remains the separate correction for the probe result predicate.

User Impact

There is no user-visible runtime behavior change. Developers get a more precise managed-model API name and method documentation, while existing direct callers of ProbeRouterAsync continue to compile.

Evidence

  • All internal interface, runtime, and test-fake call sites use ProbeManagedModelAsync.
  • The public ProbeRouterAsync method remains available as an obsolete forwarding wrapper with the same parameters and return type.
  • Focused compatibility coverage binds the legacy method to its original delegate signature.
  • The inference interface and implementation both expose the bounded-request and content-handling documentation.

Change Type

  • Bug fix
  • Feature
  • Refactor
  • Docs or instructions
  • Tests or validation
  • Security hardening
  • Chore or infrastructure

Scope

  • Tray or WinUI UX
  • Windows node capability
  • Local MCP or winnode
  • Gateway, connection, or pairing
  • Setup or onboarding
  • Permissions, privacy, or security
  • Tests, CI, or docs

Validation

Current head: 23387c4754d71d60cbdd536a22256db4563367d0

  • .\build.ps1: passed, 5 of 5 repository build targets.
  • dotnet test .\tests\OpenClaw.Shared.Tests\OpenClaw.Shared.Tests.csproj: passed, 3,812 passed and 32 environment-gated skips.
  • dotnet test .\tests\OpenClaw.Tray.Tests\OpenClaw.Tray.Tests.csproj: passed, 2,703 passed.
  • dotnet test .\tests\OpenClaw.Connection.Tests\OpenClaw.Connection.Tests.csproj --no-restore: passed, 681 passed.
  • dotnet test .\tests\OpenClaw.Connection.Tests\OpenClaw.Connection.Tests.csproj --filter "FullyQualifiedName~LocalAi": passed, 21 passed.
  • git diff --check: passed.
  • python .agents\skills\autoreview\scripts\autoreview --mode branch --base origin/main --stream-engine-output: clean, no accepted or actionable findings; patch correct at 0.98 confidence.

Real Behavior Proof

  • Environment tested: Windows x64, .NET SDK 10.0.303.
  • PR head tested: 23387c4754d71d60cbdd536a22256db4563367d0.
  • Exact proof: compiled the legacy public method against its original Func<Uri, string, string, CancellationToken, Task<LlamaServerRouterProbeResult>> signature, then ran the focused Local AI and full Connection suites.
  • Observed result: existing source callers can still bind to ProbeRouterAsync; the wrapper delegates directly to ProbeManagedModelAsync; all managed runtime paths use the clearer internal contract.
  • Screenshot or artifact links verified? (Yes/No/N/A): N/A.
  • Not verified or blocked: Live llama-server inference was not repeated because the patch changes naming, documentation, and source compatibility only. The separately scoped readiness correction remains Require verified managed-model evidence before publishing Local AI #1192.

Security Impact

  • New permissions or capabilities? (Yes/No): No
  • Secrets or tokens handling changed? (Yes/No): No
  • New or changed network calls? (Yes/No): No
  • Command or tool execution surface changed? (Yes/No): No
  • Data access scope changed? (Yes/No): No
  • If any answer is Yes, explain the risk and mitigation: N/A

Compatibility and Migration

  • Backward compatible? (Yes/No): Yes
  • Config or environment changes? (Yes/No): No
  • Migration needed? (Yes/No): No
  • Compatibility detail: direct callers may continue using ProbeRouterAsync; new code should use ProbeManagedModelAsync.

Review Conversations

  • The actionable compatibility finding is fixed on the PR branch.
  • No unresolved inline review threads remain.

@clawsweeper

clawsweeper Bot commented Aug 24, 2026

Copy link
Copy Markdown

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@clawsweeper clawsweeper Bot added merge-risk: 🚨 compatibility 🚨 Merging this PR could break existing users, config, migrations, defaults, or upgrades. P3 Low-risk cleanup, docs, polish, ergonomics, or speculative feature. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Aug 24, 2026
@clawsweeper

clawsweeper Bot commented Aug 24, 2026

Copy link
Copy Markdown

Codex review: needs real behavior proof before merge. Reviewed August 24, 2026, 6:55 PM ET / 22:55 UTC.

ClawSweeper review

What this changes

Renames the Local AI probe to describe managed-model verification and adds method-level documentation for bounded setup-time inference checks.

Merge readiness

⛔ Blocked until real behavior proof from a real setup is added - 4 items remain

Keep this PR open, but do not merge it as-is: the clarity refactor removes a public source method and can break direct callers despite preserving runtime behavior.

Priority: P3
Reviewed head: 4b1fc01a4207f8937167218617c1219747e0dae8

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) The refactor is narrow, but it currently breaks a public source API and lacks real after-fix behavior evidence.
Proof confidence 🦪 silver shellfish (2/6) Needs real behavior proof before merge: The PR body reports builds, tests, and symbol counts, but no after-fix run of the real managed llama-server path; add redacted terminal or runtime-log proof after preserving compatibility. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Patch quality 🦐 gold shrimp (3/6) 1 actionable review finding remain.

Verification

Check Result Evidence
Real behavior Needs proof Needs real behavior proof before merge: The PR body reports builds, tests, and symbol counts, but no after-fix run of the real managed llama-server path; add redacted terminal or runtime-log proof after preserving compatibility. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Evidence reviewed 5 items Public API break: The branch replaces the existing public probe member with a new name. The interface is internal, so renaming it does not preserve direct callers of the public class.
Current-main baseline: Current main exposes public LlamaServerClient.ProbeRouterAsync, so the requested cleanup is not already implemented and the old source contract exists today.
Runtime behavior remains separate: Both startup and refresh callers use the renamed probe, while the readiness predicate remains unchanged as stated by the PR and separately tracked in the related report.
Findings 1 actionable finding [P1] Preserve the existing public probe method
Security None None.

Live Verification

Command: dotnet run --project src/OpenClaw.SetupEngine -- --not-a-supported-option

Result: FAIL (failed) — execution before step 1 run: sh -lc pnpm install --ignore-scripts --frozen-lockfile failed: ! Corepack is about to download https://registry.npmjs.org/pnpm/-/pnpm-11.23.0.tgz

sh -lc pnpm install --ignore-scripts --frozen-lockfile failed: ! Corepack is about to download https://registry.npmjs.org/pnpm/-/pnpm-11.23.0.tgz

Assertions:

  • FAIL expect_output: OpenClaw Setup Engine

How this fits together

The Local AI runtime starts a managed llama-server process, probes its endpoint, then publishes a provider when it is ready. A separate setup-time inference request triggers lazy model loading and verifies response evidence without returning content.

flowchart LR
  A[Managed model install] --> B[Local AI runtime]
  B --> C[Managed-model probe]
  C --> D[Readiness decision]
  D --> E[Published local provider]
  B --> F[Inference verification]
  F --> D
Loading

Before merge

  • Add real behavior proof - Needs real behavior proof before merge: The PR body reports builds, tests, and symbol counts, but no after-fix run of the real managed llama-server path; add redacted terminal or runtime-log proof after preserving compatibility. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
  • Preserve the existing public probe method (P1) - LlamaServerClient is public, but the renamed interface is internal. Removing this member makes existing direct callers of ProbeRouterAsync fail to compile for a documentation-only refactor; retain an obsolete forwarding wrapper while internal callers move to the clearer name.
  • Resolve merge risk (P1) - Merging removes the public LlamaServerClient.ProbeRouterAsync member, causing existing direct source callers to fail compilation on upgrade.
  • Complete next step (P2) - A narrow mechanical compatibility repair is available on the PR branch.

Findings

  • [P1] Preserve the existing public probe method — src/OpenClaw.Connection/LocalAi/LlamaServerClient.cs:167
Agent review details

Security

None.

Review metrics

Metric Value Why it matters
Line delta production +14/-4, tests +1/-1 The narrow patch can preserve the existing API with a small compatibility correction.

Merge-risk options

Maintainer options:

  1. Retain a deprecated forwarding method (recommended)
    Keep ProbeRouterAsync as a documented obsolete wrapper around ProbeManagedModelAsync so existing direct callers continue to compile.
  2. Accept the source break
    Land the rename only with explicit maintainer approval of the breaking public API migration.

Technical review

Best possible solution:

Adopt the clearer managed-model name internally while retaining the old public method as an obsolete forwarding compatibility shim until an explicitly approved removal.

Do we have a high-confidence way to reproduce the issue?

Yes. Any direct consumer compiling a call to the current public LlamaServerClient.ProbeRouterAsync against this head will receive a missing-member error.

Is this the best way to solve the issue?

No. A naming-only cleanup should keep the old public entrypoint as an obsolete forwarder while internal callers use the clearer name.

Full review comments:

  • [P1] Preserve the existing public probe method — src/OpenClaw.Connection/LocalAi/LlamaServerClient.cs:167
    LlamaServerClient is public, but the renamed interface is internal. Removing this member makes existing direct callers of ProbeRouterAsync fail to compile for a documentation-only refactor; retain an obsolete forwarding wrapper while internal callers move to the clearer name.
    Confidence: 0.98

Overall correctness: patch is incorrect
Overall confidence: 0.98

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against ccd64bbb7d68.

Labels

Label changes:

  • add P3: This is a small Local AI clarity refactor without an intended runtime behavior change.
  • add merge-risk: 🚨 compatibility: The renamed public method can break direct source callers during upgrade.
  • add rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🦐 gold shrimp.
  • add status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: The PR body reports builds, tests, and symbol counts, but no after-fix run of the real managed llama-server path; add redacted terminal or runtime-log proof after preserving compatibility. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Label justifications:

  • P3: This is a small Local AI clarity refactor without an intended runtime behavior change.
  • merge-risk: 🚨 compatibility: The renamed public method can break direct source callers during upgrade.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🦐 gold shrimp.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: The PR body reports builds, tests, and symbol counts, but no after-fix run of the real managed llama-server path; add redacted terminal or runtime-log proof after preserving compatibility. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Evidence

Acceptance criteria:

  • [P1] ./build.ps1.
  • [P1] dotnet test ./tests/OpenClaw.Shared.Tests/OpenClaw.Shared.Tests.csproj --no-restore.
  • [P1] dotnet test ./tests/OpenClaw.Tray.Tests/OpenClaw.Tray.Tests.csproj --no-restore.
  • [P1] dotnet test ./tests/OpenClaw.Connection.Tests/OpenClaw.Connection.Tests.csproj --no-restore.

What I checked:

Likely related people:

  • Joel: Current-main blame attributes the probe interface, implementation, and runtime callers to the managed Local AI introduction. (role: introduced Local AI probe behavior; confidence: high; commits: ccd64bbb7d68; files: src/OpenClaw.Connection/LocalAi/LlamaServerClient.cs, src/OpenClaw.Connection/LocalAi/LlamaServerRuntimeService.cs)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Retain the old public method as an obsolete forwarding wrapper and add focused compatibility coverage.
  • Post redacted terminal or runtime-log evidence of a real managed llama-server probe on the updated head.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@shanselman shanselman added the status: 🚢 actively landing A maintainer or agent is actively driving this item through implementation, validation, or merge. label Aug 25, 2026
@clawsweeper

clawsweeper Bot commented Aug 25, 2026

Copy link
Copy Markdown

ClawSweeper status: review started.

I am starting a fresh review of this pull request: refactor(local-ai): clarify managed-model probe contract This is item 1/1 in the current shard. Shard 0/1.

This placeholder means the worker is alive and reading the current context. I will edit this same comment with the actual review when the claws are done clicking.

Crustacean status: shell secured, claws on keyboard, evidence pebbles being sorted.

@shanselman
shanselman merged commit d2fdd70 into openclaw:main Aug 26, 2026
18 checks passed
@shanselman shanselman removed the status: 🚢 actively landing A maintainer or agent is actively driving this item through implementation, validation, or merge. label Aug 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-risk: 🚨 compatibility 🚨 Merging this PR could break existing users, config, migrations, defaults, or upgrades. P3 Low-risk cleanup, docs, polish, ergonomics, or speculative feature. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Clarify Local AI managed-model probe naming and verification documentation

2 participants