Skip to content

fix(retriever): PR746 signal extraction + useLightweightAutoRecall#779

Closed
jlin53882 wants to merge 3 commits into
CortexReach:masterfrom
jlin53882:james/pr746-clean-v2
Closed

fix(retriever): PR746 signal extraction + useLightweightAutoRecall#779
jlin53882 wants to merge 3 commits into
CortexReach:masterfrom
jlin53882:james/pr746-clean-v2

Conversation

@jlin53882
Copy link
Copy Markdown
Contributor

Summary

Fix PR746: thread AbortSignal through retrieval pipeline and use BM25-only for auto-recall source.

Changes

  • signal parameter: Add signal?: AbortSignal to RetrievalContext interface
  • useLightweightAutoRecall: When source === "auto-recall", use BM25-only mode (lightweight, no embedding cost)
  • mode variable: Declare mode once in retrieve() / retrieveWithTrace() and reuse in trace finalization (previously declared twice)
  • Unit tests: test/retriever-auto-recall-signal.test.mjs with 7 test cases

Test Registration

  • test/retriever-auto-recall-signal.test.mjs registered in scripts/ci-test-manifest.mjs (core-regression group)

Closes #746

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 279289c444

ℹ️ 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".

Comment thread src/retriever.ts

if (tagTokens.length > 0) {
if (tagTokens.length > 0 || useLightweightAutoRecall) {
mode = "bm25";
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Declare trace-mode state before assigning it

When retrieveWithTrace is called in any branch (including the new source: "auto-recall" path used by the added test), this assignment writes to mode before it has been declared; because the package is an ES module, that raises ReferenceError before the search runs. The subsequent calls also pass an undeclared diagnostics, so the memory_debug trace path cannot return results until this method gets its own mode declaration and either creates diagnostics or stops passing it.

Useful? React with 👍 / 👎.

Comment thread src/retriever.ts
category,
trace,
diagnostics,
query, safeLimit, scopeFilter, category, trace, diagnostics, signal,
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Thread the abort signal into the retrieval helpers

For manual/CLI retrieval in vector mode or stores without FTS, this new signal argument is passed to vectorOnlyRetrieval, but that helper still only accepts parameters through diagnostics and calls this.embedder.embedQuery(query) without a signal. At runtime the extra argument is ignored, so an aborted RetrievalContext.signal does not cancel the embedding request on these paths; the same mismatch exists for the hybrid helper below.

Useful? React with 👍 / 👎.

PR 739 重建(原本 PR 有 merge conflict):
- 新增 src/redis-lock.ts(340行)
  - dynamic import 避免 ioredis 未安裝時 crash
  - RedisUnavailableError + Symbol.for marker(跨 module ESM-safe)
  - isRedisConnectionError 含 wrapped error 遞迴檢查
  - parseRedisUrl() 正確解析 URL(含密碼、DB selection)
  - RedisLockManager + createRedisLockManager 工廠
  - dbPath hash namespace 避免跨 store lock interference

- 修改 src/store.ts(+50行)
  - import RedisLockManager/createRedisLockManager/RedisUnavailableError
  - runWithFileLock() 新增 Redis lock 優先實作
  - runWithFileLockCore() 保留既有 file lock 實作
  - getRedisLockManager() 模組層級 cache(Option E)
  - 修正 CortexReach#670:realpath:false 避免 stale lock cleanup 造成 ENOENT

- 新增 3 個測試檔(40 個測試,全部通過)
  - test/redis-lock-error-types.test.mjs
  - test/redis-lock-url-parse.test.mjs
  - test/redis-lock-concurrent-init.test.mjs

- package.json:新增 ioredis devDependency

注意:batch accumulator(CortexReach#690)完整保留,不受影響。
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant