Repository navigation
Record local Read citations on service-reuse rounds - #1040
Conversation
A service-reuse round could not cite the Read receipt that shaped its hypothesis: `session round --knowledge-ref` was refused for every managed service action, and service-mode deliveries carried no reference epoch to prove when the material was read. Record the delivery epoch on service-mode knowledge contexts, accept a cited receipt only when it is a registered local Read of this session with a registered Find, a matching receipt entrypoint and a non-empty delivery, and require the receipt's epoch (and stage, when present) to match the session. Find receipts, other-session receipts, empty reads, unknown item fragments and stale receipts are refused before a round slot, pending record or attempt directory is created. The citation is stored on the attempt, survives into its `observation.json`, is listed by `session status`, and each retry records its own. It is provenance only and never reaches scoring. `service_load` verifies that every retained citation names a context in the attempt snapshot. The existing refusals for `--alternative`, `--selection-reason`, `session knowledge-read` and non-round actions are unchanged. Agent-assisted-by: Claude Code / claude-opus-5-5 [effort=xhigh] (author) Signed-off-by: Dong1017 <55723162+Dong1017@users.noreply.github.com>
Dong1017
left a comment
There was a problem hiding this comment.
PR review verdict — PASS
Posted by Dong-bot (review), an automated agent acting on behalf of @Dong1017 (always-on-bot, model auto-smart?optimize_for=balanced).
This is a self-review (role=review). The PR was opened by Dong1017, the same account that posts this review. It is a COMMENT and not an independent approval. The repository's two-independent-approval rule is unaffected.
Reviewed base 2dce45aa69591bc813aa7a1f2e8ba62e4e76ac23 and head 69cc3dd80177c97e5dec4a222eae4569464ed04f (PR #1040, full diff). pr/prior-reviews.md shows no formal reviews. There is no APPROVED review on this head and no outstanding CHANGES_REQUESTED. I did not read a governing issue. pr/meta.json links none.
What I verified by reading the code
_session.py: theknowledge_refrefusal is now skipped only whenrequest.action == "round". The--alternativeand--selection-reasonrefusals are unchanged._state.pyservice_command:knowledge_refon any action other thanroundis refused. Refs are validated againststatebefore the attempt directory is created orpendingis written (_validate_service_round_refscall, about L3527-3533). A rejected citation therefore leaves no round directory and no state change._validate_service_round_refsfails closed on each of these:- non-list or non-string refs, and duplicates;
- a path not registered in
state["contexts"]. This covers other sessions' receipts and traversal attempts, because the path must be a registered key; - a
kindother thandelivered_context(Find and external results); - a missing or unregistered
search_ref; - a
reference_epochthat differs from the current one, and astage_idmismatch when stages are in use; - a capture whose entrypoint is not
reador whosesearch_refdisagrees; - a capture with no delivered resource content;
- a
#itemthat the capture did not deliver.
_commit_knowledge: non-staged service-reuse deliveries now retainreference_epoch. Staged sessions already did. Theservice_modeassignment moved above its first use, which is behavior-neutral. The epoch comes fromticket.reference_epoch, which the function already checks equals the current epoch.- Recording:
pending["knowledge_refs"]is set per attempt, so a retry records its own citation._service_status_with_roundssurfaces the refs insession status._service_loadre-checks that each cited receipt appears unchanged in the attempt's context snapshot. - Docs:
docs/guides/operations.mdmatches the implemented behavior. It covers same session, current epoch, Find and stale refusal before launch, per-retry citation, and the epoch reset on refresh or stage switch. - Tests:
tests/apps/test_service_round_citations.pycovers the accept path, Find refusal, cross-session refusal, stale-after-refresh refusal, per-retry citations, the other declarations still refused,knowledge-readstill refused, and a unit-level pass over the validator's error branches. The refusal tests assert thatstate.jsonis unchanged and norounds/directory exists.
Non-blocking notes
- Service-reuse sessions retained before this change have no
reference_epochon non-staged contexts. Citing one of their receipts is refused with the "current reference epoch" message. That is fail-closed and the wording is slightly misleading. Re-reading the material fixes it. Check this if long-lived sessions matter. - I did not trace how
knowledge_refsflows frompendingintoobservation.jsonandlatest_observation. The new tests assert it, but I did not confirm it in the settle and observation-writing code.
Not verified here
- I did not run the tests or CI. I cannot run commands in this environment, and I did not check CI status.
- I did not exercise the staged-session path end to end. I only read the epoch and stage checks.
This review does not approve for merge or change scope. An independent reviewer still needs to provide the formal Approve.
Self-review: the PR author and the posting account are the same, so this review is not an independent approval.
zengchuang-hw
left a comment
There was a problem hiding this comment.
PASS
dot, acting for zengchuang-hw.
首次检视 head 69cc3dd80177c97e5dec4a222eae4569464ed04f,base 2dce45aa69591bc813aa7a1f2e8ba62e4e76ac23。按 #893 验证同会话、当前引用 epoch 的本地 Read 才可用于 round;Find、外部和过期引用会在创建 attempt 前被拒绝。合法引用记录到本轮 attempt、observation 及 status,重试保留各自引用,不改评分或排序。独立执行 9 项 CPU 用例通过,含 Git 工作树路径;未运行真实服务模型或查看 CI。
david6666666
left a comment
There was a problem hiding this comment.
Dot, acting for @david6666666.
PR review verdict — PASS(技术范围,非表决 COMMENT)。Base 2dce45aa → head 69cc3dd8。同 session/current epoch 的 Read 引用能在开 round 前核验,attempt 和 observation 留存一致;不改评分或排序。exact-head 五项必需 CI 已通过;另有 Zeng 独立的 9 项 CPU 用例,我这边做的是源码和 CI 核对,没有运行服务或设备。
74/100:范围 3/3;正确性 2/3(当前 CLI 帮助仍把该用法排除);验证 3/3(精确 CI 与独立 CPU);主张证据 N/A(无 campaign 性能主张);简洁度 0/3(新增解释性源码注释,按量表)。建议同步帮助。#913 是同范围候选之一,这条技术结论不是两案取舍或交付验收。
| Cite a used read's `reference.path` with `round --knowledge-ref` in a one-shot | ||
| project or benchmark. A service-reuse attempt retains prepared contexts | ||
| automatically. Record any passage that influenced the candidate in its | ||
| project or benchmark. A `service_reuse` round also accepts a local Read receipt |
There was a problem hiding this comment.
这里已经把 service-reuse 的同 session/current epoch Read 写进指南了,但同一提交的 session round --help 还写「benchmark or AB/BA」,并把 CANNBot 与本地 Read 并列。直接从 CLI 找入口的人会以为 service-reuse 仍不支持,或误用 CANNBot。建议同步 apps/cli/arguments.py,明确 service-reuse 仅接受本地 Read,并在 help 测试中卡住两种模式的区别。
|
Posted by Dong-bot (worker), an automated agent acting on behalf of @Dong1017 (always-on-bot, model claude-opus-5-5). The PR pool run stopped: git config --global --add safe.directory Its feedback is not marked handled: the next review or comment here starts a new revision (3 left). |
|
Please also adopt @david6666666's non-blocking point: mention the newly supported usage in the CLI help. This starts a revision on the current head; reviewers will be asked again after the push. |
`session round --knowledge-ref` now names what each mode accepts: a one-shot benchmark or AB/BA round takes a delivered path, path#item-ref or CANNBot read receipt, and a service-reuse round takes only a local Read receipt from the same session and the current reference epoch. A CLI help test pins both clauses, so the flag cannot drift back to a benchmark-only description. Agent-assisted-by: Claude Code / claude-opus-5-5 [effort=xhigh] (author) Signed-off-by: Dong1017 <55723162+Dong1017@users.noreply.github.com>
|
Posted by Dong-bot (worker), an automated agent acting on behalf of @Dong1017 (always-on-bot, model claude-opus-5-5). Revision:
|
amy-why-3459
left a comment
There was a problem hiding this comment.
LGTM
Codex, acting for @amy-why-3459.
PR review verdict — PASS
The service-reuse round now records local Read citations on the individual attempt. The CLI help also resolves the earlier documentation finding by stating which citations each round mode accepts.
Independent verification
I reviewed head 80a9109e4b7ac74faa591299b348d986c8197629 against base 2dce45aa69591bc813aa7a1f2e8ba62e4e76ac23 for the scope in #893. I traced citation validation before round admission, the pending record into the retained observation, the per-attempt context check on reload, and the latest-attempt summary in session status.
On Python 3.10 and 3.11 I created a real diagnosed session, ran Find and Read, and checked that the resulting current-epoch Read was accepted by the citation validator. Through the public CLI, a Find receipt was rejected at citation validation and a valid Read proceeded to the normal baseline prerequisite. The CLI also enforces the frozen runtime when resuming a session from a different build.
Both hosted full-check jobs passed for this head. Locally, ten citation/help and Read-range tests passed on each Python version. Eight service-backed cases stopped at baseline setup because this Mac returned a process-cleanup permission error; I confirmed the same failure on the unmodified base. I did not run a production service workload.
zengchuang-hw
left a comment
There was a problem hiding this comment.
PASS
dot, acting for zengchuang-hw.
回应复审提醒,从上轮 69cc3dd8到 80a9109e4b7ac74faa591299b348d986c8197629。本轮只改 --knowledge-ref CLI 帮助和测试;帮助区分一次性 benchmark/ABBA 的既有路径与 service-reuse 当前会话、当前 reference epoch 的本地 Read 收据,未扩大运行时准入。精确 head 独立跑了 10 项定向 CPU 测试,均通过;没有运行实际硬件服务或全库测试,不合并。
Governing Issue and delivery slice
Refs #893
rounds: accept a Read receipt from the same session and current reference
epoch, store it on the attempt, show it in session status, and add a CPU
regression test.
service_reuseround accepts a local Readreceipt only when it is retained by the same session, produced from a
registered Find, delivered resources, and belongs to the current reference
epoch (and stage, when the plan is staged). The normalized citation list is
stored on the attempt and in its
observation.json, listed bysession status, and each retry records its own._service_loadverifiesevery retained citation against the attempt's context snapshot. Find
receipts, other-session receipts, empty reads, unknown item fragments and
stale receipts are refused before a round slot, pending record or attempt
directory exists. The change also documents the behavior in the operation
guide.
no citation-driven score or ranking change, no reopening of the source
material, and no change to
--alternative,--selection-reason,session knowledge-reador non-round actions, which keep their existingrefusals.
Changed artifacts and evidence
src/inferrsi/harness/manager/_state.py(_validate_service_round_refs,service_command)session statusservice_commandpending record,_service_load,_service_status_with_roundsknowledge_refs; retry testsrc/inferrsi/harness/manager/_session.pyguarddocs/guides/operations.mdChecks and dependencies
python -m pytest tests/apps/test_service_round_citations.py::test_validate_service_round_refs_checks_receipt_identity -q— 1 passed. This is the git-free unit test of the new validator; it covers acceptance, unknown path, Find receipt, duplicate, unknown item fragment, stale epoch, unregistered Find and empty read.python -m pytest tests/apps/test_knowledge_read_ranges.py -q— 8 passed (related existing service knowledge validation).python -m ruff check src tests— all checks passed.tests/apps/test_service_round_citations.pycould not run in this container: there is nogitbinary, and theservice_reusefixture runsgit init/git commitwhileexecutor.service_revisionshells out to git. They error at fixture setup before touching the change; Linux CI is the authoritative run.pytestwas installed withSETUPTOOLS_SCM_PRETEND_VERSION_FOR_INFERRSI=0.0.0because this checkout has no.gitmetadata.Remaining work and Issue closure
file on Linux CI (accepted round citation, Find/other-session/stale refusal,
per-retry citations, unchanged non-
service_reusedeclarations).Handoff (only when an actual handoff or decision changed)
acceptance owner; implementer delegated.
on Linux CI.
Related work and process
Knowledge authorship declaration
Posted by Dong-bot (worker), an automated agent acting on behalf of @Dong1017 (always-on-bot, model claude-opus-5-5).