Skip to content

fix(memory): split zhipu and bailian embedding batch-limit errors - #136868

Merged
obviyus merged 1 commit into
openclaw:mainfrom
SunnyShu0925:fix/memory-embedding-batch-split-zhipu-bailian-136261
Sep 29, 2026
Merged

obviyus merged 1 commit into
openclaw:mainfrom
SunnyShu0925:fix/memory-embedding-batch-split-zhipu-bailian-136261

Conversation

@SunnyShu0925

@SunnyShu0925 SunnyShu0925 commented Sep 3, 2026 •

Copy link
Copy Markdown
Contributor

Closes #136261

What Problem This Solves

openclaw memory index --force aborts when Zhipu embedding-3 rejects an oversized input array with input数组最大不得超过64条. The existing recursive batch splitter does not recognize that Chinese item-limit message.

What Changed

Add the explicit Chinese input-array count-limit shape to the existing embedding error classifier, with a regression case in the existing policy suite. Bailian's English item-limit message and Zhipu's English message are already handled by the base code. Retry budgets, splitting logic, configuration, defaults, and unrelated error handling are unchanged.

User Impact

Memory indexing can recover from the reported Zhipu 64-item cap by halving oversized requests rather than aborting. No new provider limits or configuration options are introduced.

Evidence

Ran the built CLI through pnpm openclaw --profile <isolated-profile> memory index --force --verbose, using a configured zhipu provider, model embedding-3, and the supported memory.search.remote.baseUrl override pointed at a local OpenAI-compatible HTTP server. The fixture contains 100 independent entries in MEMORY.md; the server returns HTTP 400 with code 1214 and the reporter's literal Chinese message for arrays larger than 64.

  • Base 0e6c5a8d891: exit 1; one rejected 100-item request; zero indexed chunks.
  • Candidate 5b6a90498c75d81807a49c6ead2d0a7770e66b78: exit 0; requests [100, 50, 50]; CLI reports one file indexed; memory status --json reports 100 chunks, a complete vector index, and valid index identity.
  • Negative control on the candidate: HTTP 400/code 1214 with input array must contain strings exits 1 after one 100-item request, without splitting.
  • Focused manager-embedding-policy.test.ts: 45 tests passed.

Each CLI used an explicit isolated profile and task-owned home, config, and state directories. Config and database paths were printed before indexing; no live state was used. The proof replays the reported provider response locally, not a live funded Zhipu account.

No overlap with Pash/Sarah changes: checked the changed files' history on origin/main for pash-openai/[email protected] and sjf-oa/[email protected]; no matching commits.

Thanks @SunnyShu0925 for the fix and @vanecook for the report and exact error payload.

AI Assistance

AI-assisted implementation review and isolated CLI verification. The contributor's commits and existing focused fix are preserved.

@clawsweeper

clawsweeper Bot commented Sep 3, 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. 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 3, 2026
@clawsweeper

clawsweeper Bot commented Sep 3, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 22, 2026, 11:25 PM ET / September 23, 2026, 03:25 UTC (Revision 8).

ClawSweeper review

What this changes

Extends Memory Core’s existing batch-error matcher to recognize Zhipu’s Chinese item-count limit and adds a regression case.

Merge readiness

✅ Ready for maintainer review

Keep open: the Chinese Zhipu rejection remains unhandled on current main and the latest release. The narrow fix has sufficient transport-boundary recovery evidence and no actionable findings; the overlapping Chinese-payload PR closed unmerged.

Priority: P2
Reviewed head: 5b6a90498c75d81807a49c6ead2d0a7770e66b78

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused repair with meaningful regression coverage, sufficient real-transport recovery evidence and no blocking findings.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (live_output): The captured head-specific evidence exercises the production classifier and recursive split owner through real fetch against a local HTTP endpoint replaying the reported Zhipu rejection, recovering all 400 results in eight successful leaves. This is sufficient internal recovery proof; authenticated vendor execution was unavailable. No stored-data contract changes.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The captured head-specific evidence exercises the production classifier and recursive split owner through real fetch against a local HTTP endpoint replaying the reported Zhipu rejection, recovering all 400 results in eight successful leaves. This is sufficient internal recovery proof; authenticated vendor execution was unavailable. No stored-data contract changes.
Evidence reviewed 10 items Pinned introduced change: The introduced patch adds the specific Chinese input-array count phrase, extends its explanatory comment and positive test table, and removes a generic file-header comment. Existing English, Bailian, transport and retry branches remain intact.
Current main still needs the fix: Current main recognizes the English input-array limit and Bailian wording, but not input数组最大不得超过64条. Its existing splitter rethrows errors that fail this classifier.
Latest release retains the gap: The supplied latest release, v2026.9.5, also lacks the Chinese alternative in its batch-error matcher.
Findings None None.
Security None None.

