Skip to content

improve(models): avoid Ollama runtime load during model listing - #117465

Merged
vincentkoc merged 1 commit into
mainfrom
perf/models-list-ollama-policy
Aug 1, 2026
Merged

vincentkoc merged 1 commit into
mainfrom
perf/models-list-ollama-policy

Conversation

@vincentkoc

@vincentkoc vincentkoc commented Aug 1, 2026 •

Copy link
Copy Markdown
Member

Related: #117323

What Problem This Solves

Listing configured Ollama models could activate the full Ollama plugin for each row even though neither the local nor cloud provider performs runtime model normalization.

Why This Change Was Made

The lightweight Ollama provider-policy artifact now explicitly marks configured local and cloud rows as unchanged. This keeps the decision at the provider-owned boundary and avoids loading discovery, embeddings, media, setup, and web-search modules for a normalization hook that does not exist.

The full plugin remains responsible for live discovery and every runtime capability. Unrelated provider ids still fall through to the normal runtime path.

User Impact

Operators with configured Ollama models should see less model-list startup work without any change to returned rows or live Ollama discovery.

Evidence

  • Exact head: 037287be2110005f62a7c47a59bf2f3bef3feee2.
  • 98 focused tests passed across extensions/ollama/provider-policy-api.test.ts and extensions/ollama/index.test.ts.
  • Parity coverage proves both registered Ollama providers still expose no runtime normalizeResolvedModel hook.
  • Targeted oxfmt, direct touched-file oxlint, and git diff --check passed.
  • Import tracing measured approximately 31.8 ms for full Ollama plugin activation.
  • Clean merge tree against current main 4cbbccd0a0d20c11e123c2356db682dc51c4dde8: e532fab95c303fcc0df0297a40bcc30b8c98cdeb.
  • Exact-head CI run passed on attempt 2.
    • 28 jobs passed.
    • openclaw/ci-gate passed.
    • The first SQLite flip-proof attempt hit an unrelated harness failure; the immediately preceding mainline run passed that job, and its isolated rerun passed without a code change.
  • The standard Kova provider-pressure fixture is OpenAI/Anthropic-focused and does not isolate this Ollama-only import; exact CI plus focused import/runtime parity proof are the relevant gates.

Merge Gate

Merge only after the latest exact-head ClawSweeper review has no unresolved Before merge, finding, security, owner-decision, merge-risk, or blocking rank-up item.

@vincentkoc vincentkoc self-assigned this Aug 1, 2026
@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. labels Aug 1, 2026
@clawsweeper

clawsweeper Bot commented Aug 1, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 1, 2026, 12:26 PM ET / 16:26 UTC.

ClawSweeper review

What this changes

This PR lets configured local and cloud Ollama model rows return unchanged from the lightweight provider-policy artifact, avoiding full Ollama plugin activation during model listing.

Merge readiness

⚠️ Ready for maintainer review - 1 item remains

The patch has no actionable correctness or security finding: it uses the existing bundled provider-policy seam to avoid loading an Ollama runtime hook that both registered Ollama providers currently do not implement. This PR should remain open for ordinary maintainer landing review because it is member-authored and carries the protected maintainer label.

Priority: P3
Reviewed head: 037287be2110005f62a7c47a59bf2f3bef3feee2

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, policy-bound optimization with matching runtime-parity coverage and no identified functional or security defect.
Proof confidence 🌊 off-meta tidepool Not applicable: Not applicable: the author is a repository MEMBER, so the external-contributor real-behavior-proof gate does not apply; the supplied exact-head CI and focused policy/runtime-parity tests remain useful supplemental validation.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: Not applicable: the author is a repository MEMBER, so the external-contributor real-behavior-proof gate does not apply; the supplied exact-head CI and focused policy/runtime-parity tests remain useful supplemental validation.
Evidence reviewed 7 items Existing bypass contract: Current main loads the bundled provider policy before the runtime; a null result returns the original configured row, while only undefined proceeds to load the provider runtime normalizer.
Ollama runtime parity: The local and cloud registrations share hooks that omit normalizeResolvedModel; the PR’s policy decision therefore matches the currently registered runtime behavior rather than creating a second normalization path.
Provider-owned implementation: The proposed change implements the already-supported lightweight policy hook in the Ollama plugin and returns null only for ollama and ollama-cloud; other providers retain the runtime path.
Findings None None.
Security None None.

