Skip to content

task: Retain and seal Apps-delivered context in Harness (T38) #447

Closed

Description

@zengchuang-hw

Current state: Accepted and complete for the bounded T38 delivery. Implementation #475 merged as 0311393c; the authorized Harness owner accepted completion and closure. Production evaluation remains tracked in #429, #430 and #434.

Goal

Track the Harness retention and sealing slice required by #371 step 4 and D023-3 / V33 / T38. The Apps adapter in #446 hands over process-local bytes, actual fixed Knowledge pins, selection/omission metadata, a proposed location and SHA-256. Harness owns retention and the committed delivery reference.

Accepted scope and acceptance

  1. The Harness generation orchestration consumes the injected ContextProvider.collect(ContextRequest) before publishing a generation manifest. The implementation identifies the concrete entry point and Harness capture/commit route in its PR and exercises both through that entry point.
  2. Harness seals DeliveredContext with the actual committed locator, which may differ from the draft proposal. Its ArtifactRef.sha256 equals the draft digest and its size_bytes equals the retained byte count. The accepted fixed media type is application/octet-stream; Harness owns this field.
  3. Stage retention by attempt. When the same round is retried, an unsuccessful attempt's staged bytes cannot satisfy a committed read, and an existing committed delivery cannot be overwritten. If an already committed immutable object is reused, verify its exact digest and length. The draft location is a relative hint.
  4. T38-N1 injects two failures: before writing bytes and after staging the bytes but before commit. For each, verify no valid DeliveredContext.artifact, no entry in GenerationManifest.context_refs, and no new sealed generation manifest for the failed delivery.
  5. T38-P1 observes the order of retention, sealing and manifest publication. Verify the manifest's context_refs includes the committed DeliveredContext.artifact. Read the retained bytes in a new process under the same configuration and compare the exact bytes, digest and fixed Knowledge pins.
  6. Exercise the actual Apps adapter with a dependency check or write-failing spy around Apps collection. The writer of record is Harness. The process-local draft stays outside the JSON schema; the committed DeliveredContext and GenerationManifest use the existing schema.

Shared D023-3 contract · T38 acceptance · Amy's review

Ownership and status

Harness owner: @Dong1017; bounded implementation delegated to @zengchuang-hw in #475. Completion and closure explicitly accepted by Dong1017's authorized delegate in the acceptance record. See the closing summary for artifacts, verification and limits. #371 and the three production evaluation dependencies remain open.

Activity

  1. added
    kind:taskBounded delivery task with a delegated slice
    area:harnessHarness module: profile, A/B loop, quality gates, evidence reports
    status:proposedWaiting for the decision named in the status block
    on Nov 15, 2026
  2. amy-why-3459 commented on Nov 15, 2026

    @amy-why-3459
    Collaborator

    Thanks for splitting this out. It keeps the D023-3 boundary clear: #446 produces the process-local draft, and Harness owns retention and sealing. Some points that would make the acceptance easier to verify:

    1. Where the port is consumed. Please name the Harness component that calls ContextProvider.collect(ContextRequest) and the capture/commit route it uses to retain the bytes (an existing artifact capture path, or a new one). That way the implementation and T38 test have a fixed entry point.
    2. Fields the draft doesn't carry. ArtifactRef requires location, sha256, size_bytes and media_type. The draft has the bytes, the digest and a proposed location, but no media type. Please state who sets media_type (I'd expect Harness to fix one value for delivered context) and that size_bytes is len(content) as retained. Please also say whether the committed locator may differ from intended_location, and that DeliveredContext.artifact.sha256 must equal the draft's sha256.
    3. Retries for the same round. The proposed location only depends on round_id (context/<sha256(round_id)>/delivered.bin in Adapt Knowledge context to a Harness delivery draft #446). Please define what happens when a round is retried after a failed retention: overwrite, a per-attempt location, or rejection. This matters for T38-N1, so leftover bytes from the failed attempt can't be picked up later.
    4. Where T38-N1 fails. Please cover at least two injection points: failing before any bytes are written, and failing after bytes are written but before the commit/seal. In both cases there should be no valid DeliveredContext, no sealed generation manifest, and no context_refs entry for that delivery.
    5. Order and references for T38-P1. Besides byte equality in a new process, please check that the generation manifest's context_refs point at the sealed delivery and that the manifest is written strictly after sealing.
    6. Checking acceptance 4. "Apps issues no writes to Harness RunStore" is easiest to keep true with a concrete check, for example an import-boundary rule or a test that fails on any RunStore write from the Apps provider path.

    The owner is still open (Proposed, waiting for @Dong1017). Once that's confirmed, I'm happy to review the Harness slice against T38-N1/P1.

  3. zengchuang-hw commented on Nov 15, 2026

    @zengchuang-hw
    ContributorAuthor

    @amy-why-3459 the issue now incorporates your six checks. It names the generation orchestration seam and asks Harness to record its exact entry point and capture/commit route. The proposal includes a fixed media type, length and digest equality, attempt-scoped staging, both pre-commit failure points, the manifest ordering and context refs, and a check on Apps' read-only dependency boundary. The concrete route and the accountable implementer are pending @Dong1017's acceptance.

  4. amy-why-3459 commented on Nov 15, 2026

    @amy-why-3459
    Collaborator

    Thanks, I checked the updated "Proposed acceptance" against my six points (6889009504). All of them are covered:

    • Entry point and capture/commit route: the PR must name them and exercise both through that entry point (item 1).
    • ArtifactRef fields: committed locator may differ from the hint, sha256 equals the draft digest, size_bytes equals the retained length, and Harness owns media_type, proposed as application/octet-stream (item 2).
    • Retries for the same round: retention is staged per attempt, staged bytes from a failed attempt can't satisfy a committed read, and no committed delivery is overwritten (item 3).
    • T38-N1 uses two injection points, with checks on artifact, context_refs and the manifest (item 4). T38-P1 checks ordering and that context_refs contains the committed artifact (item 5). A spy or dependency check enforces the writer boundary (item 6).

    Nothing else from me on the acceptance text. What's still open is @Dong1017's confirmation of the Harness entry point, the capture/commit route, the media type and the implementer.

  5. Dong1017 commented on Nov 15, 2026

    @Dong1017
    Collaborator

    Decision — T38 Harness entry / route / media / implementer (Dong-bot as @Dong1017 delegate)

    Recorded 2026-11-15. Authority: Dong-bot decision authority for @Dong1017 accept/decide. Thread basis: Amy cleared proposed acceptance (6889114513); D023-3 / V33 / T38; Apps draft producer #446; Harness owner precedent #429.

    Accepted — proposed acceptance text

    Accept this issue’s current “Proposed acceptance” as the bounded Harness retention/seal delivery for #371 step 4 / D023-3 / T38. Amy’s six checks are covered; no further acceptance-text changes required from steward.

    Confirmed — concrete ownership

    Item Decision
    Entry point Harness generation orchestration that publishes GenerationManifest (V24/V33). It must call the injected ContextProvider.collect(ContextRequest) before sealing DeliveredContext and before writing any sealed generation manifest. Not execute(), and not the legacy optimization-session capture_context helper. The implementation PR must name the concrete module/symbol for this controller and exercise T38-N1/P1 through that entry only.
    Capture/commit route Reuse Harness RunStore object retention — attempt-scoped stage of the draft bytes, then Claim.commit so ArtifactRef becomes valid only with the commit (same writer family as H02 capture→commit; writer of record = H). Draft intended_location is a relative hint only; the committed locator may differ. Failed-attempt staged bytes must not satisfy a committed read; an existing committed delivery must not be overwritten; immutable reuse requires exact digest+length verify. Capture-route identity for producer metadata: delivered-context-retention. Apps must not write the H RunStore.
    Media type Harness owns ArtifactRef.media_type. Fixed value for delivered context: application/octet-stream. sha256 equals the draft digest; size_bytes equals the retained byte count (len(content)).
    Implementer @Dong1017 (S2 Harness owner), same accountable owner as #429. PR authorship may be delegated; accountable delivery and review against this acceptance stay with the Harness owner.

    Scope note

    #447 is the Harness delivery issue for T38 retention/seal. #446 remains the Apps draft producer only; it does not cover T38-N1/P1 production retention. No other open issue already covers both T38 cases for Harness.

    Status

    Flipping status:proposed → status:accepted for this bounded delivery. Apps can wire the real Knowledge draft + joint CPU tests once the named entry/route land.

  6. added
    status:acceptedThe decision owner accepted it in a recorded comment
    and removed
    status:proposedWaiting for the decision named in the status block
    on Nov 15, 2026
  7. zengchuang-hw commented on Nov 16, 2026

    @zengchuang-hw
    ContributorAuthor

    @Dong1017,Apps 的 CandidateProvider.plan_generation 已随 #465 合入,collect_candidate(record, artifacts=...) 已提交 #469,可从普通 CPU 执行的已提交记录读取该 attempt 的固定 manifest 和产物。回归测试直接提供 V24 需要的 generation_plan 输入,Harness 生产编排里还需要对接 #447 的上下文留存和封存。

    请把 Harness 生成控制器的实现 PR 或分支链接贴到这里。Apps 可沿用 #469 的用例,对接实际 ContextProvider 及 CandidateProvider,补齐 T38 的提交前失败和新进程重读验证。

  8. Dong1017 commented on Nov 16, 2026

    @Dong1017
    Collaborator

    Posted by an authorized steward agent on behalf of @Dong1017 (decision authority per standing Dong-bot / steward delegation; hosted Dong-bot is on usage_limit).

    Status — Harness generation-controller PR for T38

    Thanks @zengchuang-hw — noted that Apps CandidateProvider.plan_generation is on main via #465 and collect_candidate has landed via #469 (squash-merged this round).

    Harness production retention/seal PR: there is no open Harness generation-controller PR/branch for #447 yet. Accountable delivery remains with the Harness owner (@Dong1017 / S2) per the prior decision (688920… thread). When that PR opens, its URL will be posted here; until then Apps can keep using the #469 test pattern (V24 sealed generation_plan supplied in the CPU path) and must not treat Apps collect as T38-N1/P1 production retention.

    Binding reminder (unchanged): entry = Harness generation orchestration that publishes GenerationManifest and calls injected ContextProvider.collect before sealing DeliveredContext / writing the sealed generation manifest; capture/commit = RunStore attempt-scoped stage then Claim.commit; media type = application/octet-stream.

  9. zengchuang-hw commented on Nov 16, 2026

    @zengchuang-hw
    ContributorAuthor

    @Dong1017,#465 和 #469 的 Apps 端口已在主分支,我这边开始验证 #447 的真实 CPU 接入。当前 RunStore 有一个顺序卡点。Claim.commit 要先 claim(attempt, request_digest),而 V24 要求先提交交付上下文、写入并绑定 generation_plan,再用最终 spec 计算 request_digest。此外,通用对象路径在 SQLite 记录提交失败后可能留有未引用的文件,不能直接当作 T38 的已提交读取凭据。

    我建议在 Harness RunStore 增加按 attempt 和角色提交的前置留存事务。只有事务提交后的槽位才能经固定 Ref 读取。控制器依次提交交付字节和固定 pins,生成 DeliveredContext,写入并绑定 manifest,再走现有 execute 登记。普通执行记录不预登记、不改摘要。请确认这个存储接口选择,并明确这段是否由我提交实现 PR。如已有分支,请贴链接,我会接着补实际 Apps ContextProvider、T38 两个失败点和跨进程 CPU 用例。#429、#430、#434 如果已有可联调的 CPU 分支,也请一并贴出。

    本地实现和测试已放到 draft PR #475。T38 的两个失败点、跨进程重读实际 bytes 和固定 pins、以及使用已封存 spec 的真实普通 CPU 执行和候选回收均通过。请优先检视前置留存事务是否符合 Harness 的存储边界。

  10. Dong1017 commented on Nov 16, 2026

    @Dong1017
    Collaborator

    Posted by an authorized steward agent on behalf of @Dong1017 (decision authority per standing Dong-bot / steward delegation; hosted Dong-bot is on usage_limit).

    Decision — T38 pre-registration retention transaction (#475)

    @zengchuang-hw — confirmed for Harness storage boundary:

    1. Interface choice accepted: attempt+role pre-registration retention transaction in RunStore; only committed slots are readable via fixed Ref; controller seals delivered context → GenerationManifest → then ordinary execute with the final spec digest. Normal execute records stay un-preregistered / digest-unchanged outside this path.
    2. Implementer: your draft PR #475 is the Harness implementation PR for this slice (Refs task: Retain and seal Apps-delivered context in Harness (T38) #447 / task: Apps 应用层详细设计与迁移计划(CLI / Python / Plugin) #371). Proceed with Apps ContextProvider wiring and the two T38 failure points + cross-process CPU cases there.
    3. Blocker before mark-ready: generation_inputs needs a BEFORE DELETE immutability trigger (and append-only contract wording) — formal Request changes on head cc9b2206: Seal Harness generation inputs before execution registration #475 (review). david6666666's retry/reuse note remains in scope for the same PR.
    4. Deps unchanged: production evaluation leg still waits on task: Harness evaluation-mode CPU execute for Apps #429 / task: Benchmark production prepare and frozen resource closure #430 / task: Benchmark production offline assess for Apps #434; this slice may land once the seal fix clears dual Approve + required checks after leaving draft.

    No change to the earlier T38 media / route decisions on this Issue.

  11. zengchuang-hw commented on Nov 17, 2026

    @zengchuang-hw
    ContributorAuthor

    @Dong1017,已记录你对 #475 前置留存接口的确认。我会先补齐数据库的追加写保护,以及同一请求重试时复用已提交交付的逻辑,然后把 #475 转正式检视。

    请同时明确 CPU 生产联调的三个依赖:#429 Harness 评测执行、#430 Benchmark prepare、#434 Benchmark 离线 assess。已有实现请贴 PR 或分支链接,尚未开工请给出预计可联调时间。三个端口接通后,我会跑 #371 的固定记录评测闭环。

  12. zengchuang-hw commented on Nov 19, 2026

    @zengchuang-hw
    ContributorAuthor

    @Dong1017 更新 #371 的生产联调状态:#475 已合入 0311393c62330c041a01238dc86823b80e020561,实际入口为 inferrsi.harness.generation.prepare_generation。它按已接受的顺序提交交付 bytes/pins、封存 manifest、绑定最终 spec,并覆盖两处回滚、原请求恢复、跨进程固定读取、CPU 普通执行及候选回收。

    请确认这个交付是否满足 #447 的 T38 限定验收,并明确可否完成/关闭该子任务;尚有缺口请逐项指出,我接着处理。生产评测仍不能视为完成:请同时贴 #429、#430、#434 的实现 PR/联调分支或预计可联调时间,三者已于 11 月 15 日接受并指定由你负责限定交付。

    Apps 当前按 #490 整理目录,storage/handoff 已合入,workflows #517 必需 CI 已全部通过,正在等第二份有效审批;接口签名与固定引用契约保持原有边界。三项生产端口就绪后再执行共享 CPU T36/T37/T39/T40,现有普通执行回归不替代该生产闭环。

  13. Dong1017 commented on Nov 19, 2026

    @Dong1017
    Collaborator

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

    Decision: accepted. #475 (0311393c, entry inferrsi.harness.generation.prepare_generation) satisfies the bounded T38 Harness retention/seal acceptance in this issue. #447 can be completed and closed. (Dong-bot, authorized delegate. I checked your summary against the accepted clauses; I have not read the merged diff or run the tests.)

    Clauses covered by your summary

    • Item 1 (entry point and route): the entry is named and sits in the generation orchestration. You report the order as deliver bytes/pins, seal the manifest, then bind the final spec. This matches the accepted route: the attempt+role pre-registration transaction, then the existing execute path.
    • Item 3 (retries): you report recovery of the original request. The Seal Harness generation inputs before execution registration #475 blockers (the generation_inputs BEFORE DELETE trigger and the retry/reuse handling) were required before merge. Per the 11-16 decision, the merge needed dual Approve and passing required checks.
    • Item 4 (T38-N1): both rollback points are covered.
    • Item 5 (T38-P1): cross-process fixed reads and the ordering are covered.

    Not stated in your summary. Please add one line each in the closing comment or the #475 reference, citing the test or symbol. These are non-blocking and don't hold the close.

    • Item 2: media_type=application/octet-stream, sha256 equal to the draft digest, and size_bytes equal to len(content).
    • Item 6: the real Apps ContextProvider path is exercised, with a check that Apps makes no RunStore writes. The Harness slice is accepted without this. If the Apps-side wiring is still pending, track it on the Apps side or in task: Apps 应用层详细设计与迁移计划(CLI / Python / Plugin) #371, not here.

    Production evaluation is not complete. #429, #430 and #434 stay open. This thread has no PR or branch link for any of them, and I can't supply an ETA from it. Their accountable owner is still the Harness owner (@Dong1017 / S2), as accepted on 11-15. The shared CPU T36/T37/T39/T40 run should wait for all three ports. Existing ordinary-execute regressions don't count as that closure. The owner needs to post PR/branch links or dates for these three on #371, or on their own issues. That's a separate follow-up from closing #447.

  14. zengchuang-hw commented on Nov 19, 2026

    @zengchuang-hw
    ContributorAuthor

    已验收:Harness 上下文留存与封存(T38)

    flowchart LR
        A["Apps 提供上下文 bytes 与 pins"] --> B["Harness 按 attempt 和角色提交"]
        B --> C["封存 manifest 与最终 spec"]
        C --> D["原 attempt 普通 CPU 执行"]
        B --> E["固定引用跨进程读取"]
    
    Loading
    补充验收记录与 owner 要求的两项引用

    第 2 项(字节元数据): run_store 的 _GENERATION_MEDIA、artifact_ref 和 _generation_ref 为 delivered-context 固定 application/octet-stream,从实际 bytes 计算 SHA-256 和 len(data);generation._collect_delivery 先校验实际 content 摘要等于 draft.sha256,再调用 Harness 提交。这里分别引用源码责任点,不把未写出的逐字段断言冒充现有测试。

    第 6 项(实际 Apps 路径和写入边界): cpu_generation fixture 与 test_seal_commits_context_and_plan_before_cpu_execution 注入真实 Apps ContextProvider。此外在本轮候选实际执行仓库静态依赖闭包检查:19 个可达模块,0 条 Harness 依赖,排除 Apps collection 经该静态依赖到达 RunStore。复核代码:

    from tests import _gate_policy_support as s
    
    graph = s._scan(s.ROOT, s.exact_pairs(s.load_manifest()))
    _, hits = s._walk(
        "inferrsi.apps.handoff.context_provider",
        graph.edges,
        lambda name: name == "inferrsi.harness" or name.startswith("inferrsi.harness."),
    )
    assert not hits

    这项是依赖检查,未声称运行了独立 writer-spy。源码中的 Apps provider 只返回进程内 draft,由 Harness 执行留存和封存。owner 对 #447 的完成接受与这里的软件回归均不构成性能收益或整项 S5 的完成声明。

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:harnessHarness module: profile, A/B loop, quality gates, evidence reportskind:taskBounded delivery task with a delegated slicestatus:acceptedThe decision owner accepted it in a recorded comment

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions