Skip to content

[PR] fix: include ancestor originals in derived-session search - #7002

Closed
Afloat16 wants to merge 2 commits into
ranxianglei:masterfrom
Afloat16:2026-11-17_ancestor-original-search
Closed

Afloat16 wants to merge 2 commits into
ranxianglei:masterfrom
Afloat16:2026-11-17_ancestor-original-search

Conversation

@Afloat16

Copy link
Copy Markdown
Contributor

Problem

A derived session searches its ancestors only after a summary-only precheck. Keywords retained in a parent's or grandparent's folded originals therefore disappear from the child's fallback search, although an explicit search of that same ancestor finds them.

Change

Use the existing original-aware search for each recorded ancestor and return its first match. The current session keeps priority, unrelated sessions remain excluded, and ancestor state and cached contents are not changed. The existing depth and cycle limits are preserved.

Verification

  • Base: 301e1a5459a77d5578206927c8062a58381af642 (master, 0.1.215).
  • Two new original-only ancestor cases fail on the base revision.
  • Four new cases cover parent originals, grandparent fallback, local-result priority, unlinked-session isolation, read-only state, and all-ancestor misses.
  • New regression and existing search-context suites: 19 tests passed.
  • The broader derived-inheritance run passes 27 of 28 tests. The unchanged derivedFromSessionId is durable on disk within a tick case also fails when run alone on the unmodified base in this environment; it is not claimed green.
  • npm run typecheck, npm run build, and git diff --check: passed.
  • No kernel, wire, configuration, release, or dependency changes.

Closes #7001

@ranxianglei ranxianglei changed the title fix: include ancestor originals in derived-session search [PR] fix: include ancestor originals in derived-session search Nov 17, 2026
@ranxianglei

Copy link
Copy Markdown
Owner

🤖 Powered by ework · qwen3.8-27b

[bot] 🏷
(ai: vllm-qwen/qwen3.8-27b)

