Skip to content

fix(chat): serve legacy memories when a legacy-cohort account has no rollout state (#10736) - #10752

Merged
kodjima33 merged 1 commit into
mainfrom
watchdog/issue-10736-chat-memory-legacy-fallback
Jul 28, 2026
Merged

kodjima33 merged 1 commit into
mainfrom
watchdog/issue-10736-chat-memory-legacy-fallback

Conversation

@kodjima33

@kodjima33 kodjima33 commented Jul 28, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Omi chat's memory tools (get_memories_tool, search_memories_tool, and the REST tool services behind /v1/tools/*) no longer return "No memories available for this request." for accounts that were never enrolled in the canonical-memory rollout: they now serve the authoritative legacy memories surface.

All four sites route the decision through one shared helper, chat_legacy_read_authorized, instead of four copies of the != USE_LEGACY_SAFE comparison. Every other deny reason (malformed state, read failure, missing grant, shadow-only) stays fail-closed. The mode change is recorded through the shared record_fallback helper — no new one-off counter.

Chat-surface counterpart of #10094 / #10485 (Developer API) and #10095 (MCP), same root cause. This is the cross-surface unification #10485 explicitly deferred. Fixes #10736.

Root cause

pin_memory_system resolves every account outside the canonical whitelist to MemorySystem.LEGACY, where users/{uid}/memory_control/state is expected to be absent — but read_default_read_rollout reports the absent doc as DENY_MEMORY / missing_rollout_state. The chat sites reach that branch only after the cohort pin already said LEGACY, then refused to read the collection the selector had just declared authoritative. It is silent from the user's side: chat answers as though the user has no memories, so it reads as the assistant forgetting rather than as an error. Prod logs show 23 of these denials on 2026-07-27 alone.

Failure class

Failure-Class: none

Same call as #10094 / #10095: no registered class covers a reader failing closed on state whose absence the authoritative cohort selector defines as normal.

Durable guard

  • One shared decision owner: the four chat call sites can no longer drift apart — the narrow un-enrolled exception and its telemetry live in chat_legacy_read_authorized, whose docstring names the contract.
  • The fallback is narrow: only missing_rollout_state (doc absent = never enrolled) qualifies; malformed_rollout_state, uid_mismatch, and rollout_read_failed stay fail-closed because there the doc exists or its state is unknown.
  • The behavioral regression test drives the real tools through the adapter seam (not source text) and covers both directions of the decision table.

Validation

  • New tests/unit/test_chat_memory_missing_rollout_fallback.py — 12 passed. It invokes get_memories_tool, search_memories_tool, and get_memories_text with the adapter denying on missing_rollout_state and asserts the legacy memory reaches the result, plus the mirror cases asserting a missing_chat_default_memory_grant denial still returns the safe string and never calls the legacy read. These cannot pass on pre-fix code.
  • 81 memory/retrieval-related test files via the repo runner (BACKEND_UNIT_TEST_FILE_LIST=... bash test.sh) → exit 0, including test_chat_memory_adapter.py, test_tools_router.py, test_mcp_memory_adapter.py, test_lock_bypass_fixes.py.
  • black --line-length 120 --skip-string-normalization clean on all changed files.
  • Not exercised live: a production chat turn for a real un-enrolled account (no such credentials here). The fix point is the shared server-side decision helper the tests drive directly.

Product invariants affected

  • INV-MEM-1 (path-matched via backend/utils/memory/chat_memory_adapter.py): no tier vocabulary change — the helper only decides legacy-vs-deny routing for chat reads; tier semantics and the guard test are untouched.
  • INV-MEM-3 note: the new fallback runs only on the non-canonical branch (the cohort pin already resolved LEGACY); canonical selection still never falls back to legacy.

Out of scope, named

🤖 automated by hourly watchdog — tested and merged

Review in cubic

…rollout state (#10736)

Omi chat's memory tools returned "No memories available for this request."
for accounts that were never enrolled in the canonical-memory rollout, so
chat answered as though the user had no memories while the memories screen
showed them normally. Prod logs show 23 such denials on 2026-07-27 alone.

Root cause is the divergence already fixed for the Developer API (#10094,
#10485) and MCP (#10095): pin_memory_system resolves every account outside
the canonical whitelist to MemorySystem.LEGACY, where
users/{uid}/memory_control/state is *expected* to be absent — but
read_default_read_rollout reports that absent doc as DENY_MEMORY /
missing_rollout_state. The chat sites reach that branch only after the
cohort pin already said LEGACY, then refused to read the collection the
selector had just declared authoritative.

Fix: route all four chat sites through one shared decision owner,
chat_legacy_read_authorized, mirroring mcp_legacy_read_authorized. It
allows an explicit USE_LEGACY_SAFE decision and the never-enrolled
missing_rollout_state case, records the mode change through the shared
record_fallback helper, and keeps every other deny reason (malformed
state, read failure, missing grant, shadow-only) fail-closed.

Verify (backend/.venv, python3.11, repo runner):
- new tests/unit/test_chat_memory_missing_rollout_fallback.py: 12 passed —
  invokes get_memories_tool / search_memories_tool / get_memories_text with
  the adapter denying on missing_rollout_state and asserts the legacy
  memory is served, plus the mirror cases asserting a missing-grant denial
  still returns the safe string and never touches the legacy read.
- 81 memory/retrieval test files via test.sh: exit 0.
- black clean on all changed files.

Not exercised live: a production chat turn for a real un-enrolled account
(no such credentials here). The fix point is the shared server-side
decision helper the tests drive directly.

Failure-Class: none

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@kodjima33
kodjima33 merged commit e089328 into main Jul 28, 2026
41 checks passed
@kodjima33
kodjima33 deleted the watchdog/issue-10736-chat-memory-legacy-fallback branch July 28, 2026 02:47
undivisible pushed a commit to Archit-lal/omi that referenced this pull request Jul 29, 2026
…rollout state (BasedHardware#10736) (BasedHardware#10752)

Omi chat's memory tools returned "No memories available for this request."
for accounts that were never enrolled in the canonical-memory rollout, so
chat answered as though the user had no memories while the memories screen
showed them normally. Prod logs show 23 such denials on 2026-07-27 alone.

Root cause is the divergence already fixed for the Developer API (BasedHardware#10094,
BasedHardware#10485) and MCP (BasedHardware#10095): pin_memory_system resolves every account outside
the canonical whitelist to MemorySystem.LEGACY, where
users/{uid}/memory_control/state is *expected* to be absent — but
read_default_read_rollout reports that absent doc as DENY_MEMORY /
missing_rollout_state. The chat sites reach that branch only after the
cohort pin already said LEGACY, then refused to read the collection the
selector had just declared authoritative.

Fix: route all four chat sites through one shared decision owner,
chat_legacy_read_authorized, mirroring mcp_legacy_read_authorized. It
allows an explicit USE_LEGACY_SAFE decision and the never-enrolled
missing_rollout_state case, records the mode change through the shared
record_fallback helper, and keeps every other deny reason (malformed
state, read failure, missing grant, shadow-only) fail-closed.

Verify (backend/.venv, python3.11, repo runner):
- new tests/unit/test_chat_memory_missing_rollout_fallback.py: 12 passed —
  invokes get_memories_tool / search_memories_tool / get_memories_text with
  the adapter denying on missing_rollout_state and asserts the legacy
  memory is served, plus the mirror cases asserting a missing-grant denial
  still returns the safe string and never touches the legacy read.
- 81 memory/retrieval test files via test.sh: exit 0.
- black clean on all changed files.

Not exercised live: a production chat turn for a real un-enrolled account
(no such credentials here). The fix point is the shared server-side
decision helper the tests drive directly.

Failure-Class: none

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
@undivisible undivisible added the AI label Aug 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

In-app chat memory tools still hard-deny on missing_rollout_state — #10094 fixed the Developer API path but not chat

2 participants