Repository navigation
Point unsloth start openclaw memory search at the Unsloth embeddings API - #10320
Conversation
|
@codex review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8dd270aeb9
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
Codex Review: Didn't find any major issues. Chef's kiss. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
3b3432d to
902b7bb
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 902b7bbcea
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 01cfd8932f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
Codex Review: Didn't find any major issues. 🚀 Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
GitHub Actions reproductionPinned head:
Generated {"provider": "openai-compatible", "model": "unsloth/bge-small-en-v1.5", "fallback": "none",
"remote": {"baseUrl": "http://127.0.0.1:18901/v1", "apiKey": "sk-unsloth-..."}}
The "without #10315" column is the expected state of Re-run on the converged heads ( |
|
Confirmed main never writes memory.search in unsloth_cli/commands/start.py, so an openclaw session that is meant to stay local reaches OpenAI for embeddings, and this points it at Studio instead. Since Studio's /v1/embeddings cannot serve it until #10315 lands, could you confirm the merge order so memory search does not start failing for people it works for today? |
…ts embedder The probe returned the string "default" when the settings route did not answer, and that went into the config as memory.search.model next to fallback: "none". That names a model Studio will not serve, with no fallback left, which is the one shape OpenClaw cannot degrade out of: every memory request fails against Studio and the search returns nothing. Verified against openclaw 2026.9.2 driven by the config this writes. Write provider: "none" instead, which is OpenClaw's own value for keyword-only memory search. It makes no network call, never reaches OpenAI, and openclaw memory search still returns ranked hits (checked live: score 0.647 on the same corpus that scores 0.598 with embeddings). The stale remote is dropped so a reused --persist config stops carrying an endpoint and key for a provider that is no longer pointed at it. Two smaller things on the same probe: strip the name, since OpenClaw sends it to /v1/embeddings verbatim and Settings stores what was typed; and let a typer.Exit through, since it is a RuntimeError subclass and the broad catch turned a deliberate CLI abort into a silently degraded config.
|
Went through this one properly: simulated it, ran it against a real Studio with the real OpenClaw client, and pushed three fixes to the branch ( Before and after, measured rather than assumedBooted a real Studio on 127.0.0.1:18901 twice from the same machine, once from
So the ordering is real, and the failure without #10315 is a 404 rather than the 501 the description predicts, because the request reaches Full path end to end, with the real client (openclaw 2026.9.2, Node 22.23.2), no mocks: and Studio's own log shows the What I changed on the branch1. The branch now writes 2. The model name is now stripped. OpenClaw sends 3. A Things you should know about, that I did not changeExisting memory indexes go stale on the first run after this lands. OpenClaw fingerprints its index on provider and model, and this PR changes both. Live: Nothing is corrupted and OpenClaw reports it clearly with the fix, but the same thing happens every time someone changes the Settings embedding model between OpenClaw's own gateway One wasted GET. The probe is evaluated as an argument to SimulationsAll in an isolated
What this host cannot answer: real AMD/ROCm and real Apple silicon. Those cells are simulated at the decision function only, so backend selection is covered and numerical behaviour on that hardware is not. No browser surface is involved: this PR touches two Python files and #10315 touches no frontend file. Ready from my side once #10315 lands. I pushed one fix there too, for the case above where an actionable "model is not downloaded yet" became a 502 "An internal error occurred" by the time it reached memory search. |
|
Cross-platform results, since simulating Ran this branch plus a repo-native copy of the 70-case matrix on real runners in a staging replica, and ran upstream
The same nine, byte for byte: So this PR introduces no Windows regression: those nine fail on Every openclaw test passed on Windows and macOS, including the new ones, and all 70 matrix cases passed on Windows (two skip there by design: the POSIX one-liner and the WSL bridge). That covers the branches Linux never reaches, in particular The ubuntu-latest lane is still queued behind the org's runners; this repo's own Linux CI is already green on the PR head and I ran the full |
|
Codex Review: Didn't find any major issues. Chef's kiss. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
21 added comment lines to 11. Every surviving line still names a mistake the next reader would otherwise make: why None is not a model name, why typer.Exit is caught separately, why the model is stripped, and why the remote is cleared.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 58c52a6afb
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| combination OpenClaw cannot degrade out of. The caller writes provider "none" instead. | ||
| """ | ||
| try: | ||
| info = _http_json("GET", f"{base}/api/settings/embedding-model", key, timeout = 10) |
There was a problem hiding this comment.
Verify that Studio can serve the reported embedder
When this CLI connects to an already-running or remote Studio version from before the dependent embeddings change, this GET can still succeed because studio/backend/routes/settings.py::get_embedding_model already existed, while that version's openai_embeddings only proxies to the loaded GGUF and cannot serve the configured sentence-transformers model. The successful response therefore selects openai-compatible instead of keyword-only mode, causing OpenClaw memory requests to fail against the usual non-embedding chat model (or trigger an unwanted model switch when auto-switching is enabled). Use an explicit server capability/version signal rather than treating the settings route's existence as proof that /v1/embeddings supports this model.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Not changing this, though the facts are right and I measured them rather than reasoning about them.
I booted a real Studio twice on the same machine, once from main + this PR and once from main + #10315 + this PR, and posted to /v1/embeddings with exactly the model string this config writes, with a chat model resident:
- without Studio: serve /v1/embeddings from the configured embedding model when the loaded GGUF cannot #10315: 503 No GGUF model loaded when nothing is loaded, 404 the model is not downloaded on this server when the chat model is resident. A real openclaw memory search against it failed with Memory search failed: HTTP 502.
- with Studio: serve /v1/embeddings from the configured embedding model when the loaded GGUF cannot #10315: 200 both ways, 384-dim, served by sentence-transformers:unsloth/bge-small-en-v1.5.
So yes, the settings route existing (since #6800, 2026-07-02) does not imply /v1/embeddings can serve that model. The chat model was not evicted in that run: auto-switch is off by default, so eviction needs auto-switch on AND the Settings embedding model to name a downloaded GGUF.
Where I disagree is the remedy. There is no capability signal to read: /version (llama_compat.py:183) returns a bare version string and there is no capability endpoint, so gating on it would mean hardcoding the release #10315 lands in, which does not exist while this PR is open and is wrong for dev builds and forks. Probing /v1/embeddings for real is the only honest capability test, and it loads the embedding model, so unsloth start openclaw would stall on a cold Studio and could trigger a download.
The case it guards is also narrow by construction: the CLI and the backend ship in one wheel (pyproject includes unsloth_cli*, studio and studio.backend* in a single distribution), so a co-installed pair always matches. The skew needs UNSLOTH_STUDIO_URL aimed at a remote or stale Studio, and this PR already declares that it merges after #10315. Nothing else in start.py version-gates either; the file's stated design is to try the call and handle the failure.
… the loaded GGUF cannot (#10315) * Studio: serve /v1/embeddings from the configured embedding model when the loaded GGUF cannot * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Untrack the studio embeddings fallback from the llama keep-warm slot * Hold the embeddings admission permit until the worker thread exits * Pin the embeddings helpers to one model, report its real identity, free the preview guard * Close the embeddings monitor row when the request is cancelled * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Make the admitted-tally assertion relative to the suite's shared counter * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Serve the configured embedding model by name and enforce its token limit on the GGUF embedder * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Validate embeddings input before any switch, cap the limit at the running context and default prompt, hide local model paths * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Keep the proxy for a resident embedding GGUF that answers the requested name and hide Windows-shaped model paths * Accept flat token arrays before switching, drop queued embeddings on disconnect, match aliases without probing and keep redacted local names unique * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Reject falsey encoding formats and apply the studio batch cap only on the fallback * Studio: refuse a decisively named model with nothing loaded, and keep local identities unique * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Accept the advertised local identity as an alias, drop disconnected requests after admission and pin the matched model * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Studio: size the embed server's batch to its context, and never advertise past it * Release the embeddings permit when a cancellation lands in the final disconnect probe * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Studio: trust a cold index less, keep the embed batch as shipped, and reject boolean token ids * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Match tagged identities in full, skip the chat-slot restore for default embedding requests, cache the limit only with both bounds * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Keep the embedder's own message when the model just needs downloading Picking a model in Settings and querying before its download finishes raises EmbeddingModelDownloadRequiredError, whose message says exactly that and exactly what to do. The catch-all mapped it through _friendly_error, which is written for llama-server transport faults, so the caller got 502 "Embedding model failed: An internal error occurred". Reproduced live on a real Studio: with #10320 on top, the generated openclaw.json points memory search at this route, so that string was the whole diagnosis the user saw -- openclaw memory status reported "Embeddings: unavailable, an internal error occurred" for a condition the user could have fixed in one click. Switching the Settings model and switching back is enough to reach it, since the new model is marked download-pending. Return 409 with the model's own words for that error and for UnsafeEmbeddingModelError: the request is fine, the server is not ready to serve it yet. Everything else keeps the 502. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Redact the model path from embedder errors, and fix two invalidation gaps Three review items, each reproduced at head before it was touched. Path leak in the 409 I added: _get resolves a cached model to its absolute snapshot directory and hands that to _guard_model_security, which interpolates it into the error, so returning str(exc) verbatim published the server's Hugging Face cache layout through /v1/embeddings. The scan still runs on the snapshot; the message now names the configured model, and the route puts a local model through the same hashed label the identity and limit errors already use. Identity redaction replaced substrings, not segments. A local model can be a bare relative directory named transformers, which is_local_path accepts when it exists, and sentence-transformers:transformers then became sentence-transformers-<hash>:transformers-<hash>. Reproduced: embedding_identity_model returns None on that, so the identity the response advertises is one _names_studio_embedder cannot match on the next request. Parse off the backend tag and rewrite only the model and repo segments. The token limit outlived the server it was measured on. Changing the custom llama.cpp path makes _current stale and respawns, but _resolve_model_path fast-paths on the unchanged repo and never reaches _adopt_model_path, so the cached value survived onto the new binary. It clamps the GGUF context by the server's n_ctx and n_ubatch, whose defaults differ between builds (llama.cpp server: -b 2048, -ub 512, --ctx-size 0 = from model, and n_ctx in /props is per slot with an automatic slot count), so it is cleared next to the binary it came from. The one existing test touched is a stub signature, not an assertion. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Type the GGUF backend's pending-download refusal like the sentence-transformers one _resolve_model_path raises for exactly the condition EmbeddingModelDownloadRequiredError names, with the same wording, but as a bare RuntimeError. So on the llama-server backend the 409 added for this landed only on the sentence-transformers path, and the GGUF one still returned 502 An internal error occurred: the same user-fixable state, answered two different ways depending on which embedder the hardware picked. Raised typed now. The route's redaction covers it: the message interpolates the configured model, which is what the label substitution replaces, so a local model path does not travel out with it. Regression test fails on the untyped raise and passes here. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Tighten the comments this PR added 127 added comment lines to 79. Cut the restatements and collapsed the rationale blocks to the fact each one exists to carry: why the route untracks before encoding, why the permit follows the worker thread rather than the awaiting task, why no -b/-ub is passed, why the limit is not frozen while /props is silent, and #7454's rule about answering a decisive reference from another embedding space. * Guard a non-string model selector and redact a local GGUF repo under a hub model * Let the security-gate stubs take the display argument * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Refuse a stale embedding identity and bound the advert by the batch we launch with * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Take the physical batch from n_ubatch only --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: danielhanchen <[email protected]> Co-authored-by: Daniel Han <[email protected]>
The config that
unsloth start openclawgenerates never setmemory.search, so OpenClaw fell back to its own default embedding provider,openai. Memory search is on by default, so a session that is meant to run entirely on a local model was reaching for OpenAI embeddings.This points memory search at Studio instead: provider
openai-compatible, the same base URL and session key already written for the chat provider, and Studio's own embedding model name as the model, read from Studio at connect time so the string changes when the Settings model changes. It falls back todefaulton a server without that route.Memory embeddings then run on the local embedding model through Studio's
/v1/embeddings.Depends on #10315 and must merge after it. That PR makes
/v1/embeddingsserve from the configured embedding model when the loaded GGUF cannot, and accepts that model's own name in the request. Againstmaintoday the route still answers 501, so this stays a draft until #10315 lands.Related: #10316 stops the openclaw session from inheriting
OPENAI_API_KEY.