openclaw: name message_embedding in auto-capture INSERT to avoid deeplake vector::at#180
openclaw: name message_embedding in auto-capture INSERT to avoid deeplake vector::at#180kaghni wants to merge 1 commit into
Conversation
Symptom: production gateway emits `Auto-capture failed: Query failed:
500: {"error":"Database error: Failed to insert tuple: vector::at out
of range"}` from deeplake-api on every openclaw turn (request IDs in
the gateway journal, multiple workspaces affected).
Root cause: the openclaw auto-capture INSERT omitted the
`message_embedding` column entirely:
INSERT INTO "sessions" (id, path, filename, message, author, ...)
^ skipped
VALUES (uuid, ..., jsonb, userName, ...)
The bundle stubs `node:child_process` so it can't spawn the embed
daemon, and the prior assumption was that an unmentioned `FLOAT4[]`
column would default to NULL. It doesn't — deeplake-api's storage
layer hits an internal C++ bounds check (`vector::at out of range`)
when building the tuple for a row that has no value for the embedding
column.
Decisive negative evidence from #168's PR body: pre-#168 claude-code
sessions wrote successfully with NULL embeddings, because its INSERT
NAMED the column with `embeddingSqlLiteral(null)` → `"NULL"`. The
literal difference between "writes succeed with NULL" and
"vector::at" is whether the column appears in the INSERT.
Fix: list `message_embedding` in the column list and pass `NULL` in
the values tuple — mirroring the working claude-code shape when its
embed daemon returns null.
No schema migration. No deeplake-api change. One-line semantic delta
at the call site, plus a regex window bump in the bundle-scan test
(the comment + slightly longer INSERT statement pushed past 3500
chars between `agent_end` and `Auto-captured`).
Confidence: high — column-count math lines up with the C++
assertion, and #168's working-with-NULL path is direct counter-
evidence for the "deeplake rejects NULL FLOAT4[]" hypothesis.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThis PR adds an explicit ChangesSession Embedding Capture
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Possibly related issues
Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
ESLint skipped: no ESLint configuration detected in root package.json. To enable, add Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Coverage ReportNo Generated for commit ec522d4. |
Summary
Auto-capture has been failing in production with
Auto-capture failed: Query failed: 500: {"error":"Database error: Failed to insert tuple: vector::at out of range"}on every openclaw turn. Diagnosed during the live E2E test of #170/#171/#172/#124 against@deeplake/hivemind@0.7.32.Root cause
The openclaw auto-capture INSERT omits the
message_embeddingcolumn entirely. The bundle stubsnode:child_processso it can't spawn the embed daemon; the prior assumption was that an unmentionedFLOAT4[]column would default to NULL. It doesn't — deeplake-api's tuple-builder hits an internal C++ bounds check on the missing column.Side-by-side:
Decisive evidence this is fixable on our side
PR #168's body explicitly states pre-fix claude-code wrote rows with
message_embedding = NULLsuccessfully ("writes through asNULLforever after"). Those rows weren't rejected — they just had NULL embeddings. So deeplake-api does accept a NULL FLOAT4[] when the column is named in the INSERT. The literal difference between "writes succeed with NULL" and "vector::at out of range" is whether the column appears in the INSERT column list.Fix
Name
message_embeddingin the openclaw INSERT and passNULLin the values tuple — mirroring the working claude-code-with-NULL-embedding shape. One semantic delta at the call site (openclaw/src/index.ts).Plus a regex window bump in
tests/claude-code/skillify-session-start-injection.test.ts(the inline comment documenting why we need the explicit NULL pushed past the previous 3500-char window betweenagent_endandAuto-captured).Test plan
npm run typecheckcleannpm run buildproduces the openclaw bundle with the new INSERTnpm test— 2708/2709 pass; the 1 failure isdeeplake-fs.test.ts > batches and flushes on BATCH_SIZE writeswhich also fails onorigin/main(pre-existing flake, unrelated)npm run audit:openclaw -- --criticals-only— 0 critical0.7.33(or whatever the bump-bot produces), restart openclaw gateway, send a Telegram message, confirmAuto-captured N messageslog line appears instead ofvector::atOut of scope (separate)
Query timeout after 10000msfailures — oncevector::atstops, we'll know whether the timeouts also stop (most are likely the slow-failure path of the same bug) or are a real deeplake-side write-latency issue that warrants a separate report.vector::at out of rangeis a C++ assertion leak that's hard to debug from the plugin side; a clearer "INSERT missing required column for column-store table" message would have saved hours.Summary by CodeRabbit