Skip to content

fix(memory): restore indexing after embedding row-cap errors - #138391

Merged
obviyus merged 2 commits into
openclaw:mainfrom
teddytennant:fix/memory-core-embedding-batch-cap
Sep 6, 2026
Merged

obviyus merged 2 commits into
openclaw:mainfrom
teddytennant:fix/memory-core-embedding-batch-cap

Conversation

@teddytennant

@teddytennant teddytennant commented Sep 4, 2026 •

Copy link
Copy Markdown
Contributor

Closes #137864

What Problem This Solves

Fixes an issue where a full memory rebuild fails when an OpenAI-compatible embedding endpoint rejects a request with batch size is invalid, it should not be larger than 10. The failed rebuild leaves memory search with an empty or stale index.

Why This Change Was Made

Recognize the explicit numeric row-limit error in the existing shared classifier. The existing ordered splitter then divides the rejected batch until the provider accepts it. Text and structured inputs keep the same recovery policy. No fixed row cap, provider-specific setting, or storage change is added.

User Impact

Affected memory rebuilds can finish and semantic search can use the complete index. Ambiguous errors and rejected single-item requests remain terminal; service retries and native-batch fallback retain their existing behavior.

Evidence

  • Main 9c56ee41de73: the shipped memory index --force command sends 33 chunks, receives the numeric HTTP 400, and fails. Status reports zero chunks and a dirty index; search returns no results with a stale-index warning.
  • Candidate 0e5b59012a61: the same loopback-provider scenario completes the rebuild. Requests split as 33 → 17 → 9/8 → 16 → 8/8; all 33 stored vectors match their original chunks. Status reports a complete, clean index.
  • A query with no words in the corpus finds the expected record with vector score 1 and text score 0.
  • Controls cover a ten-item request, nonnumeric and unrelated errors, a rejected singleton, a retryable HTTP 503, a reset connection, and native asynchronous batch failure followed by inline recovery.
  • Memory-plugin CI: 2,255 tests passed; three existing skips. Both changed regression files passed, including text and structured recovery cases.
  • Independent source-blind validation exercised eight product scenarios and found no row-cap recovery defect. Source structure and development-process claims were assessed separately by code review.
  • Exact-candidate build, extension test type checks, source review, and pinned formatting passed.

