Skip to content

fix(memory): empty memory case - #6322

Merged
icecrasher321 merged 1 commit into
stagingfrom
fix/memory-prov
Aug 6, 2026
Merged

fix(memory): empty memory case#6322
icecrasher321 merged 1 commit into
stagingfrom
fix/memory-prov

Conversation

@icecrasher321

Copy link
Copy Markdown
Collaborator

Summary

Fixes Memory blocks failing with: Internal tool response metadata could not be verified when Get Memory looks up a conversation that does not yet exist.

Type of Change

  • Bug fix

Testing

Tested manually

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel

vercel Bot commented Aug 6, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Skipped Skipped Aug 6, 2026 9:04am

Request Review

@cursor

cursor Bot commented Aug 6, 2026

Copy link
Copy Markdown

PR Summary

Low Risk
Scoped bug fix on an existing empty-read code path with contract alignment and tests; no change to auth or write paths beyond response shaping for misses.

Overview
Fixes Memory Get lookups when no conversation exists yet: internal tool execution was failing because the empty-result path returned a plain JSON body without the verified private-tool metadata that successful reads already attach via createMemoryResponse.

The no-match branch now routes through createMemoryResponse with memories: [], so callers that send the provenance request header get a complete, empty provenance bundle and the matching response header; ordinary callers still receive { success: true, data: null } with no extra fields or headers.

The get-by-id API contract now types data as nullable to match real responses. Vitest coverage asserts both the tool-metadata and headerless empty behaviors.

Reviewed by Cursor Bugbot for commit 47e9298. Configure here.

@greptile-apps

greptile-apps Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR fixes empty Memory lookups by routing them through the existing provenance-aware response helper and updates the API contract to permit the established null result.

  • Emits verified exact-empty provenance metadata for internal tool requests when no matching memory exists.
  • Preserves the existing headerless response for ordinary API callers.
  • Adds route tests for both provenance-aware and ordinary empty responses.

Confidence Score: 5/5

The PR appears safe to merge with no actionable correctness or security issues identified.

The empty-result path now produces the metadata envelope required by internal tools, ordinary callers retain their prior response, and the contract accurately accepts the route’s null result.

Important Files Changed

Filename Overview
apps/sim/app/api/memory/[id]/route.ts Routes empty lookup results through the provenance response helper while retaining the existing null payload for requests that do not negotiate metadata.
apps/sim/lib/api/contracts/memory.ts Makes the successful GET response schema nullable so contract validation matches the route’s established not-found response.
apps/sim/app/api/memory/[id]/route.test.ts Covers exact-empty provenance metadata and confirms that ordinary callers retain the headerless null response.

Reviews (1): Last reviewed commit: "fix(memory): provenance checks" | Re-trigger Greptile

@icecrasher321 icecrasher321 changed the title fix(memory): provenance checks fix(memory): empty memory case Aug 6, 2026
@icecrasher321
icecrasher321 merged commit 5157a59 into staging Aug 6, 2026
31 checks passed
@icecrasher321
icecrasher321 deleted the fix/memory-prov branch August 6, 2026 09:09
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.

1 participant