Skip to content

fix(ollama): cloud-model guard, safe update, safe cache clean (issue #156 M1-M3)#160

Merged
himanshu231204 merged 1 commit into
mainfrom
fix/156-m1-m3
Jul 19, 2026
Merged

fix(ollama): cloud-model guard, safe update, safe cache clean (issue #156 M1-M3)#160
himanshu231204 merged 1 commit into
mainfrom
fix/156-m1-m3

Conversation

@himanshu231204

Copy link
Copy Markdown
Member

Summary

Fixes issue #156 items M1, M2, and M3 for the 0.1.1 release.

M1 — remove() on a cloud model hangs

Cloud/subscription models (tag contains cloud, e.g. glm-5.2:cloud) caused remove() to block on a daemon delete() call that never resolved. Now OllamaRuntime.remove() short-circuits cloud refs with a clear DownloadError and never touches the daemon. Added ModelRef.is_cloud.

M2 — update() is destructive with no confirmation

update() did remove() then pull(), re-downloading gigabytes with no guard. Now ModelManager.update() requires confirm=True to proceed and rejects cloud models with a clear error. The SDK update() passes confirm through.

M3 — cache.clean() wipes all entries

FilesystemCache.clean() looked for {name}.bin artifacts that are never written (Ollama manages its own storage), so every manifest entry was treated as orphaned and deleted. Now clean() is safe by default (only corrupt/partial entries removed) and accepts force=True to wipe everything. Updated CachePort, FilesystemCache, and CacheService signatures accordingly.

Tests

  • tests/unit/test_ollama_runtime.py: cloud-model remove fails fast without a daemon call.
  • tests/unit/test_core.py: update requires confirm; unknown/cloud models raise.
  • tests/unit/test_cache.py + tests/unit/test_port_contract.py: safe default keeps valid entries; force=True wipes.
  • tests/conftest.py: FakeCache.clean() accepts force.

Verification

Unit 120 passed, integration (excl. slow pull) 3 passed, e2e 16 passed. ruff, ruff format, mypy --strict clean. Verified live against Ollama: remove('glm-5.2:cloud') fails fast; update('mistral:latest') without confirm raises; cache.clean() keeps entries.

…156 M1-M3)

M1: OllamaRuntime.remove() now short-circuits cloud/subscription models (tag contains 'cloud') with a clear DownloadError instead of blocking on a daemon delete. Added ModelRef.is_cloud.

M2: ModelManager.update() now requires confirm=True (destructive remove+re-pull) and rejects cloud models. SDK update() passes confirm through.

M3: CachePort.clean()/FilesystemCache.clean()/CacheService.clean() are safe by default (only corrupt/partial entries removed) and accept force=True to wipe all. No longer deletes every valid entry.

Co-Authored-By: Claude <noreply@anthropic.com>
@himanshu231204
himanshu231204 merged commit 8a435da into main Jul 19, 2026
29 checks passed
@github-actions

Copy link
Copy Markdown

🎉 Congratulations @himanshu231204!

Your pull request has been successfully merged into main. 🚀

Thank you for contributing to OpenAgentHQ and helping improve the project.

We truly appreciate your contribution and hope to see you back with more amazing PRs!

Happy Open Sourcing! ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant