Skip to content

fix(memory): split embedding batches rejected for an input array item cap - #139541

Merged
vincentkoc merged 4 commits into
openclaw:mainfrom
ylcn91:fix/memory-embedding-batch-split-classification
Sep 13, 2026
Merged

vincentkoc merged 4 commits into
openclaw:mainfrom
ylcn91:fix/memory-embedding-batch-split-classification

Conversation

@ylcn91

@ylcn91 ylcn91 commented Sep 6, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #139040

What Problem This Solves

Memory indexing stops when an embedding provider rejects an oversized request
with input array max 64, instead of splitting it into smaller batches.

User Impact

Oversized requests can recover through the existing batch-splitting path while
per-item validation errors and token limits remain terminal. Vector ordering and
existing provider retry behavior are preserved. No configuration, schema,
persistent-storage or dependency change is required.

Why This Change Was Made

The reported item-count rejection needs its own precise classification. The new
alternative requires a complete integer and message boundary; generic error code
1214, item/token limits, token suffixes and fractional counts do not qualify.
Existing Ark, Qianfan, DashScope and transport alternatives remain unchanged.

The contributor's work and both commits are preserved. The maintainer integration
updates the existing transport harness for current Memory Core candidate and
generation APIs, narrows the matcher, and extends the existing test tables.
Original implementation and HTTP-boundary coverage by @ylcn91.

Evidence

Current candidate: 21e1e78f9a2f1c9a0ddb5beaf6d7ab91b0ddcaca, integrating
201f11afefdb19a9c75e9d3542bf7425c80df7a7 without rewriting contributor ancestry.
Independent source review found no actionable P0-P2 issues; diff checks passed.

Isolated AWS proof on this exact candidate passed:
https://crabbox.openclaw.ai/portal/runs/run_7f17ed57d156

  • The original broad-matcher counterfactual produced 14 intended failures and
    7 passing controls, with 18 tests deliberately unselected. Four terminal HTTP
    cases made eight requests instead of one; ten retry cases called twice instead
    of once, including the numbered-element token-limit wording.
  • Restored candidate: 84 owner tests passed, including ordered HTTP requests
    [100, 50, 50], ordered vectors and one-request terminal errors.
  • Relevant embedding, bridge and cache siblings: 26 passed. Both green phases
    had zero failures or skips.
  • Formatting and selected changed checks passed, including production/test
    types, lint, dead-export and applicable boundary guards. Candidate hashes were
    unchanged, all process trees joined and no evidence was omitted.

Exact-head CI completed green:
https://github.com/openclaw/openclaw/actions/runs/34775024167
Merged through native squash admission as
0afc02335308892d7efa3ccf7d981e912c6dd238.

The earlier 3e0078f860ce960389dac2ffdfe4580c44e9bc79 attempt stopped at formatting
before runtime tests; this head adds only canonical import wrapping to that
reviewed integration. No contributor code, tests or configuration ran locally.

The HTTP server is synthetic and reproduces the reported rejection. This is not
a live Zhipu endpoint test, and no provider credentials are used. The issue's
separate scan-eligibility observation remains outside this repair.

@clawsweeper

clawsweeper Bot commented Sep 6, 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.

@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Sep 6, 2026
@clawsweeper

clawsweeper Bot commented Sep 6, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed September 13, 2026, 2:41 PM ET / 18:41 UTC (Revision 6).

ClawSweeper review

What this changes

Memory Core recognizes explicit input-array count limits and uses its existing batch splitter to recover, with coverage for ordered vectors and terminal validation errors.

Merge readiness

⛔ Blocked before merge - 2 items remain

This remains a useful, focused repair: current main and v2026.9.4 do not recognize the reported rejection. No actionable patch defect was found, but the revised candidate still lacks the runtime validation explicitly marked pending in its body.

