You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
get_default_cube_config crashes with UnboundLocalError on invalid text_mem_type #2441
get_default_cube_config in src/memos/mem_os/utils/default_config.py only assigns text_mem_config inside the tree_text and general_text branches, but there is no else. Any other value (e.g. a typo like "tree-text" passed through MOS_NEO4J_*/env config plumbing or the MCP create_cube path) crashes with a bare UnboundLocalError:
Summary: Fixes issue #2441: get_default_cube_config (and its sibling get_default_config) in src/memos/mem_os/utils/default_config.py no longer crashes with a bare UnboundLocalError when a caller passes an unsupported text_mem_type such as the reported "tree-text" typo. Both helpers now call a new _validate_text_mem_type guard at entry and raise a clear ValueError naming the offending value and the accepted set ("tree_text", "general_text"), so misconfigurations coming through the MOS_TEXT_MEM_TYPE env var or the MCP create_cube path fail loudly with an actionable message. As a defence-in-depth, get_default_cube_config's if/elif chain gained an explicit else branch that re-raises the same ValueError, so a future refactor cannot silently reintroduce the fall-through.
Added tests/mem_os/utils/test_default_config.py with five cases covering the reported reproducer ("tree-text"), other unknown backends, empty strings, symmetric behavior on get_default_config, and a happy-path smoke test for "general_text". All new tests pass; the full tests/mem_os/ suite (41 tests) continues to pass; ruff check and ruff format are clean on the touched files. No public API, schema, or OpenAPI contract changes; no new dependencies.
Base branch:main Branch:bugfix/autodev-2441-20260930135356599 Commit:dfdca2b PR:#2445 Assigned to:@syzsunshine219 Reviewers:@WeiminLee
Activity
Memtensor-AI commentedon Sep 30, 2026
🤖 AutoDev has picked up this issue and started working on it.
Task ID:
eb1debf3e224d267Working branch:
bugfix/autodev-2441-20260930135356599Target branch:
latest dev* branchWorkflow: opsp (analysis → coding → testing → PR)
I will post the PR link here once done. If I need more information, I will ask in the comments.
fix(mem_os): raise ValueError for unknown text_mem_type
Memtensor-AI commentedon Sep 30, 2026
✅ AutoDev task
eb1debf3e224d267completed.Summary: Fixes issue #2441:
get_default_cube_config(and its siblingget_default_config) insrc/memos/mem_os/utils/default_config.pyno longer crashes with a bareUnboundLocalErrorwhen a caller passes an unsupportedtext_mem_typesuch as the reported"tree-text"typo. Both helpers now call a new_validate_text_mem_typeguard at entry and raise a clearValueErrornaming the offending value and the accepted set ("tree_text","general_text"), so misconfigurations coming through theMOS_TEXT_MEM_TYPEenv var or the MCPcreate_cubepath fail loudly with an actionable message. As a defence-in-depth,get_default_cube_config'sif/elifchain gained an explicitelsebranch that re-raises the sameValueError, so a future refactor cannot silently reintroduce the fall-through.Added
tests/mem_os/utils/test_default_config.pywith five cases covering the reported reproducer ("tree-text"), other unknown backends, empty strings, symmetric behavior onget_default_config, and a happy-path smoke test for"general_text". All new tests pass; the fulltests/mem_os/suite (41 tests) continues to pass;ruff checkandruff formatare clean on the touched files. No public API, schema, or OpenAPI contract changes; no new dependencies.Base branch:
mainBranch:
bugfix/autodev-2441-20260930135356599Commit:
dfdca2bPR: #2445
Assigned to: @syzsunshine219
Reviewers: @WeiminLee
test(mem_os): mirror invalid text_mem_type cases in get_default_config
github-actions commentedon Nov 5, 2026
This issue has been automatically marked as stale due to inactivity.
github-actions commentedon Nov 14, 2026
This issue has been automatically closed due to inactivity.