Skip to content

feat(service): Enable hosted memory and source context - #487

Merged
gricha merged 1 commit into
mainfrom
feat/hosted-memory-runtime
Aug 14, 2026
Merged

feat(service): Enable hosted memory and source context#487
gricha merged 1 commit into
mainfrom
feat/hosted-memory-runtime

Conversation

@gricha

@gricha gricha commented Aug 14, 2026

Copy link
Copy Markdown
Member

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.

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>
@vercel

vercel Bot commented Aug 14, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
warden-prod Ready Ready Preview Aug 14, 2026 3:49pm

Request Review

@gricha
gricha marked this pull request as ready for review August 14, 2026 15:49
@gricha
gricha enabled auto-merge (squash) August 14, 2026 15:49
@gricha
gricha merged commit 8fb8c26 into main Aug 14, 2026
22 checks passed
@gricha
gricha deleted the feat/hosted-memory-runtime branch August 14, 2026 15:51
Comment on lines +49 to 52
memoryRecall: {
embedding: memory.embedding,
relevance: memory.relevance,
},

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 } into createWardenService(), so hosted recall now calls paid Vercel AI Gateway embed + classify paths.
  • createVercelWardenService() still constructs the app without a rateLimit hook; the shared middleware only enforces limits when that optional hook is provided.
  • POST /api/v1/memory/recall is authorized for any read role, and recallMemories() 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

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ 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

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 2e5dffc. Configure here.

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