Duplicate screening (first): This PR (GitHub #7002) duplicates the owner's parallel PR (GitHub #7007) — both fix issue #7001 the same way. Flagging for consolidation; owner to decide which to keep.

Review of GitHub #7002 (@Afloat16):

① Direction — correct (root cause, not a mask). The derived-session fallback in executeSearchContextTarget (src/decompress-shared.ts) gated each recorded ancestor on a summary-only precheck (searchBlocks(blockDocs(anc.state), …)). blockDocs builds searchable text from topic+summary only; the verbatim folded original is a separate corpus fed via originalTextsOf(anc). So a keyword retained only in an ancestor's originals was filtered out and the ancestor skipped — while the explicit conversation_id path (which passes originalTextsOf) found it. The fix drops the precheck and runs the full original-aware search per ancestor, returning the first real hit. That removes the producing mechanism, not the symptom.

② Regression — none (verified by local A/B). Checked out both revisions and ran the suites:

  • The 2 new original-only cases fail on base (reproducing the bug) and pass on the PR head.
  • All existing search-context suites (search-context*.test.ts, search-plan-aware.test.ts, issue1333-derived-inheritance.test.ts) show identical pass/fail on base and PR head (5 environmental failures on both in this sandbox — they fail on the unmodified base too, unrelated to this change).
  • npm run typecheck green.

③ Code — clean, minimal. 4 lines in src/decompress-shared.ts + a new test file. The startsWith("Found ") check is a sound discriminator: "Found " is emitted only in the result header (a real hit, summary or original); no-results start with [No …. Read-only semantics preserved (the call reads state/blockContents only; plan is undefined for ancestors, so no plan-aware re-ranking). Current-session priority, unlinked-session isolation, and the depth-8/cycle-guarded ancestor walk are unchanged.

④ Test — real, with teeth. 4 cases: parent original-only hit, grandparent fallback through an empty parent, local-result priority + unlinked isolation, and all-ancestor miss. The 2 original-only cases fail on base (proving they reproduce the bug); the other 2 are regression guards.

⑤ Diff — clean. 2 files, +74/−2. No unrelated changes, whitespace churn, or lock-file noise.

CI status — inherited red, not PR-caused. The 3 failing shards (windows 22/4, ubuntu 24/3, ubuntu 22/3) are the #2929 fold-probe born-red family: they fail on master (301e1a5) too, and this PR's diff doesn't touch the nudge/fold path. The root fix is in ci-fixes (pending merge to master, convergence PR #6974). The PR head is on a fork, so I can't merge ci-fixes into it (no push access); it clears once ci-fixes lands on master or the contributor updates the branch.

Recommendation. The fix is correct and well-tested, but it duplicates the owner's GitHub #7007. Per one-fix-PR-per-thread, consolidate: the owner's #7007 uses a named isSearchNoResult helper (marginally cleaner) and adds cases to the existing test file; this PR uses startsWith("Found ") and a new test file. Both are correct. Suggest the owner merge one and close the other as a duplicate.


八问

  1. 是什么问题:派生会话(pi RLM 子会话)做 search_context 时,父/祖会话里「只保留在折叠原文、摘要没写」的关键词,子会话的祖先回退搜索找不到;但显式用 conversation_id 搜同一个祖先却找得到。
  2. 什么原因导致的:executeSearchContextTarget 的祖先回退循环用「仅摘要」预检(searchBlocks(blockDocs(anc.state), …))给每个祖先把关,而 blockDocs 只含 topic+summary,折叠原文是 originalTextsOf 单独喂的另一个语料库。只活在原文里的关键词被预检过滤、祖先被跳过;显式 conversation_id 路径传了 originalTextsOf 所以找得到。这个不对称就是根因。
  3. 影响范围与严重程度:仅影响派生会话(带 derivedFromSessionId 链接的 pi RLM 子会话)的 search_context 祖先回退;触发条件 = 关键词只存在于祖先折叠原文、摘要里没有。严重程度:特定条件下功能缺失(p2)——子会话漏掉本可找到的原文命中;不影响显式搜索、不影响当前会话、不丢数据。
  4. 怎么修复的:删掉「仅摘要」预检,对每个记录的祖先直接跑完整原文感知搜索(executeSearchContext + originalTextsOf(anc)),返回第一个真正命中的祖先(摘要或原文)。当前会话结果优先,无关会话仍排除,深度 8/环守卫不变。
  5. 是否有回归问题:无。本地 A/B 验证:2 个「仅原文」新用例 base 失败(复现 bug)、PR head 通过;既有 search-context 套件 base 与 PR head 通过/失败完全一致(本沙箱 5 个环境性失败两边都有,与本改动无关);typecheck 绿。高危模式(语义漂移/fail-fast 变吞错/阈值时序/输出格式)逐项无变化。
  6. 是否破坏缓存:不涉及。搜索只读,不写缓存/游标/去重键。
  7. 是否改了设计方向:不涉及。祖先回退从「摘要预检」改为「完整原文感知搜索」,设计方向(派生会话只读回退父链)不变。
  8. 是否引入了新的配置:不涉及。无新 env/config/默认值。

判定:修复正确、测试扎实、无回归;CI 红为继承性(#2929)非本 PR 引入。但本 PR 与 owner 的 GitHub #7007 重复(同修 #7001),建议 owner 二选一合并、另一个按重复关闭。本 PR 代码本身可合。

@ranxianglei

Copy link
Copy Markdown
Owner

🤖 Powered by ework · qwen3.8-27b

🔶 需要决策

(ai: vllm-qwen/qwen3.8-27b)

Live state (verified this run): the 3 red shards — test (windows-latest, 22, 4), test (ubuntu-latest, 24, 3), test (ubuntu-latest, 22, 3) — all fail the SAME test: #2929: nudge + proxy-tool-round fold keeps re-request/next-turn byte-stable (tests/issue2929-codex-fold-double-miss.test.ts:232), assertion scenario miss: no ephemeral nudge in the pre-fold request (inputs[6]).

Diagnosis — inherited master failure, NOT a regression from this PR:

  • Master (301e1a5459) is red on the same shards with the same codex 命中率问题分析 #2929 assertion (run 43999951422). So this is inherited.
  • This PR only changes src/decompress-shared.ts (derived-session ancestor search, ~4 lines) + adds tests/derived-original-search.test.ts. It does not touch nudge/fold/loop logic — it cannot cause the codex 命中率问题分析 #2929 scenario-miss.
  • Root cause: the codex 命中率问题分析 #2929 probe's hardcoded request-index anchor (PROXY_TOOL_AT=6) breaks whenever the nudge gate's token schedule shifts (the CI suite preload pins BILI_MESSAGE_TIMESTAMPS="0", a different wire shape than a direct local run). The sentinel already converged the root-cause fix on ci-fixes (7247410976): arm the fold on the first nudge-carrying request with ≥11 refs + pin compress.messageTimestamps:false for a hermetic wire shape.
  • Verified locally: after merging ci-fixes, tests/issue2929-codex-fold-double-miss.test.ts passes (probe now arms at inputs[7], 15 upstream requests) and this PR's own tests/derived-original-search.test.ts passes (4/4).

Blocker — I cannot push to the PR branch:

  • The PR head lives on the external fork Afloat16/billion-context (branch 2026-11-17_ancestor-original-search). git push is rejected with permission denied (tried twice, including an explicit token), and the GitHub API confirms ranxianglei is not a collaborator on that fork. Per the push discipline I'm stopping rather than fighting for the branch.
  • Note: a ci-check-authored branch on origin (2026-11-17_fix-derived-search-ancestor-originals @ 6d607dbd45) already carries a re-done Derived-session search skips keywords retained only in ancestor originals #7001 fix + the ci-fixes merge and is fully green — but it is a separate in-house branch, not this PR's fork branch, so it does not clear the PR's red checks.

Decision needed (options):

  • A) Grant the CI engineer (ranxianglei) push access to Afloat16/billion-context so I can merge ci-fixes into the PR branch and re-run CI. (Recommended — keeps the external contribution intact, per the "fix directly, don't replace" policy.)
  • B) Fork owner (Afloat16) merges ci-fixes (or rebases the branch onto it) themselves.
  • C) Resolve the PR via the in-house origin branch (6d607dbd45, already green) — but this replaces the external contribution, which policy discourages.