How this fits together

Memory Core turns document chunks into embeddings for searchable memory. Its retry policy classifies provider errors and splits oversized batches before returning ordered embeddings to the indexer.

flowchart TD
  A[Document chunks] --> B[Memory embedding batch]
  B --> C[Embedding provider]
  C --> D{Recognized item limit?}
  D -->|Yes| E[Split into smaller batches]
  E --> C
  D -->|No| F[Surface terminal error]
  C -->|Success| G[Ordered embeddings for indexing]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

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

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

Review metrics

None.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #136261
Summary: This PR addresses the canonical report’s remaining Chinese-payload gap; English handling is already merged.

Members:

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

Technical review

Best possible solution:

Keep the precise Chinese item-count classification in the existing split owner without adding provider caps, configuration, or a parallel retry mechanism.

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

Yes, from source: the reported Chinese HTTP 400 payload fails current main’s classifier, so the production splitter rethrows it. This review did not execute a current-main reproduction.

Is this the best way to solve the issue?

Yes. Extending the existing precise matcher repairs the reported failure while preserving the canonical retry mechanism and unrelated error handling.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

No label changes.

Label justifications:

  • P2: Repairs memory indexing for Zhipu requests exceeding its item cap, with a narrow provider-specific blast radius.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The captured head-specific evidence exercises the production classifier and recursive split owner through real fetch against a local HTTP endpoint replaying the reported Zhipu rejection, recovering all 400 results in eight successful leaves. This is sufficient internal recovery proof; authenticated vendor execution was unavailable. No stored-data contract changes.
  • proof: sufficient: Contributor real behavior proof is sufficient. The captured head-specific evidence exercises the production classifier and recursive split owner through real fetch against a local HTTP endpoint replaying the reported Zhipu rejection, recovering all 400 results in eight successful leaves. This is sufficient internal recovery proof; authenticated vendor execution was unavailable. No stored-data contract changes.

Evidence

What I checked:

Likely related people:

  • obviyus: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Peter Steinberger: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • ylcn91: 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 (7 earlier review cycles)
  • reviewed 2026-09-03T02:38:37.476Z sha 8409d8eece903e575d0a2ff0c21ff1a844f681e0 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-03T03:38:18.987Z sha fda625fbb602cbf19d5e7e63019a9a63fffd4a25 :: needs real behavior proof before merge. :: none
  • reviewed 2026-09-03T05:19:51.706Z sha fda625fbb602cbf19d5e7e63019a9a63fffd4a25 :: needs real behavior proof before merge. :: none
  • reviewed 2026-09-03T05:27:09.927Z sha fda625fbb602cbf19d5e7e63019a9a63fffd4a25 :: needs real behavior proof before merge. :: none
  • reviewed 2026-09-03T06:22:08.541Z sha fda625fbb602cbf19d5e7e63019a9a63fffd4a25 :: needs changes before merge. :: [P3] Document the vendor-error contract beside the matcher
  • reviewed 2026-09-07T04:35:44.275Z sha 7e3d920f5fb21ddf3dd3c6133b1024ebeecd3ae3 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-14T10:43:52.728Z sha 2afefe0b87f9409528f8136a5bd415e32f736e40 :: needs maintainer review before merge. :: none

@SunnyShu0925
SunnyShu0925 force-pushed the fix/memory-embedding-batch-split-zhipu-bailian-136261 branch from 8409d8e to fda625f Compare September 3, 2026 03:31
@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 3, 2026
@obviyus obviyus self-assigned this Sep 3, 2026
@clawsweeper

clawsweeper Bot commented Sep 3, 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: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Sep 3, 2026
@clawsweeper

clawsweeper Bot commented Sep 3, 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 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 3, 2026
@SunnyShu0925
SunnyShu0925 force-pushed the fix/memory-embedding-batch-split-zhipu-bailian-136261 branch from fda625f to 7e3d920 Compare September 7, 2026 04:29
@SunnyShu0925

Copy link
Copy Markdown
Contributor Author

@obviyus This PR was rebased onto the latest main to resolve a merge conflict.

What happened: main independently merged the bailian batch-limit branch (batch size is invalid, it should not be larger than \d+) while this PR was in review, causing a CONFLICTING state. The rebase keeps main's bailian branch (with its \b word boundary) and layers the PR's zhipu branch (input数组最大不得超过\d+条) on top.

Net change vs main: +6 lines across 2 files — the zhipu regex branch and its test coverage. No new abstraction, no schema or contract change. The bailian portion is now main's code, not this PR's.

Verified: oxfmt ✅ · oxlint ✅ · vitest 17/17 ✅ · no lockfile changes. Head is 7e3d920f5fb, PR is now MERGEABLE. ClawSweeper auto re-review has been triggered.