Original repair and ancestry: @teddytennant. Additional negative-case coverage: @saladinyao-cyber (#138992). Transport coverage from @ylcn91 (#139541) informed the full-index proof; that PR addresses a separate error wording.

Treat DashScope-style "batch size is invalid, it should not be larger
than N" 400s as splittable so memory-core bisects oversized embedding
requests instead of aborting the whole sync.

Closes openclaw#137864
@clawsweeper

clawsweeper Bot commented Sep 4, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added extensions: memory-core Extension: memory-core size: XS triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. and removed triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. labels Sep 4, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Sep 4, 2026
@clawsweeper

clawsweeper Bot commented Sep 4, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 5, 2026, 12:49 AM ET / 04:49 UTC.

ClawSweeper review

What this changes

Recognize numeric embedding batch-size errors so memory indexing splits rejected requests into smaller batches, with regression coverage for recovery and unchanged successful requests.

Merge readiness

✅ Ready for maintainer review

This remains a useful, necessary fix with no blocking findings. The new real-HTTP before/after evidence satisfies the previous proof request.

Priority: P2
Reviewed head: 1af39eb7e6abd57771ae8f7bd3907a25d2222eca

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, maintainable repair with meaningful regression coverage and convincing production-path HTTP evidence.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (terminal): The captured terminal trace exercises Memory Core's production batch-recovery method and real OpenAI HTTP client against an injected row-cap response: three 400s become four successful smaller requests and 33 ordered vectors, while the parent classifier fails. This satisfies the previous proof request.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (terminal): The captured terminal trace exercises Memory Core's production batch-recovery method and real OpenAI HTTP client against an injected row-cap response: three 400s become four successful smaller requests and 33 ordered vectors, while the parent classifier fails. This satisfies the previous proof request.
Evidence reviewed 11 items Verified introduced change: The pinned merge-base-to-head comparison contains one classifier change and associated tests. Unrelated endpoint drift is excluded from this review.
Current main still needs the fix: The current-main classifier recognizes earlier numeric input-limit messages but lacks the reported batch-size wording; the existing splitter consequently propagates that error.
Latest release comparison: The same missing classification is present in v2026.9.1, whose tag resolves to the supplied release commit.
Findings None None.
Security None None.

How this fits together

Memory Core turns memory files and session text into embeddings for semantic search. Its batching layer sends text to the configured provider and returns ordered vectors to the index writer.

flowchart TD
  A[Memory files and session text] --> B[Build embedding batches]
  B --> C[Provider HTTP request]
  C --> D{Numeric row-cap rejection?}
  D -->|Yes| E[Split batch in half]
  E --> C
  D -->|Successful response| F[Collect vectors in input order]
  F --> G[Update memory search index]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source 0, Tests +28. Total +28 across 3 files.

View PR surface stats
Area Files Added Removed Net
Source 1 1 1 0
Tests 2 28 0 +28
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 29 1 +28

Review metrics

Metric Value Why it matters
Production versus test growth Production net 0 lines; tests +28 lines The repair extends the existing recovery owner without adding another production path.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #137864
Summary: This PR is the candidate repair for the linked issue's exact row-cap classification failure.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Technical review

Best possible solution:

Keep recovery in the existing shared classifier and ordered splitter, without introducing fixed provider caps or another configuration setting.

Do we have a high-confidence way to reproduce the issue?

Yes, from source: an oversized request returning the reported numeric row-cap error bypasses splitting on current main. The contributor supplies matching before/after HTTP traces; this review did not execute the runtime.

Is this the best way to solve the issue?

Yes. Extending the established classifier repairs the shared recovery boundary; a global 10-row cap or new setting would impose unnecessary policy on unaffected providers.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against d5992278b3b8.

Labels

Label justifications:

  • P2: This repairs memory indexing for endpoints returning numeric row-cap errors, with limited blast radius.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The captured terminal trace exercises Memory Core's production batch-recovery method and real OpenAI HTTP client against an injected row-cap response: three 400s become four successful smaller requests and 33 ordered vectors, while the parent classifier fails. This satisfies the previous proof request.
  • proof: sufficient: Contributor real behavior proof is sufficient. The captured terminal trace exercises Memory Core's production batch-recovery method and real OpenAI HTTP client against an injected row-cap response: three 400s become four successful smaller requests and 33 ordered vectors, while the parent classifier fails. This satisfies the previous proof request.

Evidence

What I checked:

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • shin4141: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (2 earlier review cycles)
  • reviewed 2026-09-04T17:40:00.970Z sha 1af39eb :: needs real behavior proof before merge. :: none
  • reviewed 2026-09-05T03:58:50.239Z sha 1af39eb :: needs real behavior proof before merge. :: none

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Sep 5, 2026
@obviyus obviyus self-assigned this Sep 6, 2026
Use the existing ordered splitter for explicit numeric batch-size limits.
Cover text and structured inputs, exact-cap requests, and terminal errors.

Co-authored-by: saladinyao-cyber <[email protected]>
@obviyus
obviyus requested review from a team as code owners September 6, 2026 13:08
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation channel: discord Channel integration: discord channel: googlechat Channel integration: googlechat channel: imessage Channel integration: imessage channel: line Channel integration: line channel: matrix Channel integration: matrix channel: mattermost Channel integration: mattermost channel: msteams Channel integration: msteams channel: nextcloud-talk Channel integration: nextcloud-talk channel: nostr Channel integration: nostr channel: signal Channel integration: signal labels Sep 6, 2026
@obviyus

obviyus commented Sep 6, 2026

Copy link
Copy Markdown
Collaborator

Thanks @teddytennant for the original repair, @saladinyao-cyber for the additional negative cases, and @ylcn91 for the related transport evidence.

Landed in 36d4827.

Bug: an explicit numeric embedding row cap aborted a full memory rebuild and left semantic search with an empty or stale index.

Fix: the existing ordered splitter now handles that rejection without a fixed global cap or new configuration.

Before After
One 33-item rejection; rebuild fails; search is empty and stale. Rebuild completes with all 33 vectors paired correctly; the clean index returns the expected semantic result with no keyword match.

Independent validation passed eight product scenarios, including terminal errors, service and connection-reset retries, and native-batch fallback. Memory-plugin CI passed 2,255 tests, including the text/structured recovery cases. Exact-head CI and final review passed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

extensions: memory-core Extension: memory-core P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] memory-core embeddings fail against endpoints with per-request row caps (e.g. DashScope: "batch size ... larger than 10")

2 participants