fix: wire compact_semantic_duplicates setting to env var#182
fix: wire compact_semantic_duplicates setting to env var#182Piotr1215 wants to merge 3 commits intoredis:mainfrom
Conversation
the compact_semantic_duplicates parameter in compact_long_term_memories() was hardcoded to True with no corresponding Settings field. setting COMPACT_SEMANTIC_DUPLICATES=false as an env var had no effect because pydantic-settings never read it. add the field to Settings so the docket perpetual scheduler respects the env var.
There was a problem hiding this comment.
Pull request overview
Wires the long-term memory semantic deduplication toggle to a real Settings field so COMPACT_SEMANTIC_DUPLICATES=false can disable semantic compaction in scheduled/worker runs.
Changes:
- Add
compact_semantic_duplicates: bool = TruetoSettingsinconfig.py. - Update
compact_long_term_memories()to defaultcompact_semantic_duplicatesfromsettings.compact_semantic_duplicatesinstead of a hardcodedTrue.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
agent_memory_server/long_term_memory.py |
Reads the semantic-duplicate compaction default from settings so env-configured behavior can take effect. |
agent_memory_server/config.py |
Adds the missing Settings field so COMPACT_SEMANTIC_DUPLICATES is actually parsed by pydantic-settings. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
wires COMPACT_SEMANTIC_DUPLICATES env var to config so the worker actually respects it. upstream PR: redis/agent-memory-server#182
the default was evaluated at function definition time, meaning test-time patches and runtime config reloads had no effect. use None sentinel with runtime resolution instead. add regression test for COMPACT_SEMANTIC_DUPLICATES env var parsing.
vishal-bala
left a comment
There was a problem hiding this comment.
This LGTM! You need to run make format on your code for it to pass the linters.
make format uses a different ruff version than the pre-commit hook (v0.3.2). re-ran with pre-commit run --all-files to match CI.
94c5e78 to
94a5ede
Compare
|
hey @vishal-bala, ran |
Summary
compact_semantic_duplicatesfield toSettingsinconfig.py(defaultTrue)compact_long_term_memories()to read the default fromsettings.compact_semantic_duplicatesinstead of hardcodedTrueThe
compact_semantic_duplicatesparameter was hardcoded toTruewith no correspondingSettingsfield. SettingCOMPACT_SEMANTIC_DUPLICATES=falseas an env var had no effect because pydantic-settings never read it. The Docket perpetual scheduler always called the function with the hardcoded default.Test plan
COMPACT_SEMANTIC_DUPLICATES=falseproducessemantic_duplicates=Falsein worker logsNote
Low Risk
Low risk: small configuration plumbing change that only alters compaction behavior when
COMPACT_SEMANTIC_DUPLICATESis set, plus non-functional notebook formatting tweaks.Overview
Makes semantic compaction configurable via env var. Adds
compact_semantic_duplicatestoSettings(defaultTrue) and updatescompact_long_term_memories()to default tosettings.compact_semantic_duplicateswhen no explicit argument is passed.Adds a regression test to ensure
COMPACT_SEMANTIC_DUPLICATES=falseis read bySettings, and includes minor formatting/cleanup edits in the interactive guide notebook.Written by Cursor Bugbot for commit 94a5ede. This will update automatically on new commits. Configure here.