Skip to content

fix(tools): skip empty prompts and scope Mastra cache - #1489

Open
abhinav7x94 wants to merge 2 commits into
supermemoryai:mainfrom
abhinav7x94:fix/tools-empty-memory-output
Open

fix(tools): skip empty prompts and scope Mastra cache#1489
abhinav7x94 wants to merge 2 commits into
supermemoryai:mainfrom
abhinav7x94:fix/tools-empty-memory-output

Conversation

@abhinav7x94

@abhinav7x94 abhinav7x94 commented Aug 15, 2026

Copy link
Copy Markdown

What changed

  • return no memory prompt when retrieval has no mode-relevant data
  • treat empty retrievals as negative cache entries across Vercel, Mastra, and VoltAgent
  • skip empty placeholder injection in OpenAI Chat/Responses and VoltAgent advanced search
  • scope Mastra positive and negative caches to each request's processor state
  • use an invocation-local Mastra cache when older Mastra versions do not provide request state
  • add cross-integration and request-isolation regression coverage

Why

Empty profile/search responses currently become User Supermemories: or empty search headings and are injected and cached as real system context. Some wrappers also refetch empty results within the same turn.

Mastra processor instances are reused across requests. Keeping the cache on the processor would make both positive and empty results stale for the agent lifetime. Request-scoped state preserves same-request deduplication without leaking stale retrievals into later requests.

Validation

  • 69 focused Vitest tests passed
  • full package run: 108 passed, 30 skipped; only the two pre-existing suite-load failures remain (missing SUPERMEMORY_API_KEY and broken test/claude-memory import)
  • production package build passed
  • Biome passed on all touched files (one unrelated pre-existing warning)
  • git diff --check passed
  • package typecheck remains baseline-red in existing OpenAI, VoltAgent, and older test code; no changed production file has a new diagnostic

@abhinav7x94 abhinav7x94 changed the title fix(tools): skip empty memory prompt injection fix(tools): skip empty prompts and scope Mastra cache Aug 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