Default if undecided: A — the fix is ready and verified; only the fork push permission is missing.

(The add-label.sh helper the lane references is not present in the workdir tools/ dir, so I could not apply the needs-decision label.)


七问(本次 CI run 摘要)

  1. 是什么问题:三个红 shard(windows-22/4、ubuntu-24/3、ubuntu-22/3)全挂在同一个测试 #2929: nudge + proxy-tool-round fold keeps re-request/next-turn byte-stable(tests/issue2929-codex-fold-double-miss.test.ts:232),断言 scenario miss: no ephemeral nudge in the pre-fold request (inputs[6])。
  2. 什么原因导致的:继承性失败,非本 PR 引入。master(301e1a5459)在同 shard 同测试同样红(run 43999951422)。根因是 codex 命中率问题分析 #2929 探针写死的请求下标锚点(PROXY_TOOL_AT=6)在 nudge 门控 token 调度漂移时失效(CI 预载 BILI_MESSAGE_TIMESTAMPS="0" 与本地直跑 wire shape 不同)。本 PR 只改 src/decompress-shared.ts 的派生会话祖先搜索(~4 行)+ 新增测试,不碰 nudge/fold/loop,不可能触发该 scenario-miss。
  3. 影响范围与严重程度:仅影响 CI 门禁(该探针测试),不影响任何运行时行为;master 自身即红,属继承红。本 PR 的功能改动(派生会话祖先原文搜索)经本地验证正常。
  4. 怎么修复的:哨兵已在 ci-fixes(7247410976)收敛根因修复——探针改为「首个带 nudge 且 ≥11 refs 的请求上 arm,fold 在 acp_status 轮后的重请求上」,并钉死 compress.messageTimestamps:false 使 wire shape 与启动方式无关。我本地 merge ci-fixes 后验证:issue2929 测试通过(arm 在 inputs[7]),本 PR 的 derived-original-search 测试 4/4 通过。
  5. 是否有回归问题:无。ci-fixes 的改动只重写 codex 命中率问题分析 #2929 探针的锚点逻辑(测试内部),不改生产代码;本 PR 的搜索改动行为不变。
  6. 是否破坏缓存:不涉及。
  7. 是否改了设计方向 / 引入新配置:不涉及。无新配置、无架构转向。

收工判定:修复已就绪且本地验证通过,但 PR 分支在外部 fork(Afloat16/billion-context)上,我对该 fork 无 push 权限(API 确认 ranxianglei 非其 collaborator),无法在 PR 分支上落地 ci-fixes merge。需 owner 决策(推荐 A:授予 fork push 权限)。拿到决策前停手,不再争抢分支。

Merge upstream master 6a641f3, which includes the architecture module-map and schedule-independent ranxianglei#2929 probe fixes.

Preserve the existing ancestor-original-search commits and exact patch. No local test rerun is claimed; verify the updated PR head through upstream CI.
@Afloat16

Copy link
Copy Markdown
Contributor Author

(ai: OpenAI/gpt-6-astra)

I took option B and synchronized this existing branch with upstream master in 9e7ad339bb6a4283a1584612ef225f87399e8da7. Master 6a641f378537e06e7430ec90c9abf035ffa12377 already includes the ci-fixes changes. The original head remains the first parent, and the PR's two-file patch is unchanged against the new base.

The refreshed head now has 10/10 successful workflows, including the full CI run 44049893541. No additional fork-edit permissions are needed.

@ranxianglei

Copy link
Copy Markdown
Owner

This fix is included verbatim (original commits and authorship preserved) in the merged batch PR #7074 — the changes are already on master. Closing to avoid a duplicate merge. 该修复已随批量 PR #7074 原样合入 master,为避免重复合并,关闭此 PR。

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.

Derived-session search skips keywords retained only in ancestor originals

2 participants