Skip to content

fix: propagate document_tags in async retain path#374

Merged
nicoloboschi merged 1 commit intovectorize-io:mainfrom
abix5:fix/async-retain-document-tags
Feb 16, 2026
Merged

fix: propagate document_tags in async retain path#374
nicoloboschi merged 1 commit intovectorize-io:mainfrom
abix5:fix/async-retain-document-tags

Conversation

@abix5
Copy link
Contributor

@abix5 abix5 commented Feb 15, 2026

Summary

  • fix async retain tag propagation by forwarding document_tags from the queued task payload in _handle_batch_retain to retain_batch_async(...)
  • update MemoryEngineInterface signatures so async/sync batch retain methods explicitly accept optional document_tags
  • add focused unit tests for async tag flow:
    • submit_async_retain includes document_tags in queued payload
    • worker handler forwards document_tags into retain execution

Why

When /memories was called with async=true and document_tags, tags were dropped in the worker path. As a result, tags did not reliably appear in /tags, and tag-scoped workflows (including scoped mental models) behaved incorrectly.

Testing

  • /Users/dmitriynenashev/Projects/hindsight/.venv-hs/bin/python -m pytest tests/test_async_retain_tags.py -o addopts='' -q
  • manual local API verification:
    • async retain with document_tags
    • verify /v1/default/banks/{bank_id}/tags contains the tag
    • verify tag-filtered recall returns expected results

Follow-up

There is a separate inconsistency in tags_match semantics across endpoints (recall/reflect vs mental-models/directives). This PR does not change that behavior; a dedicated follow-up PR will unify those semantics.

Copy link
Collaborator

@nicoloboschi nicoloboschi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Nice catch!

@nicoloboschi nicoloboschi merged commit b4b5c44 into vectorize-io:main Feb 16, 2026
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