feat(service): Enable hosted memory and source context - #487
Conversation
Run bounded memory extraction, promotion, vector embedding, and recall through Vercel AI Gateway. Preserve provider usage and make repeated evidence capable of activating candidates.\n\nAdd commit-pinned GitHub links and bounded inline code context to finding details. Co-Authored-By: GPT-5.6 Sol <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
| memoryRecall: { | ||
| embedding: memory.embedding, | ||
| relevance: memory.relevance, | ||
| }, |
There was a problem hiding this comment.
Hosted memory recall has no rate or cost controls
Enabling AI Gateway embedding and relevance on POST /api/v1/memory/recall lets any read-scoped service token spend gateway quota on each unique clientRecallId, and createVercelWardenService still does not wire a rateLimit hook.
Evidence
- This hunk wires
memoryRecall: { embedding: memory.embedding, relevance: memory.relevance }intocreateWardenService(), so hosted recall now calls paid Vercel AI Gateway embed + classify paths. createVercelWardenService()still constructs the app without arateLimithook; the shared middleware only enforces limits when that optional hook is provided.POST /api/v1/memory/recallis authorized for anyreadrole, andrecallMemories()skips the paid path only on an existing(tenantId, clientRecallId)batch—fresh IDs always embed/classify.- Personal PATs are blocked from this POST, but long-lived read service tokens are not, and there is no quota/idempotency throttle beyond client-chosen IDs.
Identified by Warden · security-review · BJL-XZR
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 2e5dffc. Configure here.
| LEFT JOIN memory_embeddings me ON me.memory_id = m.id AND me.tenant_id = m.tenant_id | ||
| AND me.provider = $3 AND me.model = $4 AND me.dimensions = $5 | ||
| AND me.content_hash = m.content_hash | ||
| AND me.content_hash = m.content_hash AND me.embedding_vector IS NOT NULL |
There was a problem hiding this comment.
Recall backfill breaks without pgvector
Medium Severity
The recall backfill INSERT now filters on embedding_vector outside the vector savepoint. When that column is absent, the query throws after lexical ranking and is swallowed by the outer catch, so embed jobs are not enqueued and embedding usage is dropped. Write-path JSON fallback cannot recover those memories through recall.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 2e5dffc. Configure here.


Enable the production service to derive, promote, embed, and recall repository memory through Vercel AI Gateway. Finding detail responses now also expose commit-pinned GitHub links and render bounded source evidence inline when the run used the code profile.
Historical and new runs already request memory, but the hosted app previously had no model or embedding providers. This adds OIDC-backed providers with an API-key fallback, conservative three-run promotion, durable embedding work, optional pgvector indexing, and operation cost attribution.
Repeated evidence now updates an existing candidate transactionally instead of returning before it can be promoted. Vector persistence falls back only when pgvector is unavailable, so unrelated database failures remain visible.
The defaults use Luna and text-embedding-3-small to keep backfill costs bounded. Ingestion remains fail-open and write-only credentials still cannot read findings or memory.