Skip to content

fix(llama-cpp): report external server model discovery failures - #139846

Merged
obviyus merged 1 commit into
mainfrom
codex/llama-server-catalog
Sep 6, 2026
Merged

obviyus merged 1 commit into
mainfrom
codex/llama-server-catalog

Conversation

@obviyus

@obviyus obviyus commented Sep 6, 2026 •

Copy link
Copy Markdown
Collaborator

Related: #136257.

What Problem This Solves

Refreshing an external model server could silently return empty or cached inventory after authentication rejection or discovery failure.

Why This Change Was Made

The external producer uses the shared catalog-outcome handler and bypasses the advisory discovery cache on explicit refresh. It preserves explicit authorization-header precedence and attributes outcomes only to the credential profile actually used. Redundant provider reconstruction and success-shaped failures are removed.

User Impact

Authentication rejection and unavailability remain visible while compatible inventory survives temporary failure. Endpoint or credential replacement retires old learned rows. Successful empty results remove discovery rows but preserve explicit models. Managed-server behavior and public advisory defaults remain unchanged.

Consumers: external-server refresh now publishes actual acquisition outcomes.

Evidence

The built baseline hid failures; the candidate reported them. Seven regressions failed before repair. Candidate tests passed 15 producer, 87 sibling, and five Doctor cases. Built Gateway/CLI checks covered failures, recovery, empty results, credential changes, headers, attribution, and helper compatibility against synthetic endpoints. Shared discovery retains a separate stored-profile/no-provider-key selection limitation. No live inference was tested. The bundled helper requires normal host/plugin release synchronization.

@obviyus obviyus self-assigned this Sep 6, 2026
@clawsweeper

clawsweeper Bot commented Sep 6, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation extensions: llama-cpp size: S maintainer Maintainer-authored PR labels Sep 6, 2026
@obviyus
obviyus marked this pull request as ready for review September 6, 2026 06:27
@obviyus

obviyus commented Sep 6, 2026

Copy link
Copy Markdown
Collaborator Author

Verified head: 7d76f5eccc52801ebcd61cbc729ab2649517c39a.

Exact-head CI is green: run 34016534632. The retained watcher ended SUCCESS, zero pending checks, GREEN.

  • Independent ClawSweeper review: platinum/B, proof A, no findings, security concerns, or rank-up moves; real behavior proof sufficient.
  • Built baseline ec29145c0edcf178750ad3bf39b3e3465b1ab3bb: a captured external /models HTTP 503 produced {"models":[]} without a provider outcome. The exact candidate produces {"provider":"llama-cpp","status":"unavailable"} in providerOutcomes.
  • Independent Gateway acceptance passes: healthy refresh, all six failure inputs, same-scope retention/recovery, endpoint and actual credential replacement, empty inventory with explicit models, profile attribution, Authorization precedence, and quiet unconfigured reads. Direct wire checks distinguish HTTP 503 from curl exit 52/no HTTP response. The public advisory helper keeps its previous behavior.
  • Validation commands: node scripts/run-vitest.mjs extensions/llama-cpp/src/external-server extensions/llama-cpp/index.test.ts; after correcting the test's default endpoint fixture, node scripts/run-vitest.mjs extensions/llama-cpp/src/external-server/provider.test.ts src/plugins/doctor-contract-declarations.test.ts src/plugins/doctor-contract-closure-guard.test.ts. Combined retained coverage: 102 owner tests and 5 doctor checks. The final changed regressions also fail on the baseline for the intended missing outcomes.
  • Changed-file format, syntax lint, max-lines/assertion ratchets, conflict markers and wildcard guards pass. Exact remote sourcePerformance builds passed for baseline and candidate. No native inference or prior-package binary execution is claimed.
  • Production +10 lines, tests/support +37, docs +6. The existing profile-selection limitation remains documented in the PR; shared auth owners and the source draft are unchanged.

@obviyus
obviyus merged commit 0ed5f76 into main Sep 6, 2026
207 checks passed
@obviyus
obviyus deleted the codex/llama-server-catalog branch September 6, 2026 06:38
@obviyus

obviyus commented Sep 6, 2026

Copy link
Copy Markdown
Collaborator Author

