Repository navigation
fix(engine): chat still answers when NEAR AI's embedder does not - #296
Merged
Merged
Conversation
On 13 Nov NEAR AI's embeddings endpoint hung (no answer in 60 s, twice)
while chat completions answered (200). Every chat run with semantic recall
then failed in Mastra's prepare-memory-step ("Failed to determine the
embedder's output dimension"); a guest chat on api.hellonear.xyz failed
the same way.
A background probe (one embedding, 8 s timeout, every 30 s) keeps
embedderReady(); while it is false, memoryOptions() turns semantic recall
off for the run, so the Mind answers without searching past chats.
Working memory and the thread's last messages stay. Workflow and Autopilot
agent steps take no per-call options and are not covered.
Tests, with NEAR AI's embedder still down: typecheck clean; test:unit
179/179 (new embedder-health test, mind.test cases); the engine from this
branch logged "embedder does not answer" and a guest chat through a local
backend finished (run.started, text, run.finished, run.verified) where it
failed before; k6 load/chat.js 3 VUs 30 s: 65/65 checks, 0% failed.
Not run: the full live suite (its recall tests need the embedder).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Q5ZrzK8une3S2YyhDG746e
Contributor
Author
|
Merged (Axel's approval). @Lin1er @AncungAulia @Nabil-Aufa: NEAR AI's embeddings endpoint is hanging right now, and that made every chat fail, on the hosted demo too. With this change the engine notices within about 30 s and chats answer without searching past chats until the embedder is back. Nothing changes in FE, BE or env. Autopilot agent steps can still fail while the embedder is down. |
Contributor
|
Live on the hosted demo:
|
This was referenced Nov 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The hosted demo's chat is down right now. NEAR AI's embeddings endpoint hangs: two calls got no answer in 60 s, while chat completions answer 200. Every chat run with semantic recall fails in Mastra's prepare-memory-step:
A guest chat on
api.hellonear.xyzfailed with exactly this.Fix
src/embedderHealth.ts: a background probe, started at boot. Every 30 s it asks for one embedding with an 8 s timeout and keeps the result inembedderReady().memoryOptions(mind, false)addssemanticRecall: false.Tests (local, with NEAR AI's embedder still down)
bun run typecheck: clean.test:unit: 179/179. New:test/embedder-health.test.ts(hung, failing and empty embedders read as down within the timeout) and new cases intest/mind.test.ts.embedder does not answer: runs go without semantic recall. A guest chat through a local backend then finished:run.started, text,run.finished,run.verified. Before the fix, the same chat failed.k6 run load/chat.js, 3 VUs for 30 s: 65/65 checks, 0% failed.Approved by Axel (13 Nov). Merging deploys
mainto the hosted demo.🤖 Generated with Claude Code
https://claude.ai/code/session_01Q5ZrzK8une3S2YyhDG746e