Skip to content

[ML-69651] [s] Fix AgentKit memory read-mask projections - #582

Open
anshul0713 wants to merge 4 commits into
mainfrom
mason-fix/read-mask-keyerror
Open

anshul0713 wants to merge 4 commits into
mainfrom
mason-fix/read-mask-keyerror

Conversation

@anshul0713

@anshul0713 anshul0713 commented Sep 13, 2026 •

Copy link
Copy Markdown
Contributor

MemoryStore.get, list, and search crash with KeyError when a read_mask omits actor_id or path. Parse projected fields as optional and return None when the service omits them.

Keep name required as the resource identity, document including it in read masks, and preserve name-based id, update, and delete. OpenAI and LangGraph memory tools use the resource name when a returned entry has no path. Regression coverage includes get, paginated list, scored and legacy search, and projected-entry updates/deletes.

This updates the original fix to the current AgentKit implementation and incorporates #747, which is closed as a duplicate. Tracks ML-69651.

Validation at c2fd79f:

  • 160 mocked memory-store and framework memory-tool tests pass.
  • Ruff, formatting, focused type checks, and diff checks pass.
  • The resulting source tree exactly matches the previously validated [ML-69651] Fix AgentKit memory read-mask projections #747 head 301443d; the merge retains both PR histories and produces a six-file diff against current main.
  • Earlier [ML-69651] Fix AgentKit memory read-mask projections #747 verification reproduced the failure on the 0.5.1 release source and main, and passed 260 affected tests. No new live workspace calls were needed for this client-side parsing fix. Public CI on the new head is separate.

anshul0713 and others added 3 commits September 13, 2026 21:20
`MemoryStore.list/get/search` accept a `read_mask`, which lets the caller
project fields out of the response. `_memory_from_response` hard-indexed
`actor_id` and `path`, so a mask that omitted either (e.g.
`read_mask="name,content"`) raised `KeyError: 'actor_id'` instead of
returning the entry. Read those fields with `.get()` (matching the store
parser, which only hard-requires `name`) and mark them Optional on `Memory`,
since a read_mask can legitimately leave them absent.

Covers list, get, and search (all route through `_memory_from_response`).

Test: memory_store_test.py::test_read_mask_projecting_out_fields_does_not_crash.

Co-authored-by: Isaac <no-reply@databricks.com>
`ty check` (CI: typechecking for integrations/mason) flagged
errors.wrap_api_error: assigning the unwrapped `__cause__` (typed
BaseException) to the Exception-typed `exc` parameter is an invalid-assignment.
Use a separate BaseException-typed local instead — behavior-identical, and the
check now passes.

Co-authored-by: Isaac <no-reply@databricks.com>
@jamesbxwu jamesbxwu changed the title [mason] memory: don't crash parsing a read_mask-projected entry (ML-69651) [ML-69651] Fix AgentKit memory read-mask projections Oct 15, 2026
@jamesbxwu jamesbxwu changed the title [ML-69651] Fix AgentKit memory read-mask projections [ML-69651] [s] Fix AgentKit memory read-mask projections Oct 15, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants