Skip to content

fix(ollama): honor canonical model requests and pull completion - #117171

Merged
steipete merged 1 commit into
mainfrom
codex/qa400-providers-local-models
Aug 1, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/qa400-providers-local-models

Conversation

@steipete

@steipete steipete commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

What Problem This Solves

Current main sends Ollama's deprecated name field to both model inspection and download endpoints. Servers and compatible proxies enforcing the documented model contract reject discovery, context/capability inspection, setup, and paired-node model selection.

The shared Ollama download parser also treats empty, interrupted, progress-only, malformed, and truncated streams as successful downloads. Interactive setup announces success even when the model never finished installing, and non-interactive setup can select an unavailable model.

Why This Change Was Made

Ollama's pull API requires model and returns {"status":"success"} when a pull completes. The actual upstream ShowRequest and PullRequest both explicitly deprecate name in favor of model.

This change moves both request producers to the same canonical API contract, removes the stale compatibility fallback in the real paired-node fixture, and makes the shared pull parser return success only after the authoritative provider terminal record. Progress aggregation, explicit provider errors, cancellation, resource cleanup, and non-newline-terminated final success remain supported.

User Impact

  • Ollama discovery, tool/context capability inspection, onboarding, downloads, and paired-node inference work against servers requiring the documented model request field.
  • Empty, interrupted, malformed, and incomplete downloads produce actionable errors instead of falsely announcing or configuring unavailable models.
  • Existing model defaults, explicit failures, progress, cancellation, deadlines, HTTP body cleanup, and authenticated paired-node Gateway behavior remain intact.
  • Two production owners change with 21 lines added and 21 lines removed. No authentication, public configuration, Plugin SDK, protocol, or persistence behavior changes.

Evidence

  • Frozen baseline fdcb321bfaaadb5a1e7d123b6be7a934980f8b12: 12 failing regression cases and 33 passing controls.
  • Immutable candidate e4ab3d42daa4d560d3015fb81b6d23ed24cc7315, exact tree 93054809d555ae96f20a763b9f860ac3366db84c, independently verified clean in a separate detached remote checkout.
  • Full plugin test-type compile passed: node scripts/run-tsgo.mjs -p test/tsconfig/tsconfig.extensions.test.json --incremental --tsBuildInfoFile /tmp/openclaw-qa400-ollama-extensions-test.tsbuildinfo.
  • Full normal type-aware Ollama-owner lint and plugin SDK boundary preparation passed: node scripts/run-oxlint.mjs --tsconfig config/tsconfig/oxlint.extensions.json extensions/ollama.
  • 144 tests passed across 10 files and two Vitest shards, including a real authenticated Gateway/paired-node WebSocket and Ollama HTTP end-to-end test.
  • Exact-head Blacksmith proof: https://github.com/openclaw/openclaw/actions/runs/30679704457.
  • Genuine full-branch Codex autoreview, --max-priority P3: zero findings, patch is correct, confidence 0.95; TruffleHog clean.
  • Candidate Testbox lease stopped and independently verified completed.

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. P2 Normal backlog priority with limited blast radius. labels Aug 1, 2026
@clawsweeper

clawsweeper Bot commented Aug 1, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed July 31, 2026, 10:38 PM ET / August 1, 2026, 02:38 UTC.

ClawSweeper review

What this changes

This PR changes the bundled Ollama provider to use its canonical model request field for model inspection and downloads, and only reports a download complete after Ollama emits its success pull record.

Merge readiness

⚠️ Ready for maintainer review - 2 items remain

Keep this PR open for explicit maintainer handling: current main still sends the deprecated name request field and can report incomplete Ollama pulls as successful, while the branch repairs both production owners with focused regression coverage. The patch is correct on the inspected paths; its protected maintainer label and in-progress exact-head checks mean it should not receive an automated cleanup outcome.