Priority: P2
Reviewed head: 21e1e78f9a2f1c9a0ddb5beaf6d7ab91b0ddcaca

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The patch is focused and has no actionable findings, but its revised candidate still lacks the declared runtime results.
Proof confidence 🦐 gold shrimp (3/6) Needs stronger real behavior proof before merge: Earlier accepted production-owner and real-HTTP recovery evidence remains useful, but the captured body explicitly leaves validation pending after the matcher and harness integration. The current candidate needs its already-described ordered recovery and one-request terminal-error results; this is a candidate coverage gap, not rejection of synthetic-server transport proof. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Needs proof Needs stronger real behavior proof before merge: Earlier accepted production-owner and real-HTTP recovery evidence remains useful, but the captured body explicitly leaves validation pending after the matcher and harness integration. The current candidate needs its already-described ordered recovery and one-request terminal-error results; this is a candidate coverage gap, not rejection of synthetic-server transport proof. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Evidence reviewed 8 items Current main still lacks the repair: The fetched main classifier recognizes existing transport and provider-limit phrases, but not input array max 64. Byte-budgeted batches can exceed 64 short inputs, and the existing splitter rethrows an unrecognized rejection.
Latest release also lacks the classification: The v2026.9.4 policy source lacks the input-array alternative. GitHub supplied the release source after the local release-blob read failed.
Narrow production change: The complete host-pinned introduction delta adds one precise count-limit alternative and its comment. Existing retry control flow, provider settings, SDK contracts, persisted formats, and authorization are unchanged; the read-only diff check passed.
Findings None None.
Security None None.

How this fits together

Memory Core converts memory and session chunks into vectors for semantic search. Its embedding owner groups provider requests and decides whether failures should retry, split, or stop indexing.

flowchart TD
  A[Memory and session chunks] --> B[Byte-budgeted batches]
  B --> C[Embedding HTTP client]
  C --> D{Provider response}
  D -->|Explicit item cap| E[Ordered batch splitter]
  E --> C
  D -->|Success| F[Vectors for indexing]
  D -->|Terminal error| G[Indexing failure]
Loading

Before merge

  • Add real behavior proof - Needs stronger real behavior proof before merge: Earlier accepted production-owner and real-HTTP recovery evidence remains useful, but the captured body explicitly leaves validation pending after the matcher and harness integration. The current candidate needs its already-described ordered recovery and one-request terminal-error results; this is a candidate coverage gap, not rejection of synthetic-server transport proof. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
  • Complete next step (P2) - Attach the pending candidate transport results before merge. Logs or terminal output count; screenshots or recordings are welcome when useful. Redact keys, IP addresses, private endpoints, and personal data. Updating the PR body should trigger review automatically; otherwise ask a maintainer to comment @clawsweeper re-review.
Agent review details

Security

None.

PR surface

Source +2, Tests +204. Total +206 across 4 files.

View PR surface stats
Area Files Added Removed Net
Source 1 3 1 +2
Tests 3 206 2 +204
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 4 209 3 +206

Review metrics

None.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #139040
Summary: This PR addresses the reported English input-array rejection; the separate scan-eligibility observation remains outside its scope.

Members:

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

Technical review

Best possible solution:

Keep one precise recovery classifier that splits explicit item-count failures while preserving vector order and terminal handling for unrelated errors.

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

Yes, from source: more than 64 short chunks can fit the byte budget, and current main rethrows the reported HTTP 400 because its classifier misses the wording. No runtime reproduction was executed in this read-only review.

Is this the best way to solve the issue?

Yes. Extending the established classifier is a narrow repair that avoids new provider settings, global caps, or competing batching logic.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against f9de0362f7a9.

Labels

Label justifications:

  • P2: This repairs memory indexing for providers returning a specific input-count rejection, with limited scope.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs stronger real behavior proof before merge: Earlier accepted production-owner and real-HTTP recovery evidence remains useful, but the captured body explicitly leaves validation pending after the matcher and harness integration. The current candidate needs its already-described ordered recovery and one-request terminal-error results; this is a candidate coverage gap, not rejection of synthetic-server transport proof. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Evidence

