fix(runtime): race/timeout hardening — recall abort, profile backup-swap, sandbox, SQLITE_BUSY#462
Conversation
…wap, sandbox traversal, gateway_stop SQLITE_BUSY
|
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 splitting this runtime hardening work. I verified the PR patch locally by applying it to its base commit and running:
pnpm test— passed: 4 files, 67 testspnpm build— passedgit diff --check --cached— passed
However, the recall abort fix is incomplete as a standalone PR. performAutoRecall() now creates an AbortController and passes the signal through searchMemories(), but this PR does not update src/core/store/embedding.ts: EmbeddingCallOptions still has no abortSignal field, and the embedding HTTP request path does not combine or use that signal. Because the object literal uses a conditional spread, TypeScript still builds, but at runtime the extra abortSignal option is ignored by the current embedding services. So the documented behavior — recall timeout aborts the in-flight embedding request — does not actually take effect in this PR by itself.
Please either include the embedding-layer wiring in this PR, or make this PR explicitly depend on/stack after the storage/embedding PR that adds EmbeddingCallOptions.abortSignal and passes it to fetch. Once the abort signal reaches the actual fetch call, the rest of the timeout propagation shape here looks reasonable.
Addresses YOMXXX review comment on PR TencentCloud#462: - Add abortSignal field to EmbeddingCallOptions interface - postEmbeddingRequest now accepts callerSignal and combines it with internal timeout via addEventListener('abort') - Thread abortSignal through OpenAIEmbeddingService and ZeroEntropyEmbeddingService (embedBatch -> _callApi -> postEmbeddingRequest) - Check callerSignal.aborted before each retry to avoid wasted attempts - Check abortSignal.aborted between sub-batches in embedBatch Before this fix, auto-recall's AbortController.abort() did not reach the actual fetch() call, so recall timeout could not cancel in-flight embedding HTTP requests. Now the signal chain is complete: performAutoRecall -> searchMemories -> embeddingService.embed -> _callApi -> postEmbeddingRequest -> fetch(signal).
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)验证