[superlog] Fix supermemory container tag format in storeAnalyticsSummary#476
[superlog] Fix supermemory container tag format in storeAnalyticsSummary#476superlog-app[bot] wants to merge 1 commit into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
2 Skipped Deployments
|
|
The latest updates on your projects. Learn more about Unkey Deploy
|
Greptile SummaryThis PR fixes an active
Confidence Score: 3/5The write-side fix is correct and resolves the immediate 400 error, but the analytics summary feature remains end-to-end broken because stored summaries land in a container the AI never reads from. The two-line change correctly repairs the supermemory API call, but stored summaries go into a website_* container while every retrieval path exclusively queries user- and apikey-scoped containers. Additionally, the colon-format tags still used by primaryContainerTag on the live read path may be causing silent failures on all memory retrievals. packages/ai/src/lib/supermemory.ts — specifically the container tag used in storeAnalyticsSummary versus those queried by getMemoryContext and searchMemories, and the colon-format tags still produced by buildContainerTags and primaryContainerTag. Important Files Changed
Sequence DiagramsequenceDiagram
participant Insights as apps/insights generation.ts
participant Store as storeAnalyticsSummary
participant SM as Supermemory API
participant Agent as AI Agent
participant Read as getMemoryContext / searchMemories
Note over Insights,SM: Write path (after this fix)
Insights->>Store: summary, site.id
Store->>SM: client.add containerTag website_siteId
SM-->>Store: 200 OK
Note over Agent,SM: Read path (unchanged)
Agent->>Read: query, userId, apiKeyId
Read->>SM: containerTag user_userId or apikey_apiKeyId
SM-->>Read: results from user/apikey container
Read-->>Agent: memories — analytics summaries never returned
Note over Store,Read: Mismatch — writes go to website_* container, reads query user:* / apikey:* containers only
|
| content: summary, | ||
| containerTags: [`website:${websiteId}`], | ||
| content: sanitizeMemoryContent(summary), | ||
| containerTag: `website_${websiteId}`, |
There was a problem hiding this comment.
Analytics summaries stored in unreachable container
storeAnalyticsSummary now writes into container website_${websiteId}, but every read path — getMemoryContext (line 80) and searchMemories (line 223) — uses primaryContainerTag(userId, apiKeyId) which only ever returns user:${userId}, apikey:${apiKeyId}, or "anonymous". No call site ever queries a website_*-prefixed container, so the summaries generated by apps/insights/src/generation.ts are stored successfully but will never be surfaced in AI responses. The feature is still functionally inert, just silently so instead of erroring.
Summary
The
storeAnalyticsSummaryfunction inpackages/ai/src/lib/supermemory.tswas callingclient.add()with two invalid parameters, causing every weekly analytics summary write to fail with a400error from the supermemory API:Root cause: The function used
containerTags: ['website:${websiteId}']— the deprecated plural-array parameter (SDK v4 replaced this with singularcontainerTag: string) — and the value contained a colon (:) which violates the API's documented constraint of alphanumeric/hyphens/underscores/dots only. With an invalid/ignored container tag the server falls back to URL extraction on the plain-text content and fails.Fix: Migrate to
containerTag: \website_${websiteId}`(singular string, underscore separator) and applysanitizeMemoryContent()to stay within the 2 000-char content limit. The other memory helpers (storeConversation,saveCuratedMemory`) have the same colon-in-tag pattern but swallow errors silently — those can be migrated in a follow-up.Incident on Superlog
Was this PR helpful? Leave feedback — goes straight to the Superlog team.
Summary by cubic
Fixes failing weekly analytics summary writes to supermemory by using the correct
containerTagand sanitizing content to prevent 400 errors.storeAnalyticsSummarywrites now succeed.containerTagswithcontainerTagand set value towebsite_${websiteId}(no colon) to meet API rules.sanitizeMemoryContent(summary)to keep content within size limits.Written for commit 004e392. Summary will update on new commits.