fix(core): storage hardening — Buffer safety, embedding abort, atomic instanceId#461
fix(core): storage hardening — Buffer safety, embedding abort, atomic instanceId#461rainforest888 wants to merge 2 commits into
Conversation
…t signal, instanceId atomic write
|
Thank you for your contribution! We will review your code and get back to you as soon as possible. |
YOMXXX
left a comment
There was a problem hiding this comment.
Thanks for the focused core hardening split. I verified the branch locally with:
pnpm test— passed: 4 files, 67 testspnpm build— passedgit diff --check HEAD~2..HEAD— passed- a local Float32Array subarray Buffer check — passed
I think this still needs one change before approval: the new EmbeddingCallOptions.abortSignal is wired into the embedding HTTP fetch, but the actual auto-recall timeout path does not pass an abort signal. performAutoRecall() still uses Promise.race with a timer that resolves after recall.timeoutMs; once that race resolves, performAutoRecallInner() and the embedding HTTP request can continue running until the embedding request's own timeout. With defaults, recall.timeoutMs is 5000ms while embedding.timeoutMs is 10000ms and embedding.recallTimeoutMs may be unset, so the PR does not fully deliver the documented "recall timeout aborts the in-flight embedding request" behavior.
Please create an AbortController for the recall timeout path and pass its signal through searchMemories() / EmbeddingCallOptions so the same timeout that skips memory injection also cancels the embedding fetch. The Buffer byteOffset/byteLength fixes and the instance-id in-flight guard look directionally good.
fix(offload): Tracing & Token Hardening
拆分自 #391,per YOMXXX review。
修复范围
聚焦
src/offload/层:token estimate、local LLM、Opik tracing。不涉及 store、runtime、gateway 层。具体修复
src/offload/fast-token-estimate.ts— Astral-平面 Token 修正i += 2),修正 ~2× token 高估src/offload/local-llm/index.ts— L1.5 Fallback 修正{taskCompleted: false, ...}— normalizeJudgment 把false当有效判断,永远不触发 "LLM 不可用" 重试{taskCompleted: null, ...},== null检查触发重试路径src/offload/opik-tracer.ts— ESM 兼容 + Trace 截断require("opik")为undefined,tracer 永久静默关闭createRequire(import.meta.url)验证