Repository navigation
Adapt Knowledge context to a Harness delivery draft - #446
Conversation
Signed-off-by: zengchuang <zengchuang3@huawei.com> Agent-assisted-by: Codex (author)
amy-why-3459
left a comment
There was a problem hiding this comment.
LGTM
PR review verdict — PASS
Reviewed base c2f463f066921a15120a3c86506c4f97b1909acb and head 35f24b61fe1517592995ade1f13a3956f12958c7 (single commit).
What I checked:
- Request validation in
src/inferrsi/apps/context_provider.pyL43-66 matchesContextRequestindocs/contracts/schemas/contract-v1.schema.json: exact field set,pinsasDefinitionRef {name, revision},max_bytesin theUIntrange,round_idagainst theIdpattern. Selection options are checked beforeKnowledgeReader.collectis called. - Pin mapping:
_revisionspassesname -> revisionintocollect(revisions=...), and conflicting pins are rejected up front. An unavailable pin becomes anunavailable_revisionomission and never falls back to the current revision (collectL677-681). - Byte accounting: each resource is checked against its
sha256, each block againstcontent_bytes, and the total againstmax_bytes. The draft digest covers exactly the concatenated bytes.max_bytes == 0skips assembly and recordscontext_limitomissions. - Output shape matches
DeliveredItem(pin {reference, revision}, deduplicateddelivered_roles,delivered_bytes) andErrorFact(code/stage/message/retryable) for omissions. - D023-3 boundary (
docs/contracts/p0a-contract-errata.mdL48-52): the draft is a process-local dataclass with noartifactand no write to Harness RunStore. Retention, sealing and the T38 fresh-process read stay with Harness and are tracked in #447. - All 8 checks on this head are green (full-check 3.10/3.11, installed-package 3.10/3.11, declarations, pr-references, dashboard-browser).
Optional, non-blocking: L72 takes selection from the top-level result["selection"] in relevance mode and from result["retrieval"]["selection"] otherwise, so state / tie_break are present only in explicit-id mode. Always using the retrieval observation would keep the draft's selection facts the same shape in both modes.
Signed-off-by: zengchuang <zengchuang3@huawei.com> Agent-assisted-by: Codex (author)
|
Thanks for the selection feedback. |
There was a problem hiding this comment.
LGTM
PR review verdict — PASS
Reviewed base c2f463f066921a15120a3c86506c4f97b1909acb and head 5c5be71f27007d456e7a278e1e5f4f2a9b034668.
Re-review after Amy Approve on 35f24b61 was dismissed. Prior optional selection-shape note is fixed: {**result.get("selection", {}), **result["retrieval"]["selection"]} now keeps relevance cue facts and always surfaces retrieval state / tie_break (asserted on the ranked path).
Verified:
- ContextRequest validation (exact fields, DefinitionRef pins, UInt max_bytes, Id round_id) before KnowledgeReader.collect
- Pin map name→revision with conflict rejection; unavailable pin → unavailable_revision, no current-revision fallback
- Byte accounting: per-resource sha256, block content_bytes, total ≤ max_bytes; draft digest over exact concatenated UTF-8 bytes
- DeliveredItem / ErrorFact shapes; no artifact on draft (D023-3 / V33); retention/T38 remains #447
- Local: 12/12
tests/test_apps_context_provider.py, ruff clean; CI on this head all success (full-check/installed-package 3.10+3.11, declarations, pr-references, dashboard-browser)
No blocking findings. Did not merge.
amy-why-3459
left a comment
There was a problem hiding this comment.
LGTM
PR review verdict — PASS
Incremental re-review: 35f24b61fe1517592995ade1f13a3956f12958c7...5c5be71f27007d456e7a278e1e5f4f2a9b034668 (base c2f463f066921a15120a3c86506c4f97b1909acb). My earlier approval on 35f24b61 was dismissed by this push.
src/inferrsi/apps/context_provider.pyL64:selectionis now{**result.get("selection", {}), **result["retrieval"]["selection"]}, sostate/tie_breakfrom the retrieval observation are present in both modes. The relevance-onlycue(andmatched_count/returned_counton the task path) is kept. In relevance mode the overlapping keys (method,scope,ranking_applied) take the same values from both sources, so letting retrieval win changes nothing. This resolves my optional note.tests/test_apps_context_provider.pyL87-88 now assertstate == "applied"andtie_break == "ref_ascending"on the ranked path.- No other changes in the delta. All 7 checks on this head are green (full-check 3.10/3.11, installed-package 3.10/3.11, declarations, pr-references, dashboard-browser).
Governing issue and delivery slice
Refs #371. Step 4, Apps side of D023-3 / V33. Accepted design and architecture acceptance.
ContextProvider.collectcalls the public Knowledge reader once. It passesDefinitionRef.name/revisionto Knowledge's revision resolver, preserves Knowledge's selection and omission facts, and returns only delivered item pins with resource roles and per-item byte totals. The draft payload is the selected UTF-8 resource bytes in Knowledge order, concatenated without display framing. The digest covers those exact bytes. The proposed location uses a hash of the round identifier for a safe relative path. Zero bytes yields an empty draft with budget omissions.The draft is an in-process value. Harness retains the bytes, seals the delivery reference, and writes its generation manifest once the retention route is wired. The production retention failure, commit, and fresh-process read for T38 remain open.
Checks
Review
Please check the pin mapping against the public Knowledge resolver, actual-byte accounting, and the Harness retention boundary. No change to the shared schema, existing CLI, or Knowledge implementation.