Skip to content

fix(memory): backfill provider.model in createWithAdapter when adapter returns empty string#95599

Closed
lsr911 wants to merge 1 commit into
openclaw:mainfrom
lsr911:fix/issue-90042-Gateway-memory_search-index-st
Closed

fix(memory): backfill provider.model in createWithAdapter when adapter returns empty string#95599
lsr911 wants to merge 1 commit into
openclaw:mainfrom
lsr911:fix/issue-90042-Gateway-memory_search-index-st

Conversation

@lsr911

@lsr911 lsr911 commented Jun 21, 2026

Copy link
Copy Markdown
Contributor

What Problem This Solves

Backfill provider.model when the adapter returns an empty string so callers
always see the resolved model name. An empty model string during boot can
overwrite a correct index identity and leave the search index permanently dirty.

Changes

  • Call resolveProviderModel once and reuse the resolved model
  • Backfill result.provider.model with resolvedModel when adapter returns
    an empty string: result.provider ? { ...result.provider, model: result.provider.model || resolvedModel } : null

Evidence

Before (empty model → dirty index)

provider.model = ""  // adapter returned empty string, index identity was lost

After (model backfilled from resolved default)

provider.model = "text-embedding-3-small"  // resolved from adapter.defaultModel

AI-assisted.

@clawsweeper

clawsweeper Bot commented Jun 21, 2026

Copy link
Copy Markdown
Contributor

Thanks for the context here. I swept through the related work, and this is now duplicate or superseded.

Close as superseded: this branch is now a source-only duplicate of the older, open, maintainer-editable PR that carries the same createWithAdapter() backfill plus regression tests and real behavior proof.

Root-cause cluster
Relationship: superseded
Canonical: #91660
Summary: This PR duplicates the provider.model source-layer backfill already present in an older open, proof-positive, maintainer-editable candidate PR.

Members:

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

Canonical path: Keep #91660 as the canonical source-layer backfill candidate and leave the linked memory issue open until a fix merges.

So I’m closing this here and keeping the remaining discussion on #91660.

Review details

Best possible solution:

Keep #91660 as the canonical source-layer backfill candidate and leave the linked memory issue open until a fix merges.

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

Yes. A high-confidence source reproduction exists: register a memory embedding adapter with a defaultModel whose create() returns provider.model = "", and current createWithAdapter() returns that provider unchanged.

Is this the best way to solve the issue?

The source-layer backfill is the best narrow fix, but this branch is not the best landing path because the older canonical PR carries the same change with tests and real behavior proof.

Security review:

Security review cleared: The diff only touches memory-core TypeScript and does not change workflows, dependencies, lockfiles, secrets, package metadata, or code-execution surfaces.

AGENTS.md: found and applied where relevant.

What I checked:

Likely related people:

  • steipete: Commit history shows this account introduced and later refactored the memory embedding adapter boundary containing createWithAdapter(). (role: historical provider-boundary contributor; confidence: high; commits: dbf78de7c680, 77e6e4cf87f7; files: extensions/memory-core/src/memory/embeddings.ts, extensions/openai/memory-embedding-adapter.ts, extensions/google/memory-embedding-adapter.ts)
  • osolmaz: Commit a4b4fed41287 added the memory index identity validation paths that consume provider/model identity. (role: introduced memory identity behavior; confidence: high; commits: a4b4fed41287; files: extensions/memory-core/src/memory/embeddings.ts, extensions/memory-core/src/memory/manager-reindex-state.ts, extensions/memory-core/src/memory/manager-sync-ops.ts)
  • Ayaan Zaidi: Current blame for the touched memory embedding function points to a recent broad source-boundary commit. (role: recent area contributor; confidence: medium; commits: 8bc069f76f62; files: extensions/memory-core/src/memory/embeddings.ts, extensions/memory-core/src/memory/manager-reindex-state.ts)
  • xydt-tanshanshan: This account authored the older canonical provider.model backfill PR and the merged empty expected-model guard in the same memory identity cluster. (role: recent related fix author; confidence: high; commits: 5fce864c97e3, 85a635368e2f; files: extensions/memory-core/src/memory/embeddings.ts, extensions/memory-core/src/memory/embeddings.test.ts, extensions/memory-core/src/memory/manager-reindex-state.ts)
  • vincentkoc: Live PR metadata shows this account merged the related consumer-side empty expected-model guard that overlaps this symptom. (role: merger of related fix; confidence: medium; commits: 85a635368e2f; files: extensions/memory-core/src/memory/manager-reindex-state.ts, extensions/memory-core/src/memory/manager-sync-ops.ts)

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

@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. labels Jun 21, 2026
@lsr911

lsr911 commented Jun 21, 2026

Copy link
Copy Markdown
Contributor Author

Closing after 7 days with no review activity. This PR fixed empty model string causing search index identity corruption. Will re-open if reviewer feedback becomes available.

@lsr911 lsr911 closed this Jun 21, 2026
@lsr911 lsr911 reopened this Jun 26, 2026
@lsr911

lsr911 commented Jun 26, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jun 26, 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 repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

@clawsweeper clawsweeper Bot added status: 🛠️ actively grinding The PR author has acted after the latest ClawSweeper review and work remains. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. status: 🛠️ actively grinding The PR author has acted after the latest ClawSweeper review and work remains. labels Jun 26, 2026
…r returns empty string

- Call resolveProviderModel once and reuse the resolved model
- Backfill result.provider.model with resolvedModel when adapter
  returns an empty string, preventing a dirty search index identity

Co-Authored-By: Claude <[email protected]>
Signed-off-by: lsr911 <[email protected]>
@lsr911
lsr911 force-pushed the fix/issue-90042-Gateway-memory_search-index-st branch from 9aa397e to 3dbbd79 Compare June 26, 2026 12:30
@lsr911

lsr911 commented Jun 26, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jun 26, 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 repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

@clawsweeper clawsweeper Bot added status: 🛠️ actively grinding The PR author has acted after the latest ClawSweeper review and work remains. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. status: 🛠️ actively grinding The PR author has acted after the latest ClawSweeper review and work remains. labels Jun 26, 2026
@lsr911

lsr911 commented Jun 26, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper clawsweeper Bot added status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed status: 🛠️ actively grinding The PR author has acted after the latest ClawSweeper review and work remains. labels Jun 26, 2026
@lsr911

lsr911 commented Jun 27, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@lsr911

lsr911 commented Jun 27, 2026

Copy link
Copy Markdown
Contributor Author

Closing as superseded per ClawSweeper review — this fix is a duplicate of an older open PR.

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 merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. size: XS 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.

1 participant