What I checked:

  • Current main still lacks the repair: The fetched main classifier recognizes existing transport and provider-limit phrases, but not input array max 64. Byte-budgeted batches can exceed 64 short inputs, and the existing splitter rethrows an unrecognized rejection. (extensions/memory-core/src/memory/manager-embedding-policy.ts:59, f9de0362f7a9)
  • Latest release also lacks the classification: The v2026.9.4 policy source lacks the input-array alternative. GitHub supplied the release source after the local release-blob read failed. (extensions/memory-core/src/memory/manager-embedding-policy.ts:63, 3a9d69db306c)
  • Narrow production change: The complete host-pinned introduction delta adds one precise count-limit alternative and its comment. Existing retry control flow, provider settings, SDK contracts, persisted formats, and authorization are unchanged; the read-only diff check passed. (extensions/memory-core/src/memory/manager-embedding-policy.ts:61, 21e1e78f9a2f)
  • Production owner and transport boundary: The batching owner invokes the shared splitter and restores vectors to input positions. The OpenAI-compatible embedding client preserves the bounded HTTP error body for classification; this is OpenClaw's embedding implementation and supplies no Codex dependency signal. (src/plugins/openai-compatible-embedding-provider.ts:315, 21e1e78f9a2f)
  • Meaningful transport regression coverage: The added harness uses the production batching owner and real HTTP client with an injected 64-item rejection. Assertions cover requests [100, 50, 50], ordered vectors, and one-request failures for five terminal error shapes. Source coverage was inspected; tests were not executed during this read-only review. (extensions/memory-core/src/memory/generic-embedding-provider.integration.test.ts:337, 21e1e78f9a2f)
  • Proof continuity remains unresolved: Captured sourceRevision 8bc04627093b12a328d7588114239b95be14864e0a2e7333928eb5faedf19a69 explicitly leaves candidate runtime validation pending; a live read returned the same head and body. The previous completed review retained no findings and requested current-candidate transport results. Earlier accepted recovery evidence remains historical support, but the first isolated integration run stopped before runtime tests. (21e1e78f9a2f)

Likely related people:

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

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Record the already-described isolated production-transport validation, including ordered recovery and one-request terminal failures, in the PR body.

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 (5 earlier review cycles)
  • reviewed 2026-09-06T00:16:33.466Z sha 55d8654a5753e760ad583013f3c2e7e3901aba01 :: needs real behavior proof before merge. :: none
  • reviewed 2026-09-06T00:48:11.409Z sha 0274942d2ba0e01b8de873f9cf3684fa92462600 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-06T13:42:02.290Z sha 0da3937 :: blocked before merge. :: none
  • reviewed 2026-09-06T16:32:11.199Z sha 0da3937 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-13T18:32:32.690Z sha 3e0078f :: 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: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Sep 6, 2026
… cap

Zhipu embedding-3 rejects more than 64 items per request with HTTP 400
code 1214 "input array max 64". The splittable-error matcher only knew
two phrasings that put the word "embeddings" before the limit, so the
batch retry rethrew instead of halving and the vector index never built.
Add the input-array phrasing as a third alternative that still requires
an explicit number, and name each provider phrasing above the matcher.
…g transport

Drive Memory Core's real batching owner through the real OpenAI-compatible
embedding client against a loopback server that rejects more than 64
items with Zhipu's 1214 body: the oversized request is halved into two
served requests, vectors return in input order, and a generic 400 without
a numeric bound is not split.
@ylcn91
ylcn91 force-pushed the fix/memory-embedding-batch-split-classification branch from 0274942 to 0da3937 Compare September 6, 2026 13:36
@ylcn91

ylcn91 commented Sep 6, 2026

Copy link
Copy Markdown
Contributor Author

Rebased onto current main (d3e703e) as 0da3937, two commits kept. Conflicts were against #138391, which added the DashScope batch size is invalid, it should not be larger than N phrasing to the same splittable-error regex and the same fixture lists. Resolved as a union: the regex now carries both #138391's DashScope alternative and this PR's Zhipu input array max N alternative (the comment lists both), and the policy and retry-boundary tests keep #138391's DashScope fixtures next to the Zhipu ones. This PR's scope is unchanged (#139040, the Zhipu 1214 wording). manager-embedding-policy, manager-embedding-ops.retry, and generic-embedding-provider.integration pass locally (40 tests).

@ylcn91

ylcn91 commented Sep 6, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Sep 6, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed 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. labels Sep 13, 2026
@vincentkoc
vincentkoc merged commit 0afc023 into openclaw:main Sep 13, 2026
101 of 102 checks passed
@vincentkoc

Copy link
Copy Markdown
Member

Merged via squash.

vincentkoc added a commit that referenced this pull request Sep 13, 2026
* commit '28887b564210326174413d0d8ade72b38268d5f3': (1827 commits)
  fix(qa): bind coverage IDs to producer assertions (#144000)
  fix(linux): explain FreeBSD desktop setup prerequisites (#147211)
  fix(memory): split embedding batches rejected for an input array item cap (#139541)
  test: isolate timing metadata persistence from inherited settings (#147112)
  refactor(status): retire test-only helper publication (#147071)
  improve: reduce workspace agent lookup work for large fleets (#147144)
  refactor(macos): share connect credential selection (#144214)
  fix(plugins): restore Slack onboarding after core updates (#147109)
  refactor: share ANSI compatibility matching (#146998)
  fix(test): settle Models catalog before picker open (#147215)
  test(ui): reuse panel tab drag fixture (#147250)
  fix(install): use system Node for FreeBSD CLI setup (#147204)
  fix(cli): explain MCP probes with no enabled servers (#147216)
  docs: require UI screenshots in chat and PR (#147263)
  docs(skills): clarify remote gog OAuth setup for Gateway hosts (#145945)
  test: replace idle account catalog waits with synchronization (#147228)
  feat(qa): preserve maturity decision context (#147219)
  feat(macos): clarify agent activity in native chat (#147197)
  fix(runtime): complete Bun compatibility follow-ups (#147085)
  fix(ui): release closed chat panes after queued updates (#147240)
  ...
vincentkoc added a commit that referenced this pull request Sep 13, 2026
* commit 'ac59d5e09eb468dc23cf95e447608b57e71b52af': (176 commits)
  improve(gateway): avoid redundant startup preflight work (#147285)
  test(macos): observe readiness cancellation and deadline ownership (#145056)
  fix(ci): route QA Profile Evidence to its run-status owner test (#147293)
  fix(install): preserve runtime links when Node validation fails (#147221)
  test(auto-reply): reuse memory session fixtures (#147262)
  fix: hide subagent sessions from Activity (#147253)
  ci: record resources for slow runtime test commands (#147254)
  fix(update): recognize FreeBSD boot identities in triage leases (#147243)
  refactor(active-memory): share closing tag line scan (#147031)
  fix: resume Settings autosave after Reload Config (#147136)
  fix(cli): keep conversation context after cancellation (#147139)
  fix(channels): make system-agent approval cards actionable (#147152)
  refactor: retain shared database handles until their last worker closes (#147246)
  refactor(slack): share workspace-qualified target resolution (#147024)
  refactor(msteams): remove duplicate quoted-table test (#147270)
  fix(qa): bind coverage IDs to producer assertions (#144000)
  fix(linux): explain FreeBSD desktop setup prerequisites (#147211)
  fix(memory): split embedding batches rejected for an input array item cap (#139541)
  test: isolate timing metadata persistence from inherited settings (#147112)
  refactor(status): retire test-only helper publication (#147071)
  ...
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 14, 2026
… cap (openclaw#139541)

* fix(memory): split embedding batches rejected for an input array item cap

Zhipu embedding-3 rejects more than 64 items per request with HTTP 400
code 1214 "input array max 64". The splittable-error matcher only knew
two phrasings that put the word "embeddings" before the limit, so the
batch retry rethrew instead of halving and the vector index never built.
Add the input-array phrasing as a third alternative that still requires
an explicit number, and name each provider phrasing above the matcher.

* test(memory): prove input-array batch recovery over the real embedding transport

Drive Memory Core's real batching owner through the real OpenAI-compatible
embedding client against a loopback server that rejects more than 64
items with Zhipu's 1214 body: the oversized request is halved into two
served requests, vectors return in input order, and a generic 400 without
a numeric bound is not split.

* style(memory): format embedding integration import

---------

Co-authored-by: Vincent Koc <[email protected]>
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. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: S status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: [memory] sqlite-backed corpus chunks are not split to the 64-item embedding limit (HTTP 400, Zhipu code 1214)

2 participants