How this fits together

The models-list command converts configured model definitions into rows. It asks a bundled provider’s lightweight policy artifact whether a row is already canonical before loading the provider runtime normalizer, which keeps no-op provider work off the listing hot path.

flowchart LR
  Configured[Configured Ollama model] --> Projection[Model-list row projection]
  Projection --> Policy[Lightweight provider policy]
  Policy -->|Row already canonical| Unchanged[Return configured row]
  Policy -->|No policy decision| Runtime[Load provider runtime]
  Runtime --> Normalizer[Apply runtime normalization]
Loading

Before merge

  • Complete next step (P2) - No repair lane is warranted: there is no concrete patch defect, and the remaining action is ordinary maintainer landing review.
Agent review details

Security

None.

PR surface

Source +12, Tests +52. Total +64 across 3 files.

View PR surface stats
Area Files Added Removed Net
Source 1 14 2 +12
Tests 2 53 1 +52
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 67 3 +64

Review metrics

None.

Technical review

Best possible solution:

Keep the no-op determination in the Ollama-owned policy artifact and merge it after the normal maintainer review, with the parity tests guarding any future addition of an Ollama runtime normalizer.

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

Yes, source-reproducible: configured Ollama rows currently fall through from the policy lookup to the lazy provider-runtime load even though both registered Ollama providers have no normalizeResolvedModel hook. The proposed policy returns the established no-op signal before that load.

Is this the best way to solve the issue?

Yes. A provider-owned lightweight policy is the narrowest maintainable fix: hard-coding Ollama IDs in core would violate the plugin boundary, while adding a runtime no-op hook would still activate the runtime the change is meant to avoid.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P3: This is a bounded startup-work optimization for configured model listing, with no intended change to returned rows or live discovery.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: Not applicable: the author is a repository MEMBER, so the external-contributor real-behavior-proof gate does not apply; the supplied exact-head CI and focused policy/runtime-parity tests remain useful supplemental validation.

Evidence

What I checked:

  • Existing bypass contract: Current main loads the bundled provider policy before the runtime; a null result returns the original configured row, while only undefined proceeds to load the provider runtime normalizer. (src/commands/models/list.model-projection.ts:51, a566ac23a055)
  • Ollama runtime parity: The local and cloud registrations share hooks that omit normalizeResolvedModel; the PR’s policy decision therefore matches the currently registered runtime behavior rather than creating a second normalization path. (extensions/ollama/index.ts:717, a566ac23a055)
  • Provider-owned implementation: The proposed change implements the already-supported lightweight policy hook in the Ollama plugin and returns null only for ollama and ollama-cloud; other providers retain the runtime path. (extensions/ollama/provider-policy-api.ts:59, 037287be2110)
  • Sibling policy precedent: The adjacent OpenAI policy uses the same null/undefined contract, but retains runtime loading for transport-sensitive or alias-sensitive rows; Ollama has no corresponding runtime normalizer today. (extensions/openai/provider-policy-api.ts:89, a566ac23a055)
  • Feature provenance: git blame attributes the model-list policy-first projection to the merged scoped-catalog work, establishing that this PR is a narrow provider follow-up to that established boundary. (src/commands/models/list.model-projection.ts:51, 5ae401d9084f)
  • Current-main overlap check: No changes occurred on current main in the three touched Ollama files after this PR’s base, so the reported behind-main state does not indicate a touched-path conflict or a newer competing implementation. (a566ac23a055)