Landed in 0ed5f76cbea5cc43734ff201e6c61102eb2f0e58.

  • Bug: External llama-server discovery failures silently appeared as empty or cached successful catalogs.
  • Fix: The producer reports typed failure outcomes through the shared catalog owner; compatible inventory survives failure and updates on recovery.
  • Proof: Built Gateway before/after evidence and independent acceptance pass. Exact-head CI 34016534632 is green; independent ClawSweeper review is platinum/B with no findings or rank-up moves.
  • Landing: The first request was explicitly rejected when main advanced. Its receipt and failure are retained; the documented guarded recovery merged the same reviewed head. No checks were bypassed.
  • Scope: Source draft feat(models): direct model lists and provider login across surfaces #136257 remains open and unchanged. Managed behavior and public advisory defaults are preserved. The separate pre-existing profile-selection limitation is documented in the PR.
Before After
HTTP 503 yielded an empty list with no failure outcome Refresh reports unavailable
Cached rows hid authentication rejection Refresh reports auth-rejected with correct credential attribution
Failed and empty discovery were indistinguishable Failed refresh retains compatible rows; successful empty clears discovered rows

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 7, 2026
…claw#139846)

## What Problem This Solves

Fixes an issue where refreshing models from a configured external llama-server silently returned an empty or cached model list when the server rejected authentication or discovery failed.

Related: openclaw#136257. This extracts the external llama-server producer repair; the source draft stays open and unmerged.

## Why This Change Was Made

The external producer converted structured discovery failures into successful provider results. It now uses the existing live-catalog outcome handler and bypasses the advisory discovery cache on explicit refresh. The shared publication owner can retain compatible inventory, expose the failure, and replace it on recovery.

The provider preserves explicit Authorization precedence and attributes an outcome only to the profile whose actual credential supplied discovery. Synthetic local markers do not turn unconfigured probes into failures. The canonical provider builder already normalizes the endpoint, so redundant reconstruction and the success-shaped failure branch are removed.

## User Impact

- HTTP 401/403 reports authentication rejection; service, transport and malformed-response failures report unavailability.
- Compatible inventory survives temporary failure; replacing the endpoint or credentials cannot retain the prior scope's discovered rows.
- A successful empty catalog removes discovered rows while preserving explicit models.
- Managed llama.cpp, dynamic model preparation, and the published advisory helper defaults stay unchanged.

## Evidence

- Built baseline `d103ceca3aaab116245989553ae776e621b462ec`: Gateway `models.list` returned `models: []` with no outcome during a captured `/models` HTTP 503. A healthy control returned `catalog-one`; the following 401 refresh still had no failure outcome.
- Built candidate `7d76f5eccc52801ebcd61cbc729ab2649517c39a`: the same cold-failure flow returns `providerOutcomes: [{ provider: "llama-cpp", status: "unavailable" }]`. The existing shared static starter remains distinguishable from live discovery by this provider outcome.
- Seven changed regressions fail on the baseline. Candidate producer tests pass 15/15; retained sibling coverage passes 87/87 and doctor contracts pass 5/5. Syntax lint checks both changed TypeScript files with no diagnostics; format and assertion/line ratchets pass.
- Independent code review is clean through P2. Exact builds use isolated Node 24 containers and synthetic HTTP faults through the normal Gateway/CLI; no operator state or live inference account is used.
- Independent runtime acceptance covers immediate refresh, six failure inputs, retained inventory and recovery, endpoint/key/header/profile-secret replacement, authoritative empty/manual rows, actual profile attribution, header precedence, quiet unconfigured reads, and the public advisory helper. Direct curl distinguishes HTTP 503 from an empty-response transport failure; the Gateway reports `unavailable` for both. The public outcome schema intentionally omits the internal rejection scope, and catalog-only rejection leaves explicit execution routes available.
- Stable `@openclaw/[email protected]` exposes the plugin entry and embedding policy helper, not this private producer. The published `provider-setup` advisory discovery default and its existing `rawResult` selector are unchanged. The owning manifest already declares refreshable discovery.
- The outcome helper comes from the merged shared catalog prerequisite. Normal release synchronization advances plugin API compatibility and the published host peer range; this PR does not publish a standalone plugin for the old host.
- Scope: production +10 lines, tests/support +37, docs +6; no generated, dependency, configuration or schema changes. The small production increase supplies typed outcomes and credential attribution after removing duplicated provider construction; broader transport or managed-path cleanup would be unrelated.

Known pre-existing follow-up: shared discovery selects synthetic no-auth when only a stored llama.cpp profile is configured and the provider key is unset. This PR leaves shared credential selection unchanged. Positive profile attribution and replacement were exercised through the supported `LLAMA_SERVER_API_KEY` placeholder route with no environment value. Managed/native execution is covered by unchanged owner paths and tests, not live inference.

Co-authored-by: Ayaan Zaidi <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation extensions: llama-cpp maintainer Maintainer-authored PR size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant