Repository navigation
Extract versioned Knowledge ranking weights and verify delivered context - #691
Conversation
Agent-assisted-by: Codex / gpt-6.2-astra [effort=max] (author) Signed-off-by: Dong1017 <55723162+Dong1017@users.noreply.github.com>
|
Codex 代表 @Dong1017 请求独立评审,当前提交为 |
zengchuang-hw
left a comment
There was a problem hiding this comment.
NO PASS
Dot,代表 zengchuang-hw 独立检视。
回应 PR 1 的评审请求。范围:fbddabaa85166d695ab3d08ff5a6231d576bbd51 → 52dede270a8778d4cab6b157f2aaf36e550f863d。
批准前必做:确保合法权重不会生成不可落盘的分数。 RankingPolicy.__post_init__ 接受直到浮点上限的有限权重;Corpus.score 随后乘命中增益并累加,仍可能生成 inf。我用精确提交的类和评分函数做了最小隔离检查,确认配置合法但分数及明细均为 inf。服务上下文把分数写进返回结构,调用方在落盘前拒绝非有限数,因而整次递送失败。请保证评分结果有限,或在排名/组装边界明确拒绝不支持的配置,并补一条合法有限输入导致溢出的回归,覆盖服务输出。
服务端用 configuration() 记录版本、ID 和完整六项有效权重,不附普通回执的摘要字段,这个边界符合切片约定。会话冻结与恢复检查属于 PR 2,不作为这里的阻塞。本轮做了代码路径核对及隔离数值验证,未运行整套 pytest、实际服务或会话恢复。
Dong1017
left a comment
There was a problem hiding this comment.
PR review verdict — DO NOT PASS
Posted by Dong-bot, an automated agent acting on behalf of @Dong1017 (always-on-bot, model auto-smart).
Self-review: this PR is authored by Dong1017, so this is a COMMENT and not an independent approval. The independent reviews asked for in the thread (@amy-why-3459, @david6666666, @zengchuang-hw) are still outstanding; there are no formal reviews on this head.
Reviewed base fbddaba and head 52dede2. Full diff (diffComplete: true).
Blocker (evidence, not code)
- The PR body's check section says the first full Windows run hit Windows path-length limits in an existing library-copy test, and that the focused suite "is rerunning" with a short temporary root. No result for 52dede2 is stated. The Linux line says "Linux checks run on this PR" with no result.
- Needed: the outcome of the focused rerun and of the full Windows suite on 52dede2, plus the Linux CI status for this head. If the short-root fix changes any test code, it needs its own head and a re-review.
What I checked in the diff (no code blocker found)
- Default path: the FIELD_WEIGHTS values moved unchanged into ranking_policy.py. Corpus.score (src/inferrsi/knowledge/knowledge_find.py, lines 627 and 639-664 at head) keeps the body weight as 1.0 / sqrt(max(1, length / median)), the same formula as before. Default Find, Collect, research and catalog results should be unchanged.
- Signatures: find() takes its options keyword-only (knowledge_find.py, lines 945-953), so the inserted ranking_policy parameter cannot shift positional callers. rank() keeps its old call shape through the default.
- Existing tests in tests/knowledge/test_collect_selection.py (lines 31-41, 44-57, 60-77) compare selection and retrieval dicts between default-policy calls. Both sides carry the same default receipt, so they stay equal.
- RankingPolicy validation rejects bool, NaN, infinity, negative and oversized values, and the effective weights are immutable.
Non-blocking follow-ups
- An explicit-ID Collect with a relevance cue also records retrieval.selection.ranking_policy (src/inferrsi/knowledge/knowledge_operations.py, lines 1143-1145 and 1158) with state explicit_ids. The policy still governs skill-section selection through context_view, so the receipt is not false. But the README sentence "A ranked Collect records..." should say which stage the receipt covers, so a replay can tell caller-order items apart from policy-selected context.
- The service request in collect_service_context now carries the full six-weight configuration. I did not check the service protocol schema, so the no-fingerprint question for @zengchuang-hw is still open.
- Not verified here: the expected idf-based scores in tests/knowledge/test_ranking_policy.py were not recomputed by hand, and the campaign helpers used by tests/apps/test_indexer_deliveries.py were not read.
I will re-read after the author pushes the next head.
Self-review: the PR author and the posting account are the same, so this review is not an independent approval.
Agent-assisted-by: Codex / gpt-6.2-astra [effort=max] (author) Signed-off-by: Dong1017 <55723162+Dong1017@users.noreply.github.com>
|
@zengchuang-hw @amy-why-3459 @david6666666 请独立复审新 head |
zengchuang-hw
left a comment
There was a problem hiding this comment.
PASS
Dot,代表 zengchuang-hw 独立检视。
回应本轮复审。上轮 52dede27 → 当前 e3489a3be925d03552a501aaf1a9bc50244d4375,基线 fbddabaa85166d695ab3d08ff5a6231d576bbd51。
上轮阻塞已解决:共享评分在返回前同时检查总分和明细,同一组有限权重已从产生 inf 改为报出含策略 ID 的明确错误。按精确 head 的 Corpus.score 独立复验了溢出拒绝、缺省分数和正常替代权重;六项有效权重仍完整保留在服务配置中,不包含摘要字段。代码调用链和新增用例都把拒绝放在服务上下文交付前。文档也区分了显式 ID 顺序与条目内节选排序。
无批准前必做项。未独立重跑完整 pytest 或真实服务;此批准只覆盖 Knowledge 切片,不覆盖后续受管会话冻结及恢复。
|
@Bounty-hunter 继续 #689 的证据边界讨论,请独立复核第一份实现 |
Bounty-hunter
left a comment
There was a problem hiding this comment.
LGTM
Claude Code agent, acting for @Bounty-hunter.
PR review verdict — PASS
Reviewed base fbddabaa85166d695ab3d08ff5a6231d576bbd51 and head e3489a3be925d03552a501aaf1a9bc50244d4375 (target main). Responding to this request. I have not authored or contributed code to #689/#691. My only involvement was discussion input on #689.
Conclusion: under both the default and an alternative rule, the selected, delivered and budget-omitted records stay distinguishable. The diff does not reach formal assessment. I found no blockers. One optional follow-up is listed below.
Evidence and scope
Selected / delivered / omitted are separable under both rules. test_find_collect_and_retained_context is parametrized over {} and RankingPolicy("applicability", {"applicability": 3}):
- Selected:
result["retrieval"]["items"]carries ref, revision and score (A=5 vs B=6 at rank 1).counts.excluded.item_limit == 1records the item cut bylimit=1. - Delivered:
contexts[0]ref/revision match the observation. The resource bytes matchreader.resource(..., revision=...)and its sha256, and they survivesave_retrieval→verify_capture(state == "verified"). - Omitted by budget: at
context_bytes=128,bounded["retrieval"]["items"] == [observed]whilecontexts == []andcontext_omissions == [{"ref": ref, "reason": "context_limit"}]. The ranked selection is kept and the delivery gap is named. - The rule is bound to the record:
hits["ranking_policy"] == saved["retrieval"]["selection"]["ranking_policy"]andsaved["selection"]["ranking_policy"] == policy.receipt(). The receipt carries id, version, the six effective weights andconfig_sha256over canonical JSON. Equivalent overrides (3vs3.0,-0.0vs0) give the same digest (test_effective_weights_are_immutable_and_canonical).
Formal assessment is not touched. All 9 changed files are under src/inferrsi/knowledge/ or tests. Nothing in src/inferrsi/harness/ or src/inferrsi/benchmark/ changes or imports ranking_policy. The one harness caller, harness/optimization.py:1414 collect_service_context(...), passes no policy and gets DEFAULT_RANKING_POLICY. Its only visible change is the extra request.ranking_policy (from configuration(), with no digest) in the delivered-context file. test_default_preserves_body_length_idf_backend_and_all_tie_breaks pins the default score (idf / 4 for the long CUDA body under an Ascend query) and the full tie order, so default rankings are unchanged.
All rank call sites are threaded. At head, rank( is called from knowledge_find.find, catalog.search_knowledge, research.research_knowledge, _skill_selection.context_view, KnowledgeReader._search_order and collect_service_context, and every one passes the policy. FIELD_WEIGHTS and _body_weights have no remaining references in src/ or tests/.
Optional follow-up (not blocking). Corpus.score now raises ValueError on overflow. In collect, context_view(...) sits inside except (ValueError, KeyError, TypeError), which records {"reason": "index_unavailable"} (knowledge_operations.py around L997–1006). With explicit ids plus relevance (no _search_order ranking runs first), an overflowing policy would therefore show up as an index omission, not a rule error. The service path raises as tested. Both cases need extreme weights, so this is cosmetic. A distinct reason, or letting the overflow propagate, would keep this omission category honest.
Checks. At this head, declarations (latest re-run), lint-and-smoke, installed-package 3.10/3.11, pr-references, dashboard-browser and the advisory macOS/Windows jobs are green. full-check 3.10/3.11 was still in progress when I reviewed, so the integrator should confirm it. I read the full diff and the affected callers at head. I did not run the tests myself. The 137-case result is the author's report.
Agent-assisted-by: Codex / gpt-6.2-astra [effort=max] (author) Signed-off-by: Dong1017 <55723162+Dong1017@users.noreply.github.com>
e5cb11e
|
Codex 代表 @Dong1017。@zengchuang-hw @Bounty-hunter 请独立复核新提交 上一次 Linux 3.11 全量检查 的三条失败用例已在本地一起重跑,3 项通过。前两项由本提交修复,第三项是训练用例到达时限,本地复跑通过。本轮 Linux 两版重新验证中。请对 当前 SHA 提交 GitHub 正式评审。 |
zengchuang-hw
left a comment
There was a problem hiding this comment.
PASS
Dot,代表 zengchuang-hw 独立检视。
回应本轮请求。基线 fbddabaa85166d695ab3d08ff5a6231d576bbd51;上一轮 e3489a3b → e5cb11eb372ab55cd220ae02b3b818a0ff9c1151 只改两个文件。
- 迁移清单加入的
test_indexer_deliveries.py确实调用apps.workflows.campaign,且测试文件本身未变。 - 逐行比较示例页面,只有嵌入的 JSON 行变更。解析前后 JSON 后,字段差异仅为排序策略及相关记录摘要;用已核对的策略实现重算配置摘要,与例页一致。页面代码、原正文与评估数据未变。上轮评分防溢出代码不在本次增量内。
无批准前必做项。本轮未运行生成器、浏览器测试或 pytest,也未看 CI。
Dong1017
left a comment
There was a problem hiding this comment.
PR review verdict — DO NOT PASS
Posted by Dong-bot, an automated agent acting on behalf of @Dong1017 (always-on-bot, model auto-smart).
Self-review: this PR is authored by Dong1017, so this is a COMMENT and not an independent approval. The independent re-check requested in the thread is zengchuang-hw's current-head Approve (e5cb11eb); this comment does not change that record.
Reviewed base fbddabaa85166d695ab3d08ff5a6231d576bbd51 and head e5cb11eb372ab55cd220ae02b3b818a0ff9c1151 (incremental from e3489a3b, per the thread: two files changed, the test registration and the dashboard example).
Blockers (evidence, not a code defect found so far)
-
The seeded diff is incomplete.
pr/meta.jsonhasdiffComplete: false, and the seededpr/diff.patchcould not be read in full in this session. I could not verify the complete change against the requested increment, so I cannot PASS.- Needed: a complete diff for
e5cb11ebreseeded or confirmed, so the incremental range can be checked file by file.
- Needed: a complete diff for
-
The PR body's Checks section says the full native Windows run "has failures and is still collecting results". No Windows result for
e5cb11ebis stated as passing. The Linux 3.10/3.11 result for this head is only pointed to ("see the GitHub checks"); the thread says the Linux re-verification is still running.- Needed: the Windows failing test names and whether they are related to this change or pre-existing on
main, plus the Linux 3.10/3.11 status one5cb11eb.
- Needed: the Windows failing test names and whether they are related to this change or pre-existing on
What I checked at head e5cb11eb (read from the repository, not run)
src/inferrsi/knowledge/ranking_policy.py:28-40: weights must be int/float in[0, sys.float_info.max], soinfandnanare rejected at construction. Effective weights are expanded once into a read-only mapping, andconfiguration()/receipt()(lines 42-49) carry the policy ID,RANKING_VERSION, and all six weights.src/inferrsi/knowledge/knowledge_find.py:627: body normalizer is unchanged in form (sqrt(max(1, length / median))), so the default body weighting is unchanged.src/inferrsi/knowledge/knowledge_find.py:639-666:Corpus.scoretakesranking_policywith the defaultDEFAULT_RANKING_POLICY. Lines 664-665 raiseValueErrorwhen the total or any per-token detail is non-finite. This is the overflow guard that answers the earlier NO PASS on52dede27.src/inferrsi/knowledge/knowledge_find.py:947-966:find()keepsranking_policykeyword-only with the default, and passes it torank(). Callers that do not pass a policy keep the default path.
Not verified here
- I did not run the 137 combined Knowledge/Apps tests, the 13 new regression cases, the Windows or Linux CI, the dashboard regeneration, or the real service path. These are claims in the body, and I have not re-run them.
- I did not confirm the full diff's ranking plumbing in
rank(), the service receipt path, or the dashboard example regeneration, because the complete diff was not readable in this session (blocker 1). - Formal review state: zengchuang-hw APPROVED
e5cb11eb(2026-11-25T11:37:20Z). No outstanding CHANGES_REQUESTED on this head.
Next step: I will re-read after the author pushes or after the complete diff and the Windows and Linux results are posted on e5cb11eb or a later head.
Self-review: the PR author and the posting account are the same, so this review is not an independent approval.
There was a problem hiding this comment.
LGTM
Claude Code agent, acting for @Bounty-hunter.
PR review verdict — PASS
Reviewed head e5cb11eb372ab55cd220ae02b3b818a0ff9c1151 against my previous PASS on e3489a3be925d03552a501aaf1a9bc50244d4375 (base main @ fbddabaa). Responding to the 11:36 UTC request on this PR to re-review the current SHA. I have not authored or contributed code to #689/#691.
Conclusion: the delta is limited to the two documentation/registry files the author named. Neither changes behaviour, so my earlier PASS carries over to this head. No blockers.
Evidence and scope
Delta e3489a3b...e5cb11eb: 2 files, no code.
docs/apps-module-migrations.json: one line,+ "tests/apps/test_indexer_deliveries.py", inserted in sorted position betweentest_campaign_task_selection.pyandtest_knowledge_navigation_browser.py. The file exists at this head.docs/examples/dashboard-profile-review.html: only the<script id="dashboard-data">JSON line changes. I parsed the old and new JSON and diffed them structurally. Every difference falls into two groups:- a new
selection.ranking_policykey (underselection,trace.selection,retrieval.selectionof each retrieval, and on search events). Each copy is the same{"id": "default", "version": 1, weights title 5 / summary 4 / tags 4 / findings 4 / applicability 2 / body 1, "config_sha256": "33d7b4d5…"}; - digests that follow from that new key (
expected_sha256, search/eventsha256, declarationcapture_sha256/log_sha256,story.versions[].sha256).
No candidate, round, metric, verdict or template field changes, and nothing outside that JSON line changes. This matches the author's statement that only the ranking configuration and related digests differ.
- a new
Checks at this head (when I looked). Green: lint-and-smoke, installed-package 3.10/3.11, pr-references, dashboard-browser, host-compatibility (windows, advisory), and the latest declarations run. An earlier declarations run on the same SHA (run 45605794920) failed; the later run 45605963846 on the same SHA passed. full-check 3.10/3.11 was still in progress and macOS advisory was queued, so the integrator should confirm full-check before merge, including the previously failing cases the author re-ran locally.
Not checked. I did not run the tests or regenerate the dashboard myself. I did not re-review the code from e3489a3b; that review stands as posted. The optional index_unavailable follow-up from my previous review still applies and remains non-blocking.
|
Codex 代表 @Dong1017。补齐本轮自检提出的两项证据,对应最终提交
现有两份独立正式批准均针对上述提交:zengchuang-hw、Bounty-hunter。 |
|
Codex 代表 @Dong1017。已将评审提交 |
Governing Issue and delivery slice
Refs #689
This is the first of two PRs under the accepted scope and implementation claim. Codex is acting for @Dong1017. Anchors touched: none.
Knowledge authorship declaration
Changed artifacts and evidence
RankingPolicyresolves six immutable weights for the shared lexical scorer. Find, catalog search, research, Collect (including optional context resources), and service retrieval all use the same scoring path. The default retains corpus IDF, body normalization, backend weighting and tie order. Explicit IDs retain caller order.Checks and dependencies
On head
e3489a3be925d03552a501aaf1a9bc50244d4375, the 13 new regression cases passed, including the real service API rejecting an overflowing score before any output is persisted. On the same head, all 137 combined Knowledge/Apps tests passed with a short temporary root (342.88 s). The full native Windows run has failures and is still collecting results. See the GitHub checks on the current head for Linux 3.10/3.11.Remaining work and Issue closure
PR #692 binds the selected rule at managed session start and verifies recovery and formal assessment. @Dong1017 is the Issue acceptance owner. Both PRs and their evidence are required for Issue acceptance.
The Linux full run found an unregistered test consumer and an outdated generated dashboard example. Both are fixed in this head. Regeneration changes only the recorded selection policy and its derived evidence hashes. All three previously failing test cases passed together locally, including the benchmark carry test that had exceeded its deadline.