Priority: P2
Reviewed head: e4ab3d42daa4d560d3015fb81b6d23ed24cc7315
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused owner-boundary fix with strong regression coverage and supplied exact-head behavior evidence; only protected-label owner review and finishing checks remain.
Proof confidence 🐚 platinum hermit (4/6) ✨ media proof bonus Sufficient (linked_artifact): The PR provides exact-head remote evidence for the changed behavior, including an authenticated Gateway/paired-node WebSocket and Ollama HTTP end-to-end path, plus focused terminal-stream regression coverage.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (linked_artifact): The PR provides exact-head remote evidence for the changed behavior, including an authenticated Gateway/paired-node WebSocket and Ollama HTTP end-to-end path, plus focused terminal-stream regression coverage.
Evidence reviewed 8 items Current-main request contract defect: Current main posts { name: modelName } to /api/show, although the documented Ollama request contract uses model; the same stale field is used by the download producer.
Current-main false completion path: The current pull parser returns success for blank, malformed, and non-terminal status records; when the stream ends it returns that parser result, allowing an incomplete pull to reach setup as successful.
Setup caller makes the pull result durable: Non-interactive setup adds the requested model to the available set only when the shared pull helper returns true, then proceeds to save the provider configuration; rejecting incomplete streams at the shared helper is the owning boundary.
Findings None None.
Security None None.

How this fits together

The Ollama provider plugin discovers installed models and inspects their capabilities during setup and runtime selection. Its onboarding path pulls missing local models, then passes the successful result to setup code that persists the selected provider model.

flowchart LR
  A[Ollama server or proxy] --> B[Ollama provider plugin]
  B --> C[Model inspection request]
  B --> D[Model download request]
  D --> E[Pull progress stream]
  E --> F[Terminal success decision]
  C --> G[Model capability selection]
  F --> H[Interactive and non-interactive setup]
  G --> H
Loading

Decision needed

Question Recommendation
After the current exact-head checks finish, should the maintainer owner merge this provider-local repair once the clean merge result still preserves the inspected request and terminal-stream behavior? Merge after exact-head gates: Merge when the in-progress required checks and clean three-way merge confirm the reviewed Ollama request and pull-completion behavior.

Why: The patch is a bounded correctness fix, but the item has the protected maintainer label and the remaining decision is an explicit owner merge decision rather than an automated cleanup action.

Before merge

  • Resolve merge risk (P1) - The PR is behind current main and some exact-head checks are still in progress; confirm the clean merge result and required checks before an explicit maintainer merge.
Agent review details

Security

None.

PR surface

Source 0, Tests +94. Total +94 across 9 files.

View PR surface stats
Area Files Added Removed Net
Source 2 21 21 0
Tests 7 134 40 +94
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 9 155 61 +94

Review metrics

None.

Stored data model

Persistent data-model change detected: serialized state: extensions/ollama/provider-discovery.test.ts, serialized state: extensions/ollama/src/provider-models.test.ts, serialized state: extensions/ollama/src/provider-models.ts, serialized state: extensions/ollama/src/setup-pull.test.ts, serialized state: extensions/ollama/src/setup-pull.ts, serialized state: extensions/ollama/src/setup.non-interactive-auth.test.ts, and 2 more. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Land the canonical two-owner repair after the current merge result and required checks confirm the exact head; retain the strict terminal-success rule so setup never records an unavailable local model as installed.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Land the canonical two-owner repair after the current merge result and required checks confirm the exact head; retain the strict terminal-success rule so setup never records an unavailable local model as installed.

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

Yes, at source level: current main sends { name: ... } to both affected Ollama endpoints and treats several incomplete stream endings as success; a strict endpoint and the candidate regression fixtures exercise those paths directly.

Is this the best way to solve the issue?

Yes. The patch changes the two request producers and the shared pull-result owner used by both interactive and non-interactive setup, instead of adding a downstream guard or a compatibility fallback.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P2: This repairs a real but bounded local-provider discovery and onboarding failure without evidence of data loss, security exposure, or core-runtime unavailability.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (linked_artifact): The PR provides exact-head remote evidence for the changed behavior, including an authenticated Gateway/paired-node WebSocket and Ollama HTTP end-to-end path, plus focused terminal-stream regression coverage.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR provides exact-head remote evidence for the changed behavior, including an authenticated Gateway/paired-node WebSocket and Ollama HTTP end-to-end path, plus focused terminal-stream regression coverage.

Evidence

What I checked:

  • Current-main request contract defect: Current main posts { name: modelName } to /api/show, although the documented Ollama request contract uses model; the same stale field is used by the download producer. (extensions/ollama/src/provider-models.ts:175, 7fba71eb7aeb)
  • Current-main false completion path: The current pull parser returns success for blank, malformed, and non-terminal status records; when the stream ends it returns that parser result, allowing an incomplete pull to reach setup as successful. (extensions/ollama/src/setup-pull.ts:95, 7fba71eb7aeb)
  • Setup caller makes the pull result durable: Non-interactive setup adds the requested model to the available set only when the shared pull helper returns true, then proceeds to save the provider configuration; rejecting incomplete streams at the shared helper is the owning boundary. (extensions/ollama/src/setup.ts:499, 7fba71eb7aeb)
  • Candidate repairs both canonical producers: The candidate replaces name with model for /api/show and /api/pull, and it rejects stream exhaustion unless a parsed record reports status: "success". (extensions/ollama/src/setup-pull.ts:71, e4ab3d42daa4)
  • Regression coverage follows the real failure boundary: Candidate tests assert the canonical request body, reject empty/interrupted/malformed/truncated streams, preserve a non-newline-terminated success record, and verify non-interactive setup does not announce completion after an interrupted pull. (extensions/ollama/src/setup-pull.test.ts:20, e4ab3d42daa4)
  • Upstream API contract: Ollama’s official pull API documentation and upstream request types define model as the request field and identify success as the completion status; this supports using the provider’s terminal record rather than transport EOF as the completion fact.

Likely related people:

  • steipete: Peter Steinberger authored the recent current-main commit carrying both affected owners and is also the author of this focused follow-up repair. (role: introduced current behavior and recent area contributor; confidence: high; commits: 2f875c5ad726, e4ab3d42daa4; files: extensions/ollama/src/provider-models.ts, extensions/ollama/src/setup-pull.ts, extensions/ollama/src/setup.ts)

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.

@steipete
steipete merged commit 865a728 into main Aug 1, 2026
119 of 129 checks passed
@steipete
steipete deleted the codex/qa400-providers-local-models branch August 1, 2026 03:20
@steipete

steipete commented Aug 1, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

