Fix/release polish#1
Conversation
Cloud model names now resolve to CloudConfig via environment API keys, with a clear error when credentials are missing. Co-authored-by: Cursor <cursoragent@cursor.com>
Pool L1.5/L2 hydrates during start(), and health_check now reports backend routing plus Ollama reachability or cloud credential status. Co-authored-by: Cursor <cursoragent@cursor.com>
Align __version__ with the pyproject.toml release version. Co-authored-by: Cursor <cursoragent@cursor.com>
Redis moves behind [redis], langchain-core gets a dedicated extra, and CI installs redis for adapter tests. Co-authored-by: Cursor <cursoragent@cursor.com>
Correct build_prompt and explain_prompt usage, document env-based cloud routing, optional install extras, and current Phase 3 status. Co-authored-by: Cursor <cursoragent@cursor.com>
Add shorthand configuration example to the official documentation. Co-authored-by: Cursor <cursoragent@cursor.com>
Remove manual entity injection and demonstrate the real prompt pipeline. Co-authored-by: Cursor <cursoragent@cursor.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 86bdaeaaa0
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
|
||
| # Cloud model name prefixes used by ``background_model`` auto-routing. | ||
| _CLOUD_MODEL_PREFIXES: dict[Provider, tuple[str, ...]] = { | ||
| Provider.OPENAI: ("gpt-", "o1", "o3", "chatgpt-"), |
There was a problem hiding this comment.
Route o4 models through the OpenAI backend
When a user sets background_model="o4-mini" (or another OpenAI o4-* model) with OPENAI_API_KEY, infer_cloud_provider() returns None because this table only includes o1 and o3. The validator then creates an OllamaConfig, so the context manager tries to call local Ollama instead of CloudCompressor, which makes auto-routing fail for supported OpenAI o-series models outside the hard-coded prefixes.
Useful? React with 👍 / 👎.
| if self._config.pool_id: | ||
| await self._sync_pool_state_from_storage() |
There was a problem hiding this comment.
Reattach the entity callback after startup pool sync
With pool_id and events enabled, this new startup sync replaces self._state.l1_5_entities with a freshly loaded EntityLedger; the event callback installed in __init__ stays on the old ledger. Any later compression upserts into the hydrated ledger will update memory, but will not emit l1_5.entity_anchored events or journal entries, so explainability timestamps/origins are lost for pooled agents. Reattach the callback after hydrating pool entities.
Useful? React with 👍 / 👎.
Summary
This PR prepares Sawtooth Memory for a 0.2.1 release by fixing several usability bugs, tightening runtime diagnostics, and aligning docs/examples with the current API.
background_model— Settingbackground_model="gpt-4o-mini"(or other cloud model names) now automatically configures the correctCloudConfigbackend and resolves API keys from environment variables. Local model names still route to Ollama. Includesinfer_cloud_provider()/resolve_cloud_api_key()helpers and a newtests/test_config.pysuite.start()—ContextManager.start()now calls_sync_pool_state_from_storage()whenpool_idis configured, so pooled agents load shared L1.5/L2 state immediately instead of only after the first compression cycle.health_check()— Adds compression backend reachability checks via newOllamaCompressor.ping()andCloudCompressor.ping()methods. Reportsdegradedwhen Ollama is unreachable or cloud credentials are missing.redisout of core dependencies intosawtooth-memory[redis]. Adds[langchain]and[all]extras.RedisStorageAdapterraises a clearImportErrorwith install guidance whenredisis not installed.__version__insawtooth_memory/__init__.pywithpyproject.toml.build_prompt(),explain_prompt()), adds explicitCloudConfigexample, updates roadmap, documents V2background_modelauto-routing inDOCUMENTATION.md, and rewritesexamples/basic_agent.pyto match the current API.Commits
6760397a1efc0ac081a350439baaf063bb0368100586bdaeaTest plan
pytest— all 195 tests pass locallytests/test_config.py— cloud provider inference andbackground_modelauto-routing (with/without API keys)tests/test_middleware.py—health_check()healthy and degraded pathstests/test_multi_agent_pooling.py— pool state synced onstart()tests/test_sync_wrapper.py— sync wrapper health check with mocked compressor pingpip install ".[dev,langgraph,redis]")background_model="gpt-4o-mini"withOPENAI_API_KEYset creates cloud backendbackground_model="phi4-mini:latest"routes to Ollamapip install sawtooth-memory(no redis) — core install works; redis adapter fails with clear message