Likely related people:

  • vincentkoc: Authored the merged scoped model-list projection that introduced this lightweight policy boundary, as well as this narrow Ollama follow-up. (role: feature owner and recent area contributor; confidence: high; commits: 5ae401d9084f, 037287be2110; files: src/commands/models/list.model-projection.ts, extensions/ollama/provider-policy-api.ts)
  • Peter Steinberger: Current history attributes the existing Ollama provider-policy artifact and its lightweight thinking-policy behavior to this area’s recent work. (role: recent Ollama policy contributor; confidence: medium; commits: b5a59e0a7d94, 76d72d48f367; files: extensions/ollama/provider-policy-api.ts, extensions/ollama/index.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.

History

Review history (3 earlier review cycles)
  • reviewed 2026-08-01T15:27:16.983Z sha f49fa3467aeb2c3fca967e967e91667026daaed9 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-01T16:09:48.738Z sha 037287b :: needs maintainer review before merge. :: none
  • reviewed 2026-08-01T16:21:14.310Z sha 037287b :: needs maintainer review before merge. :: none

@vincentkoc
vincentkoc force-pushed the perf/models-list-scoped-catalog branch 3 times, most recently from 2a20b4f to 31d5521 Compare August 1, 2026 15:44
Base automatically changed from perf/models-list-scoped-catalog to main August 1, 2026 16:01
@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime cli CLI command changes commands Command implementations agents Agent runtime and tooling extensions: openai size: XL and removed size: S labels Aug 1, 2026
@vincentkoc
vincentkoc force-pushed the perf/models-list-ollama-policy branch from f49fa34 to 037287b Compare August 1, 2026 16:04
@openclaw-barnacle openclaw-barnacle Bot added size: S and removed gateway Gateway runtime cli CLI command changes commands Command implementations agents Agent runtime and tooling extensions: openai size: XL labels Aug 1, 2026
@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Aug 1, 2026
@vincentkoc
vincentkoc marked this pull request as ready for review August 1, 2026 16:13
@vincentkoc

Copy link
Copy Markdown
Member Author

ClawSweeper before-merge resolution:

  • P1 merge risk resolved: reviewed head remains 037287be2110005f62a7c47a59bf2f3bef3feee2. Against current origin/main a566ac23a0555a15d36b47c4165f4c3139e1211a, git merge-tree --write-tree succeeds with tree 2f97244b2d2d9baf228a81e98ada94c4c61b0943. Exact-head CI run https://github.com/openclaw/openclaw/actions/runs/30707674687 completed successfully with openclaw/ci-gate green. scripts/pr prepare-run 117465 completed successfully and retained the exact PR head.
  • P2 maintainer confirmation resolved: I reviewed the refreshed current-main merge result, provider-policy owner boundary, focused runtime-parity coverage, and exact-head gates. No findings, security concerns, or unresolved owner decisions remain.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 1, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@vincentkoc

Copy link
Copy Markdown
Member Author

Latest ClawSweeper review resolution:

  • The refreshed review at head 037287be2110005f62a7c47a59bf2f3bef3feee2 reports no findings, no security concerns, and no remaining merge-risk item.
  • Its sole remaining P2 is ordinary maintainer landing review for the protected maintainer label. I completed that review against current main, the clean merge tree, exact-head CI, the provider-policy owner boundary, and runtime-parity tests, and approve the PR for landing.

All ClawSweeper before-merge work is resolved.

@vincentkoc
vincentkoc merged commit e07d75d into main Aug 1, 2026
199 of 207 checks passed
@vincentkoc
vincentkoc deleted the perf/models-list-ollama-policy branch August 1, 2026 16:30
@vincentkoc

Copy link
Copy Markdown
Member Author

Merged via squash.

pull Bot pushed a commit to mcx/moltbot that referenced this pull request Aug 1, 2026
* origin/main: (44 commits)
  fix(plugins): compare authoring metadata by canonical JSON semantics (openclaw#117486)
  fix(doctor): reject contradictory lint check selectors (openclaw#117495)
  fix(anthropic): honor configured model pricing (openclaw#117275)
  refactor(plugins): reuse scoped loader for capability discovery (openclaw#117373)
  refactor(test): derive changed tooling routes (openclaw#117407)
  fix(kova): clarify extension memory attribution (openclaw#117500)
  fix(imessage): sanitize private context on every outbound path (openclaw#117501)
  fix(ci): align release validation fixtures (openclaw#117494)
  fix(talk): preserve owner authorization in realtime consults (openclaw#114163)
  fix(ui): surface aborted-run diagnostics (openclaw#117497)
  perf(models): skip Ollama row runtime loading (openclaw#117465)
  fix(cli): report user profile command outcomes (openclaw#117466)
  fix(active-memory): detect Chinese recall intent in escalate mode (openclaw#117338) (openclaw#117419)
  fix(workboard): ignore caller-supplied archivedAt when creating a card (openclaw#116412)
  fix(models): avoid waiting on promotions before listing models (openclaw#117322)
  refactor(plugins): inherit shared package boundary settings (openclaw#117474)
  fix(systemd): parse all inline environment assignments (openclaw#117484)
  feat(web-fetch): add tools.web.fetch.headers for operator request headers (openclaw#115545)
  fix(qa): Slack progress lane misses successful delivery (openclaw#117391)
  refactor: deduplicate Codex prompt snapshot fixtures (openclaw#117476)
  ...
abdulrahman305 pushed a commit to qenex-ai/openclaw that referenced this pull request Aug 1, 2026
* origin/main: (41 commits)
  fix(plugins): compare authoring metadata by canonical JSON semantics (openclaw#117486)
  fix(doctor): reject contradictory lint check selectors (openclaw#117495)
  fix(anthropic): honor configured model pricing (openclaw#117275)
  refactor(plugins): reuse scoped loader for capability discovery (openclaw#117373)
  refactor(test): derive changed tooling routes (openclaw#117407)
  fix(kova): clarify extension memory attribution (openclaw#117500)
  fix(imessage): sanitize private context on every outbound path (openclaw#117501)
  fix(ci): align release validation fixtures (openclaw#117494)
  fix(talk): preserve owner authorization in realtime consults (openclaw#114163)
  fix(ui): surface aborted-run diagnostics (openclaw#117497)
  perf(models): skip Ollama row runtime loading (openclaw#117465)
  fix(cli): report user profile command outcomes (openclaw#117466)
  fix(active-memory): detect Chinese recall intent in escalate mode (openclaw#117338) (openclaw#117419)
  fix(workboard): ignore caller-supplied archivedAt when creating a card (openclaw#116412)
  fix(models): avoid waiting on promotions before listing models (openclaw#117322)
  refactor(plugins): inherit shared package boundary settings (openclaw#117474)
  fix(systemd): parse all inline environment assignments (openclaw#117484)
  feat(web-fetch): add tools.web.fetch.headers for operator request headers (openclaw#115545)
  fix(qa): Slack progress lane misses successful delivery (openclaw#117391)
  refactor: deduplicate Codex prompt snapshot fixtures (openclaw#117476)
  ...
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 2, 2026
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 2, 2026
* origin/main: (44 commits)
  fix(plugins): compare authoring metadata by canonical JSON semantics (openclaw#117486)
  fix(doctor): reject contradictory lint check selectors (openclaw#117495)
  fix(anthropic): honor configured model pricing (openclaw#117275)
  refactor(plugins): reuse scoped loader for capability discovery (openclaw#117373)
  refactor(test): derive changed tooling routes (openclaw#117407)
  fix(kova): clarify extension memory attribution (openclaw#117500)
  fix(imessage): sanitize private context on every outbound path (openclaw#117501)
  fix(ci): align release validation fixtures (openclaw#117494)
  fix(talk): preserve owner authorization in realtime consults (openclaw#114163)
  fix(ui): surface aborted-run diagnostics (openclaw#117497)
  perf(models): skip Ollama row runtime loading (openclaw#117465)
  fix(cli): report user profile command outcomes (openclaw#117466)
  fix(active-memory): detect Chinese recall intent in escalate mode (openclaw#117338) (openclaw#117419)
  fix(workboard): ignore caller-supplied archivedAt when creating a card (openclaw#116412)
  fix(models): avoid waiting on promotions before listing models (openclaw#117322)
  refactor(plugins): inherit shared package boundary settings (openclaw#117474)
  fix(systemd): parse all inline environment assignments (openclaw#117484)
  feat(web-fetch): add tools.web.fetch.headers for operator request headers (openclaw#115545)
  fix(qa): Slack progress lane misses successful delivery (openclaw#117391)
  refactor: deduplicate Codex prompt snapshot fixtures (openclaw#117476)
  ...
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 2, 2026
* origin/main: (27 commits)
  fix(plugins): compare authoring metadata by canonical JSON semantics (openclaw#117486)
  fix(doctor): reject contradictory lint check selectors (openclaw#117495)
  fix(anthropic): honor configured model pricing (openclaw#117275)
  refactor(plugins): reuse scoped loader for capability discovery (openclaw#117373)
  refactor(test): derive changed tooling routes (openclaw#117407)
  fix(kova): clarify extension memory attribution (openclaw#117500)
  fix(imessage): sanitize private context on every outbound path (openclaw#117501)
  fix(ci): align release validation fixtures (openclaw#117494)
  fix(talk): preserve owner authorization in realtime consults (openclaw#114163)
  fix(ui): surface aborted-run diagnostics (openclaw#117497)
  perf(models): skip Ollama row runtime loading (openclaw#117465)
  fix(cli): report user profile command outcomes (openclaw#117466)
  fix(active-memory): detect Chinese recall intent in escalate mode (openclaw#117338) (openclaw#117419)
  fix(workboard): ignore caller-supplied archivedAt when creating a card (openclaw#116412)
  fix(models): avoid waiting on promotions before listing models (openclaw#117322)
  refactor(plugins): inherit shared package boundary settings (openclaw#117474)
  fix(systemd): parse all inline environment assignments (openclaw#117484)
  feat(web-fetch): add tools.web.fetch.headers for operator request headers (openclaw#115545)
  fix(qa): Slack progress lane misses successful delivery (openclaw#117391)
  refactor: deduplicate Codex prompt snapshot fixtures (openclaw#117476)
  ...
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 2, 2026
* origin/main: (41 commits)
  fix(plugins): compare authoring metadata by canonical JSON semantics (openclaw#117486)
  fix(doctor): reject contradictory lint check selectors (openclaw#117495)
  fix(anthropic): honor configured model pricing (openclaw#117275)
  refactor(plugins): reuse scoped loader for capability discovery (openclaw#117373)
  refactor(test): derive changed tooling routes (openclaw#117407)
  fix(kova): clarify extension memory attribution (openclaw#117500)
  fix(imessage): sanitize private context on every outbound path (openclaw#117501)
  fix(ci): align release validation fixtures (openclaw#117494)
  fix(talk): preserve owner authorization in realtime consults (openclaw#114163)
  fix(ui): surface aborted-run diagnostics (openclaw#117497)
  perf(models): skip Ollama row runtime loading (openclaw#117465)
  fix(cli): report user profile command outcomes (openclaw#117466)
  fix(active-memory): detect Chinese recall intent in escalate mode (openclaw#117338) (openclaw#117419)
  fix(workboard): ignore caller-supplied archivedAt when creating a card (openclaw#116412)
  fix(models): avoid waiting on promotions before listing models (openclaw#117322)
  refactor(plugins): inherit shared package boundary settings (openclaw#117474)
  fix(systemd): parse all inline environment assignments (openclaw#117484)
  feat(web-fetch): add tools.web.fetch.headers for operator request headers (openclaw#115545)
  fix(qa): Slack progress lane misses successful delivery (openclaw#117391)
  refactor: deduplicate Codex prompt snapshot fixtures (openclaw#117476)
  ...
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 P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S 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