vincentkoc added a commit to chenyangjun-xy/openclaw that referenced this pull request Aug 1, 2026
* origin/main:
  fix(onboard): stop a full reset from resetting the default workspace when the config is unreadable (openclaw#114110)
  refactor(i18n): remove unused Apple contradiction report (openclaw#117182)
  fix(google): stop scraping Gemini CLI OAuth credentials (openclaw#117167)
  perf: count large histories before Gateway prewarm (openclaw#117118)
  fix(signal): restore provider-safe original attachment filenames (openclaw#115107)
  refactor(channels): unify setup ownership across bundled channels (openclaw#117188)
  fix: allow gateway service commands for named profiles (openclaw#116314)
  fix(plugins): invalidate bundled artifact locations after metadata refresh (openclaw#117041)
  fix(ollama): honor model requests and pull completion contracts (openclaw#117171)
  fix(agents): prevent fallback after stale lifecycle abort (openclaw#117168)
  fix(telegram): confirm polling before long poll (openclaw#116970)
  fix(tlon): wire autoDiscoverChannels through the settings-store round-trip (openclaw#114949)
  fix(gateway): yield before post-ready background work (openclaw#117083)
  test(google): cover live transcript overflow
  fix(google): bound live transcript accumulation
wingwkyuen pushed a commit to tcgoidc/openclaw that referenced this pull request Aug 1, 2026
* commit '6938f7dddb63bad59862c014c427d63f0a41a6f4': (368 commits)
  fix: allow gateway service commands for named profiles (openclaw#116314)
  fix(plugins): invalidate bundled artifact locations after metadata refresh (openclaw#117041)
  fix(ollama): honor model requests and pull completion contracts (openclaw#117171)
  fix(agents): prevent fallback after stale lifecycle abort (openclaw#117168)
  fix(telegram): confirm polling before long poll (openclaw#116970)
  fix(tlon): wire autoDiscoverChannels through the settings-store round-trip (openclaw#114949)
  fix(gateway): yield before post-ready background work (openclaw#117083)
  fix(ui): keep canvas lease renewals lifecycle-owned and timer-safe (openclaw#117173)
  fix(teams): restore the official square product icon (openclaw#117170)
  refactor(ui): replace duplicated locale bundles with canonical translation memory (openclaw#117157)
  fix(ui): retire stale Gateway event-log observers (openclaw#117169)
  fix(agents): keep subagent status consistent after restart and large fan-outs (openclaw#117141)
  refactor(ui): unify filtered session list ownership (openclaw#117158)
  refactor(agents): consolidate context budgets and compaction recovery (openclaw#117149)
  fix(net-policy): redact sig and x-* auth params in URLs and bodies (openclaw#116957)
  refactor(agents): remove duplicate generated-media delivery fallbacks (openclaw#117150)
  refactor(reply): unify turn lifecycle state ownership (openclaw#117145)
  fix(ui): preserve emoji agent avatar initials (openclaw#104912)
  refactor(auto-reply): unify command and directive ownership (openclaw#117143)
  refactor(plugins): consolidate descriptor and startup ownership (openclaw#117146)
  ...
sunlit-deng pushed a commit to sunlit-deng/openclaw that referenced this pull request Aug 1, 2026
* commit '441d6ab254df14fb6939a8a261f474904ff9c500': (388 commits)
  fix(qqbot): ignore blank app id fallbacks (openclaw#109460)
  fix(feishu): consume implicit reply targets across media delivery (openclaw#117196)
  fix(exec): preserve approved command output when sessions resume (openclaw#117177)
  fix(qa): use public subagent fanout evidence (openclaw#116832)
  fix(googlechat): cancel unread auth response bodies before release (openclaw#115873)
  fix(queue): prevent cron saturation from starving hook dispatch (openclaw#116666)
  fix(gateway): sessions.steer retry no longer interrupts an active run when replaying a cached idempotency key (openclaw#116969)
  fix(irc): config validation rejects documented channels.irc.configWrites key (openclaw#112392)
  fix(mistral): keep terminal error branch lint-clean
  fix(onboard): stop a full reset from resetting the default workspace when the config is unreadable (openclaw#114110)
  refactor(i18n): remove unused Apple contradiction report (openclaw#117182)
  fix(google): stop scraping Gemini CLI OAuth credentials (openclaw#117167)
  perf: count large histories before Gateway prewarm (openclaw#117118)
  fix(signal): restore provider-safe original attachment filenames (openclaw#115107)
  refactor(channels): unify setup ownership across bundled channels (openclaw#117188)
  fix: allow gateway service commands for named profiles (openclaw#116314)
  fix(plugins): invalidate bundled artifact locations after metadata refresh (openclaw#117041)
  fix(ollama): honor model requests and pull completion contracts (openclaw#117171)
  fix(agents): prevent fallback after stale lifecycle abort (openclaw#117168)
  fix(telegram): confirm polling before long poll (openclaw#116970)
  ...
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 1, 2026
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 1, 2026
* commit '55215cd9edd2b585cbaee5481d5352aabf7e4399': (368 commits)
  fix: allow gateway service commands for named profiles (openclaw#116314)
  fix(plugins): invalidate bundled artifact locations after metadata refresh (openclaw#117041)
  fix(ollama): honor model requests and pull completion contracts (openclaw#117171)
  fix(agents): prevent fallback after stale lifecycle abort (openclaw#117168)
  fix(telegram): confirm polling before long poll (openclaw#116970)
  fix(tlon): wire autoDiscoverChannels through the settings-store round-trip (openclaw#114949)
  fix(gateway): yield before post-ready background work (openclaw#117083)
  fix(ui): keep canvas lease renewals lifecycle-owned and timer-safe (openclaw#117173)
  fix(teams): restore the official square product icon (openclaw#117170)
  refactor(ui): replace duplicated locale bundles with canonical translation memory (openclaw#117157)
  fix(ui): retire stale Gateway event-log observers (openclaw#117169)
  fix(agents): keep subagent status consistent after restart and large fan-outs (openclaw#117141)
  refactor(ui): unify filtered session list ownership (openclaw#117158)
  refactor(agents): consolidate context budgets and compaction recovery (openclaw#117149)
  fix(net-policy): redact sig and x-* auth params in URLs and bodies (openclaw#116957)
  refactor(agents): remove duplicate generated-media delivery fallbacks (openclaw#117150)
  refactor(reply): unify turn lifecycle state ownership (openclaw#117145)
  fix(ui): preserve emoji agent avatar initials (openclaw#104912)
  refactor(auto-reply): unify command and directive ownership (openclaw#117143)
  refactor(plugins): consolidate descriptor and startup ownership (openclaw#117146)
  ...
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 1, 2026
* origin/main:
  fix(onboard): stop a full reset from resetting the default workspace when the config is unreadable (openclaw#114110)
  refactor(i18n): remove unused Apple contradiction report (openclaw#117182)
  fix(google): stop scraping Gemini CLI OAuth credentials (openclaw#117167)
  perf: count large histories before Gateway prewarm (openclaw#117118)
  fix(signal): restore provider-safe original attachment filenames (openclaw#115107)
  refactor(channels): unify setup ownership across bundled channels (openclaw#117188)
  fix: allow gateway service commands for named profiles (openclaw#116314)
  fix(plugins): invalidate bundled artifact locations after metadata refresh (openclaw#117041)
  fix(ollama): honor model requests and pull completion contracts (openclaw#117171)
  fix(agents): prevent fallback after stale lifecycle abort (openclaw#117168)
  fix(telegram): confirm polling before long poll (openclaw#116970)
  fix(tlon): wire autoDiscoverChannels through the settings-store round-trip (openclaw#114949)
  fix(gateway): yield before post-ready background work (openclaw#117083)
  test(google): cover live transcript overflow
  fix(google): bound live transcript accumulation
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 1, 2026
* commit 'ae4e662145b6aa162777cdb1c011b3f04ddd230d': (388 commits)
  fix(qqbot): ignore blank app id fallbacks (openclaw#109460)
  fix(feishu): consume implicit reply targets across media delivery (openclaw#117196)
  fix(exec): preserve approved command output when sessions resume (openclaw#117177)
  fix(qa): use public subagent fanout evidence (openclaw#116832)
  fix(googlechat): cancel unread auth response bodies before release (openclaw#115873)
  fix(queue): prevent cron saturation from starving hook dispatch (openclaw#116666)
  fix(gateway): sessions.steer retry no longer interrupts an active run when replaying a cached idempotency key (openclaw#116969)
  fix(irc): config validation rejects documented channels.irc.configWrites key (openclaw#112392)
  fix(mistral): keep terminal error branch lint-clean
  fix(onboard): stop a full reset from resetting the default workspace when the config is unreadable (openclaw#114110)
  refactor(i18n): remove unused Apple contradiction report (openclaw#117182)
  fix(google): stop scraping Gemini CLI OAuth credentials (openclaw#117167)
  perf: count large histories before Gateway prewarm (openclaw#117118)
  fix(signal): restore provider-safe original attachment filenames (openclaw#115107)
  refactor(channels): unify setup ownership across bundled channels (openclaw#117188)
  fix: allow gateway service commands for named profiles (openclaw#116314)
  fix(plugins): invalidate bundled artifact locations after metadata refresh (openclaw#117041)
  fix(ollama): honor model requests and pull completion contracts (openclaw#117171)
  fix(agents): prevent fallback after stale lifecycle abort (openclaw#117168)
  fix(telegram): confirm polling before long poll (openclaw#116970)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

extensions: ollama maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: M status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant