fix(ollama): cloud-model guard, safe update, safe cache clean (issue #156 M1-M3)#160
Merged
Conversation
…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
force-pushed
the
fix/156-m1-m3
branch
from
July 19, 2026 12:42
0849038 to
7b752da
Compare
|
🎉 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! ❤️ |
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes issue #156 items M1, M2, and M3 for the 0.1.1 release.
M1 —
remove()on a cloud model hangsCloud/subscription models (tag contains
cloud, e.g.glm-5.2:cloud) causedremove()to block on a daemondelete()call that never resolved. NowOllamaRuntime.remove()short-circuits cloud refs with a clearDownloadErrorand never touches the daemon. AddedModelRef.is_cloud.M2 —
update()is destructive with no confirmationupdate()didremove()thenpull(), re-downloading gigabytes with no guard. NowModelManager.update()requiresconfirm=Trueto proceed and rejects cloud models with a clear error. The SDKupdate()passesconfirmthrough.M3 —
cache.clean()wipes all entriesFilesystemCache.clean()looked for{name}.binartifacts that are never written (Ollama manages its own storage), so every manifest entry was treated as orphaned and deleted. Nowclean()is safe by default (only corrupt/partial entries removed) and acceptsforce=Trueto wipe everything. UpdatedCachePort,FilesystemCache, andCacheServicesignatures 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=Truewipes.tests/conftest.py:FakeCache.clean()acceptsforce.Verification
Unit 120 passed, integration (excl. slow pull) 3 passed, e2e 16 passed.
ruff,ruff format,mypy --strictclean. Verified live against Ollama:remove('glm-5.2:cloud')fails fast;update('mistral:latest')without confirm raises;cache.clean()keeps entries.