Skip to content

feat(apps): assemble role-bound evidence capture ports - #568

Open
zengchuang-hw wants to merge 1 commit into
codex/apps-565-capture-basefrom
codex/apps-565-evidence-capture
Open

zengchuang-hw wants to merge 1 commit into
codex/apps-565-capture-basefrom
codex/apps-565-evidence-capture

Conversation

@zengchuang-hw

@zengchuang-hw zengchuang-hw commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

Review-only base: codex/apps-565-capture-base at 23fd9d6745b306670b25ffa3a6d431facb47cded. Retargeted per the owner's incomplete/wide-diff review so the native PR diff contains only this delivery unit. No integration into this temporary base. After the prerequisites reach main, sync and retarget main, run final-head checks and obtain two fresh independent formal approvals before squash merging there.

Refs #565
Refs #371

Apps can now assemble the H-owned capture callback using configured candidate/report roles and an injected B pure projector. It reads only H-authorized bytes, leaves proof/grade/producer decisions with their owners, and keeps published output, assessment, report, Dashboard and trace on the original fixed references.

Authority: Apps slice delegated to zengchuang-hw / Codex in 7064458592. Amy and David are the required independent reviewers; the author and accountable owner cannot supply independent votes.

Stacked Ready PR: depends on #566 0ef4b078528116c45f9a2fb758b00c643adfa854 and #567 b5199316f659e3a10531d187223e8cf9db3720b5, and through them #560/#561/#562/#564 and the separate #552 condition. Combined prerequisite baseline 23fd9d6745b306670b25ffa3a6d431facb47cded merges those two exact heads and unions only the canonical-consumer inventory conflict. Current head abc6de4ddd36a01c37187b64640e81015549bc50; Apps-only incremental range is 10 files, +541/−1. The main-target diff temporarily carries those unmerged prerequisites. Both must integrate first, then this branch is synced and obtains final-head checks and two fresh independent approvals.

Change

  • New canonical apps/handoff/evidence_capture.py, exported as apps.api.EvidenceCapture(project, *, candidate_role, report_role).
  • A defensive context snapshot selects only this attempt's candidate input and a report belonging to its enclosing step. Absent families become explicit None; multiple sources or a configured candidate-role mismatch refuse instead of choosing a first/last source.
  • Reads use only the supplied H capability. Ref metadata is copied before host calls, streams are bounded/closed, and SHA/size are independently checked. Capability refusals keep their exact portable code; unknown host/type errors propagate.
  • The injected projector's return is passed through unchanged. No B business import, grading, worker start, producer sealing, archive write, direct RunStore write or evidence added after commit.
  • New port contract, operation/layout docs, exact canonical-consumer registrations and installed public-entry probe. Handoff initializers and existing flat-path compatibility exports stay intact.

Validation on this exact head

  • 18 focused tests passed, including 3 real pipeline cases with configured prepare → H execution/capture → offline assessment: diagnostic C passed/failed and output-publication failure after a successful H commit.
  • Real cases use runtime IDs and actual source/input hashes. Saved manifest/result files are read back with their public integrity validator. Publication failure preserves the committed RecordRef and readable proof refs; completed replay uses the original attempt, skips capture and starts no extra worker.
  • CLI report/dashboard HTML, CLI trace JSON and live Dashboard HTTP state/page all use the same fixed RecordRef/AssessmentRef as the archived assessment. The samples family remains incomplete; M stays INCONCLUSIVE.
  • 536 expanded tests passed, 7 skipped, 3 standard-library tarfile deprecation warnings, zero failures/errors: B prepare/assess/proofs, H capture/replay, Apps outputs/publication/views/migrations/boundaries, Codex/DSH/Workswarm plugin entrances, Cannbot channels/boundaries, MindIE runtime/project/context and source-version checks. Five skips require an approved Cannbot checkout with a built index; two are POSIX process-group cleanup cases on Windows. Those live-source/platform paths remain unverified locally; warnings are existing tarfile deprecations.
  • Fresh sdist → wheel → independent environment outside checkout passed, including the new public Apps capability and existing plugin/runtime probes.
  • Entire-tree Ruff and whitespace checks passed. New Ready CI must pass before integration.

The test worker's predicate is diagnostic fixture logic, not an accepted production grader. Real worker/grader/sampler semantics and resource pins remain the separate #565 gate. No measured sample values or service gains are invented, and no whole-Issue completion is claimed. #371/#429/#430/#434 remain open.

@amy-why-3459 @david6666666 please independently review the complete Apps increment; @Dong1017 please review the owner boundary. Integration requires passing checks, both prerequisites and two eligible current-head formal Approves with first nonempty line LGTM. Parent/author and non-write bot votes do not count.

Read only current attempt sources through the Harness capability and pass bytes to an injected pure projector. Verify fixed output, report, dashboard and trace references across publication failure and original-attempt replay.

Agent-assisted-by: Codex (author)
Signed-off-by: zengchuang <zengchuang3@huawei.com>

@Dong1017 Dong1017 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

PR review verdict — DO NOT PASS

Reviewed base af836963e73251622eefcf8a8a67f8ad3f4ecf12, head abc6de4ddd36a01c37187b64640e81015549bc50 (first review, no prior formal reviews or Approves seeded). This is a Dong-bot (authorized delegate) review. It is not an approval.

Blocker 1: the diff is incomplete. pr/meta.json has diffComplete: false. The seeded patch was cut off partway through src/inferrsi/harness/run_store.py. I could not see the rest of that file, the tests (including tests/test_apps_evidence_capture.py, test_harness_entry_verification.py, test_benchmark_assessment.py) or any fixtures. An approval has to cover the whole change, so I am not passing a partly seen diff.

Blocker 2: the PR contains more than its stated scope. Per the #565 decision, this PR should be only the thin Apps evidence_capture adapter, stacked on #566/#567 and merged after both. Against base af83696, the diff also adds:

  • benchmark/assessment.py and benchmark/proofs.py
  • harness/evidence_capture.py, entry_code.py and prepared_binding.py
  • LocalCpuTarget(module_root=...), replay re-entry through run_store._reenter_if_registered, and new contract docs

That is the B, H, entry-verification and replay stacks. The scope decision is "merge only after both prerequisites, sync, CI and Amy+David approvals". Please either retarget or rebase onto the prerequisite branches so the diff shows only the Apps adapter, or state explicitly that this PR is meant to carry the whole stack. In that case it needs its own full review by independent reviewers.

What I checked (in the visible part of the diff):

  • src/inferrsi/apps/handoff/evidence_capture.py matches docs/contracts/apps-evidence-capture.md.
    • Reads are bounded to size+1 and hash/size are re-checked.
    • Streams are closed.
    • Multiple sources for one role raise IdentityMismatch.
    • A wrong candidate role is refused.
    • Capability errors pass through with their portable code.
  • It imports no Benchmark module and writes no archive or RunStore row.
  • EvidenceCapture is exported from apps.api, and the migration inventory, architecture and module-layout docs were updated consistently.
  • The bound_inputs and steps[].artifacts selection filters on attempt id, step id and status == "available", as the contract says.

Non-blocking, to confirm once the full diff is visible:

  • validate_artifact_ref is imported from ..storage.result. I did not verify that name exists at head.
  • In _read, a str or other non-bytes return from artifacts.open is treated as a stream. A mistyped result would surface as an AttributeError rather than a typed error. This matches the "unknown host/type errors propagate" contract, so it is fine as long as that is intended.
  • The ProofProjector docs claim that preparing happens before the worker starts. The H-side ordering is in execution_service._run_claimed, which I did see, and it looks consistent.

Not verified: no tests were run and CI status is unknown. I did not review the truncated part of run_store.py or any of the test files.

I will re-read after the author pushes a reduced or complete diff.


Posted by Dong-bot, an automated agent acting on behalf of @Dong1017 (always-on-bot, model claude-sonnet-5-5).

@Dong1017 Dong1017 added the kind:task Bounded delivery task with a delegated slice label Nov 21, 2026

@amy-why-3459 amy-why-3459 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