@SunnyShu0925

Copy link
Copy Markdown
Contributor Author

Hi @obviyus — following up on #136868 (rebased clean on main, CI green, ClawSweeper 4/6, proof sufficient, no findings).

Quick context on why I'm nudging: the remaining Chinese zhipu payload (input数组最大不得超过64条 from #136261) is still unhandled on main — #139541 covered the English input array max branch but not the Chinese one, so memory indexing still aborts for zhipu embedding-3 users with >64 chunks.

There's also #136870 from another contributor targeting the exact same gap. Rather than have both sit open indefinitely, could you pick one to merge (or close as duplicate)? Happy to defer if #136870 is preferred — just want the underlying issue resolved. The fix is a 1-line regex branch on the existing split classifier, no new mechanism.

#136868

The splittable batch-error regex only matched OpenAI-style item-limit
wording, so zhipu (Chinese "input数组最大不得超过64条") and DashScope/
bailian ("batch size is invalid, it should not be larger than 20")
rejections were not recognized as splittable. The binary-split retry
never fired and the whole memory index failed once a batch exceeded the
provider cap.

Extend the regex to recognize both payloads, mirroring the explicit
numeric-cap requirement of the existing OpenAI branches.

Fixes openclaw#136261
@SunnyShu0925
SunnyShu0925 force-pushed the fix/memory-embedding-batch-split-zhipu-bailian-136261 branch from 2afefe0 to 5b6a904 Compare September 23, 2026 03:13
@obviyus

obviyus commented Sep 29, 2026

Copy link
Copy Markdown
Collaborator

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@obviyus
obviyus merged commit 00c09b7 into openclaw:main Sep 29, 2026
113 of 114 checks passed
@obviyus

obviyus commented Sep 29, 2026

Copy link
Copy Markdown
Collaborator

Landed in 00c09b7. Zhipu’s Chinese input-array limit now triggers the existing batch splitter. Verified through the built memory index --force CLI: the base failed on 100 inputs; the fix split them into 50 + 50 and indexed all 100 chunks. An unrelated HTTP 400 remained terminal, and all 45 focused policy tests passed. Thanks @SunnyShu0925 for the fix and @vanecook for the detailed report and exact error payload!

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 30, 2026
…enclaw#136868)

Closes openclaw#136261

## What Problem This Solves

`openclaw memory index --force` aborts when Zhipu embedding-3 rejects an oversized input array with `input数组最大不得超过64条`. The existing recursive batch splitter does not recognize that Chinese item-limit message.

## What Changed

Add the explicit Chinese input-array count-limit shape to the existing embedding error classifier, with a regression case in the existing policy suite. Bailian's English item-limit message and Zhipu's English message are already handled by the base code. Retry budgets, splitting logic, configuration, defaults, and unrelated error handling are unchanged.

## User Impact

Memory indexing can recover from the reported Zhipu 64-item cap by halving oversized requests rather than aborting. No new provider limits or configuration options are introduced.

## Evidence

Ran the built CLI through `pnpm openclaw --profile <isolated-profile> memory index --force --verbose`, using a configured `zhipu` provider, model `embedding-3`, and the supported `memory.search.remote.baseUrl` override pointed at a local OpenAI-compatible HTTP server. The fixture contains 100 independent entries in `MEMORY.md`; the server returns HTTP 400 with code `1214` and the reporter's literal Chinese message for arrays larger than 64.

- Base `8165e993a59`: exit 1; one rejected 100-item request; zero indexed chunks.
- Candidate `5b6a90498c75d81807a49c6ead2d0a7770e66b78`: exit 0; requests `[100, 50, 50]`; CLI reports one file indexed; `memory status --json` reports 100 chunks, a complete vector index, and valid index identity.
- Negative control on the candidate: HTTP 400/code `1214` with `input array must contain strings` exits 1 after one 100-item request, without splitting.
- Focused `manager-embedding-policy.test.ts`: 45 tests passed.

Each CLI used an explicit isolated profile and task-owned home, config, and state directories. Config and database paths were printed before indexing; no live state was used. The proof replays the reported provider response locally, not a live funded Zhipu account.

No overlap with Pash/Sarah changes: checked the changed files' history on `origin/main` for `pash-openai`/`[email protected]` and `sjf-oa`/`[email protected]`; no matching commits.

Thanks @SunnyShu0925 for the fix and @vanecook for the report and exact error payload.

## AI Assistance

AI-assisted implementation review and isolated CLI verification. The contributor's commits and existing focused fix are preserved.

Co-authored-by: Ayaan Zaidi <[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. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XS 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 index --force fails on built-in zhipu/bailian embedding providers — item-count batch limit (64/20) not handled by splittable-error retry

2 participants