Conversation
Port ExoCortex production smart-ingest pipeline to OB1 as a standalone Supabase Edge Function for LLM-powered atomic thought extraction from raw text. Features: dry-run preview, fingerprint + semantic dedup (0.85/0.92 thresholds), evidence append, job execution, quality gate, source metadata threading, import_key session dedup, chunking for long texts. OB1 adaptations: OpenRouter-first provider order, wildcard CORS, model constants from _shared/config.ts, optional entity extraction trigger, _shared/ helpers copied from enhanced-mcp (PR 5). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 661fe55dc6
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (!response.ok) { | ||
| throw new Error(`OpenRouter embedding failed (${response.status}): ${await response.text()}`); | ||
| } |
There was a problem hiding this comment.
Fall back to OpenAI when OpenRouter embedding fails
embedText advertises OpenRouter-primary/OpenAI-fallback behavior, but this branch throws immediately on any OpenRouter non-2xx response, so the OpenAI branch is never attempted when both keys are configured. In production, transient OpenRouter 429/5xx errors will cause ingestion reconciliation to fail (or lose embeddings) even though a healthy fallback provider is available; catch this failure and continue to the OpenAI path instead of hard-failing here.
Useful? React with 👍 / 👎.
| : null; | ||
|
|
||
| for (const item of items) { | ||
| if (item.action === "skip") { skippedCount++; continue; } |
There was a problem hiding this comment.
Mark skipped dry-run items executed in /execute
In handleExecuteJob, skip actions are counted and immediately continued, but the corresponding ingestion_items row is never updated. Because dry-run persistence stores pending items as ready, these rows stay ready even after the job is marked complete, leaving job state inconsistent and potentially misleading any UI/automation that interprets ready as unprocessed. Update skipped rows to executed before continuing (as the immediate-execution path already does).
Useful? React with 👍 / 👎.
Add blank lines around headings (MD022), fenced code blocks (MD031), and between adjacent blockquotes (MD028). Fix broken link fragment (MD051) and remove extra blank line (MD012). No content changes. These errors were blocking CI on all open PRs since the lint check runs repo-wide. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Each section's numbered list now restarts at 1 instead of continuing the global count (3-14), satisfying markdownlint MD029/ol-prefix rule. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Summary
schemas/smart-ingest-tables(PR [schemas] Smart ingest pipeline tables #4) foringestion_jobsandingestion_itemstablesWhat It Does
Accepts raw text via HTTP POST, extracts atomic thoughts using an LLM (OpenRouter primary, OpenAI/Anthropic fallback), then deduplicates each thought against existing brain content using both SHA-256 content fingerprinting and pgvector semantic similarity. Four reconciliation actions: add, skip, append_evidence, create_revision.
Key Features
/executeendpointOB1 Adaptations
_shared/config.ts(consistent with enhanced-mcp)_shared/helpers copied from enhanced-mcp (PR [integrations] Enhanced MCP server with alpha tool suite #6) for consistencyFiles
All within
integrations/smart-ingest/:index.ts_shared/helpers.ts_shared/config.tsREADME.mdmetadata.jsondeno.jsonTest plan
gh pr checksmetadata.jsonagainst.github/metadata.schema.json../../docs/01-getting-started.md,../../docs/05-tool-audit.md)integrations/smart-ingest/🤖 Generated with Claude Code