PR review verdict — PASS
Reviewed implementation base 23fd9d6745b306670b25ffa3a6d431facb47cded (merge of #566 0ef4b078528116c45f9a2fb758b00c643adfa854 and #567 b5199316f659e3a10531d187223e8cf9db3720b5) and head abc6de4ddd36a01c37187b64640e81015549bc50 (Apps-only increment: 10 files, +541/−1). The PR target is main af836963e73251622eefcf8a8a67f8ad3f4ecf12; the main-target diff still carries those unmerged prerequisites, which were already reviewed on #566/#567.

I also read the current-head COMMENTED review 6006276369 (DO NOT PASS). Both of its blockers concern the stacked main-target diff: a truncated review snapshot, and the already-reviewed B/H prerequisite files that this branch is required to sit on. The governing #565 acceptance (7064458592) asks for a thin Apps adapter stacked on #566/#567 for review only, and forbids merging before those prerequisites. I therefore reviewed the complete Apps-only range against 23fd9d67, not the whole main-target stack as new work.

Verified against that Apps-slice acceptance by reading this increment:

  • apps.api.EvidenceCapture is a thin handoff adapter: it imports no Benchmark business module, performs no grading, and writes no archive or RunStore. The injected projector's return is passed through unchanged, matching H's capture(phase, facts, *, artifacts) -> (draft, blobs) contract.
  • Role selection is attempt-scoped and refuses ambiguous sources as IdentityMismatch instead of first/last; an absent family is passed as explicit None. A configured candidate role that differs from H facts is refused before any byte read.
  • Reads go only through the supplied H capability. Ref metadata is copied before the host call; streams are bounded to size+1, closed, and independently checked against the retained size/hash. Capability refusals keep their original portable code; unknown host/type errors propagate.
  • Unit tests cover the adapter boundaries; the three real pipeline cases check runtime IDs, shared RecordRef across execute/assess/trace/report/dashboard, publication-failure retention, and completed replay with zero extra capture/worker. Diagnostic worker semantics are not claimed as task/grader acceptance.
  • Architecture and change necessity look sound; no redundant code or tests found. Accuracy and performance comparison experiments are not applicable for this assembly slice.

Ready lint-and-smoke, installed-package (3.10/3.11), dashboard-browser and pr-references have already passed on this head; full-check was still running when I submitted. Per 7064458592, merge #566 and #567 first, sync this branch, wait for green checks on the final head, and obtain two independent formal Approves on that head. This vote applies only to abc6de4d; a parent/author vote does not count as one of those two approvals.

@zengchuang-hw
zengchuang-hw changed the base branch from main to codex/apps-565-capture-base November 21, 2026 15:39

Copy link
Copy Markdown
Contributor Author

回应当前 owner 检视:已把临时检视基线调整为 codex/apps-565-capture-base(23fd9d6745b306670b25ffa3a6d431facb47cded),head 未改。GitHub 原生差异现在就是本单元的完整增量,解决前置文件混入/截断问题;本 PR 仍是独立 Ready,不承载或合入整个堆叠。

临时基线只供检视,不向它执行合入。 前置真正进入 main 后会同步并改回 main,重新获得最终头的 CI 与 Amy/David 两份有效独立批准,再 squash 到 main。已有 vs-main Ready 检查仅按原 head/测试内容保留,不伪称是同步后的最终检查。

@Dong1017 @amy-why-3459 @david6666666 请在缩小后的原生差异上复审,有意见先处理。

@Dong1017 Dong1017 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

PR review verdict — PASS (owner-boundary review by Dong-bot, authorized delegate)
Reviewed base 23fd9d6745b306670b25ffa3a6d431facb47cded (temporary review-only base) and head abc6de4ddd36a01c37187b64640e81015549bc50. The seeded diff is complete (diffComplete: true) and covers 10 files.

My earlier DO NOT PASS blockers are resolved.

  1. Truncated diff: the retarget gives a complete native diff, so I could read all of it, including both test files.
  2. Scope creep: the diff now contains only the Apps adapter, its docs, the registrations, the installed-entry probe and two test files. No B or H prerequisite files remain.

Owner boundary (verified in src/inferrsi/apps/handoff/evidence_capture.py)

  • Imports are limited to inferrsi.harness.errors.PublicError and ..storage.result.validate_artifact_ref. There is no Benchmark business import, grading, worker start, producer sealing, archive write or RunStore write.
  • The projector's return value is passed through unchanged. Proof, grade and producer decisions stay with B and H.
  • Role selection is scoped to the attempt. _one refuses multiple sources with IdentityMismatch instead of picking a first or last one.
  • A configured candidate role that differs from the H facts is refused before any byte read.
  • A report is only used when its attempt_id and step_id match and its status is available. Otherwise the report is an explicit None.
  • The ref is copied (deepcopy) before the host call. Reads are bounded to size+1, the stream is closed through closing, and size and sha256 are checked independently. Capability PublicErrors keep their code. Unknown host or type errors propagate.

Registrations

  • I checked docs/apps-module-migrations.json against test_active_consumers_use_canonical_paths_and_are_registered. evidence_capture.py is registered as a consumer of storage.result, and tests/test_apps_evidence_capture.py as a consumer of archive and artifact_reader.
  • tests/test_apps_capture_adapter.py imports only apps.api and harness.errors, which are not inventory canonicals, so it needs no entry.
  • evidence_capture.py is not an inventory entry. This matches the doc claim of "no former flat-path alias".

Tests, read but not run by me

  • The unit tests in tests/test_apps_capture_adapter.py cover:
    • ambiguity
    • foreign attempt and step
    • metadata mutation by the reader
    • corrupt bytes
    • short reads
    • preserved refusal codes
    • unmasked host TypeError
  • tests/test_apps_evidence_capture.py covers three real pipeline cases. They exercise the passed, failed and publication-failure paths, and replay without capture.
  • The author's reported results (18 focused tests, 536 expanded tests) are unverified by me. I have not seen CI.

Non-blocking follow-ups

  • capture() indexes facts["candidate"]["input_role"], bound_inputs, steps and so on directly. A malformed H facts shape would raise KeyError. This follows the H contract from #566, so I am not blocking on it.
  • A reader that returns bytes is not size-bounded before the integrity check. It is already in memory, so this is acceptable.

Merge conditions (unchanged)

  • This Approve covers the current head against the temporary base only.
  • #566 and #567 must reach main first. Then sync, retarget to main, and run final-head CI.
  • Fresh independent Approves from Amy and David are required on that final head. Amy has Approved the current head, and David's review is still needed.
  • The real task, grader and sampler semantics stay under the separate #565 gate.

Posted by Dong-bot, an automated agent acting on behalf of @Dong1017 (always-on-bot, model claude-sonnet-5-5).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind:task Bounded delivery task with a delegated slice

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants