Repository navigation
fix(llama-cpp): reconcile managed router state before requests - #136363
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
@clawsweeper review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Codex review: blocked before merge. Reviewed September 5, 2026, 2:02 PM ET / 18:02 UTC. ClawSweeper reviewWhat this changesReconciles managed llama.cpp router presets before requests and preserves prepared provider state across chat, embeddings, completion, compaction, PDF, and image processing. Merge readiness⛔ Blocked before merge - 2 items remain The previous endpoint blocker is repaired, and current main still lacks the central reconciliation behavior. No remaining blocking correctness finding was established in the inspected paths. Priority: P2 Review scores
Verification
How this fits togetherOpenClaw prepares provider models and leases their local server before sending inference requests. The llama.cpp plugin owns the server’s model presets; the shared transport waits for its reconciliation before dispatch. flowchart TD
A[Chat and utility requests] --> B[Prepared provider model]
B --> C[Local server health and lease]
C --> D[Plugin preset reconciliation]
E[Configured models and limits] --> D
D --> F{Reload successful?}
F -->|Yes| G[Provider request]
F -->|No| H[Release lease and report failure]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +207, Tests +1001, Docs +12, Other +1. Total +1221 across 42 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep reconciliation at the plugin-owned post-health boundary; the added lifecycle code supplies ordering that existing pre-stream wrappers cannot guarantee while removing stale preparation caches. Do we have a high-confidence way to reproduce the issue? Yes, from source: current main caches successful preparation and can reuse a healthy router without applying subsequent preset transitions. No failing runtime scenario was executed during this read-only review. Is this the best way to solve the issue? Yes, the owner boundary is appropriate: the plugin controls preset state while core supplies post-health request ordering; a preparation-only wrapper cannot cover healthy-router reuse. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 925fb0c3353c. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (16 earlier review cycles; latest 8 shown)
|
9ca1fbe to
caac0bd
Compare
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
c0780f9 to
0020bbd
Compare
a8bf019 to
c91b706
Compare
|
Maintainer disposition for the exact reviewed head
The PR body now records both decisions plus exact-head native Windows ARM64, |
|
Merged via squash.
|
* commit '911d7d5b0c107f7274f2415ca9655dcc6105f0e8': (867 commits) fix(skills): deliver pending Workshop approval controls (#139248) fix(gateway): deliver loopback ask_user prompts to the originating channel (#138831) docs: keep root agent instructions focused on repository policy (#139258) fix(matrix): exclude archived state roots from scans and selection (#112329) perf(agents): prepare exact tool names once per catalog batch (#139267) fix: preserve Swarm progress and simplify owner plumbing (#139269) fix(tailscale): release claims after gateway process-group exit (#139261) refactor(cli): simplify lazy command registration (#139108) test(ui): retain synthetic widget failure evidence (#139229) fix(buzz): keep implicit replies at thread root (#138879) test(diagnostics): await graceful Gateway shutdown before cleanup (#139247) fix(ci): unblock releases with different tooling package managers (#139259) feat(ui): add social preview links for private sessions (#139250) fix(codex): retain failed conversations for guarded continuation (#139246) chore(ui): refresh control ui locales (#139200) fix(ci): run browser checks for real-gateway inputs (#139256) fix(llama-cpp): reconcile managed router state before requests (#136363) chore(i18n): refresh native locales (#139237) refactor(worker): unify inference payload handling (#139245) refactor(terminal): replay wrapped prefixes in one pass (#139240) ...
…law#136363) * fix(llama-cpp): reconcile managed router state before requests * fix(llama-cpp): type managed stream wrapper * fix(llama-cpp): restore reconciliation type coverage * fix(ci): repair provider topology and stream typing * fix(ci): document reconciler type assertions * test(plugins): keep reconciler coverage within lint budget * fix(llama-cpp): attach managed reconciliation to completion paths * fix(pdf): preserve prepared provider stream * fix(runtime): preserve prepared media provider generation * test(agents): avoid lifecycle fixture shadowing * fix(llama-cpp): retain resolved artifacts across requests * fix(agents): preserve provider runtime registry * test(llama-cpp): complete warm-cache model fixture * fix(agents): preserve exact configured local-service endpoint * test(agents): keep local-service acquisition proof lintable
What Problem This Solves
Managed llama.cpp preset state could be stale when a request bypassed the normal
agent dispatch path. Simple completion, compaction, PDF fallback, and image
description could prepare a provider but lose the prepared local-service
reconciler before completion or streaming. A guarded fetch could then reach a
healthy router before the plugin had applied the current preset.
This was most visible across model or limit transitions, Gateway restart, and
router-origin changes. Reload failure also needed to fail closed rather than
dispatch against stale state.
Canonical Fix
local-service reconciler and provider generation.
service health acquisition; it does not resolve plugins on the request path.
serialized router reloads.
The preset lifecycle retains and deterministically orders configured chat
sections, preserves embedding state, prunes sections outside the configured
inventory, writes atomically only when canonical bytes change, and keeps the
desired revision dirty until reload succeeds. Direct-model local services do
not perform router reloads.
There is no stale-state fallback: reconciliation failure or cancellation blocks
the provider request and releases its request lease.
The endpoint matcher preserves all three accepted forms for one configured
service: the original normalized URL, its root, and lowercase
/v1. A configuredlegacy
/V1URL therefore remains an exact acquisition target while the root andcanonical lowercase alias also work.
Scope And Compatibility
migration, upgrade, or Gateway protocol change.
context export, and one optional acquisition callback. There are no removals
or signature changes.
pnpm plugin-sdk:surface:check: 152 public entrypoints, 4,436 exports,2,620 callable exports, and zero package-exported forbidden subpaths.
Maintainer Decision
Accepted: the optional provider reconciliation hook and fail-closed reload
behavior are intentional compatibility tradeoffs. Serving against stale router
state is worse than surfacing the reload failure. Endpoint compatibility and
direct-model behavior remain covered.
The ClawSweeper embedding-provider data-model classification is a false
positive.
extensions/llama-cpp/src/embedding-provider.tsonly threads preparedruntime and reconciliation state. It does not change SQLite schema, serialized
state, vector metadata, migrations, or upgrade semantics.
Exact Candidate
4fc265e91c1403fe6996d54d2a90e9f5b365ca3b9d51145036cfa13c260543286b6f2df91e27c2f3+1762/-541.+620/-413(net+207), tests/support+1128/-127(net+1001), docs+12, tooling+2/-1(net+1).At the final guard, live
mainwasbd381bffb29df6994e78353be688d8a552e4b4bb. Its only changed-pathintersection with the PR is three files touched by the unrelated Workshop cron
refactor
efa4b5dfbb3a87ba973f2fb53ba4f454e345ed4e. The edits are in disjointhunks, and
git merge-tree --write-treesucceeds without conflicts.Verification
Exact-Head Hosted CI
Head
4fc265e91c1403fe6996d54d2a90e9f5b365ca3bis fully green:openclaw/ci-gateFocused And Testbox Proof
22/22,changed-file formatting/lint, and
git diff --check.d67e4265b061e53a5a4a9fc16b069dd418906b2epassed production lint,
pnpm tsgo,pnpm check:test-types, formatting, andthe provider local-service suite
22/22. The final test-only commit compactsthat proof below the line-count lint budget; exact-head hosted CI covers it.
https://github.com/openclaw/openclaw/actions/runs/33970834644
covered
pnpm check:changed, llama.cpp and provider contracts, SDK surface,production/test types, build, PDF, image, compaction, and normal dispatch.
Focused coverage proves ordering, fail-closed behavior, prepared-generation
preservation, request-lease release, same-generation reuse, simple completion,
compaction, normal dispatch, PDF, image,
/btw, configured-origin changes,direct-model behavior, root alias acquisition, and exact configured
/V1acquisition.
Native Windows ARM64
The exact head and tree were exercised on a native Windows ARM64 host with Node
24:
b10534, build10534, commit2b5621094ef383cdcd8428ef6d22efe5df976532, using the Windows CPU ARM64archive.
terminal
[DONE].configured
/V1endpoint.chat.sendandagent.waitwith statusok, received HTTP 200 SSE from the provider, wrotefive chat events, and retained two history messages byte-for-byte across a
Gateway restart.
llama.cpp and Ollama rows from an intentional mock catalog, and unique search
filtered to the llama.cpp row.
The native live Gateway dispatch used the configured generic llama.cpp provider;
managed-plugin lifecycle and reconciliation are covered by the hosted and WSL2
test suites. Ollama was not installed on the host, so no live Ollama inference
claim is made. The pinned Windows ARM64 llama.cpp asset is CPU-only, so this is
not NVIDIA/GPU parity proof.
The native source build connection dropped after producing the unified bundle;
exact-head hosted
build-artifactscompleted successfully.WSL2 ARM64
An exact-head task worktree on WSL2 ARM64 with Node 24.15 passed:
22/2230/3052/52The Windows model artifact was not available through the WSL mount during this
run, so WSL2 establishes source/runtime parity rather than live model throughput
or GPU parity.
Dependency Contracts
OpenClaw pins llama.cpp release
b10534, commit2b5621094ef383cdcd8428ef6d22efe5df976532.Direct source inspection confirmed:
GET /models?reload=1synchronously reloads before responding:https://github.com/ggml-org/llama.cpp/blob/2b5621094ef383cdcd8428ef6d22efe5df976532/tools/server/server-models.cpp#L1963-L1967
https://github.com/ggml-org/llama.cpp/blob/2b5621094ef383cdcd8428ef6d22efe5df976532/tools/server/server-models.cpp#L42
The sibling Codex runtime source at
5f49aba876922d6f2f55caa153bbb0ed1b46febawas inspected before verdict andchange, including app-server protocol request shape, thread request processing,
remote compaction, and provider client dispatch.
Review
commits, no privacy or SDK-surface drift.
fix(llama-cpp): reconcile managed router state before requests #136363 (comment)
found no actionable code, security, or correctness findings. The two
maintainer decisions requested there are explicitly accepted and documented
above.