Repository navigation
fix(context): deliver complete native Goal sources with exact warm reuse - #7575
Conversation
Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
loopx-agent
left a comment
There was a problem hiding this comment.
Reviewer: model_agent; gpt-6.1-sol; OpenAI; runtime_reported; reasoning_effort=max
Approval conclusion (author-owned PR; GitHub blocks formal self-approval)
动机 / Motivation
开启 native context delivery 的 Agent 在连续回合中需要读取完整 Goal。以前未标记或混合 Goal 留在另行读取命令中;现在原文进入同次 capture,暖态可精确复用。完整原文、未知章节、注释和最终停止条件能够在原捕获中读取与恢复。本 PR 不完成其余 C1 切换,也不证明模型保留、安装采用或 token 与长程收益。其余 C1 writer/caller 收敛、历史 reader 退出及实际模型完整成本仍由 #7430 承接。
未发现阻塞问题;批准本次准确 head d980d621219b10353fdaeb058a1a0fd5714f4389 的源码交付切片。原渐进读取本身并未丢掉要求,但正文不在 native capture 内,就无法由同一基线精确复用。这个具体缺口值得修复,不能仅凭字节减少判断价值。
改动思路 / Approach
完整性规则属于已有 TypeScript interaction/context owner;Python 保留 registered-source IO,共享校验消除履行与复用的规则分叉。本次边界是已开启 native 路径的完整 Goal 来源交付与 exact reuse,普通关闭态继续渐进读取。只修改 codec 无法复用根本没有送入 capture 的正文;另起缓存或第二套来源规则又会扩大维护面。现在沿现有 native activation、registered-source、typed fulfillment 和 capture/restore 链接入,无新配置或额外确认轮次。
| 路径 | 本次行为 | 资格边界 |
|---|---|---|
| 关闭 native | 保留完整渐进读取 | 不自动启用 |
| 开启且来源有效 | 原文入同次 capture,正文可 exact reuse | 当前 witness 和未知字段仍明文 |
| 来源无效或上下文失效 | 拒绝错误履行或恢复原 capture | 不重跑准入、不新授执行权 |
具体改动 / Changes
规范依据为 docs/reference/required-work-context.md,spec_revision 2cdff65d886d13121ffd78dccd96dd7413ab9d01;先按该不可变版本的条文判断,再核本次双语扩展。complete_original_goal 已实现完整原文交付;original_capture_recovery 保持同捕获恢复;source_failure 保持失败拒绝;default_off 保持原关闭态。没有把未来 C1 或模型收益要求冒充本 PR 已完成。
关键代码讲解
_source_content复用原文件读取与严格区域 parser,只在 native 请求下补全部未标记原文;没有用标题或摘要判断哪些要求可删。completeGoalNarrative是从既有 owner 移出的共享校验:完整原文必须匹配 UTF-8 digest,不能夹带排除区域或假装 partial read 完整。projectInteractionWorkContext在 native 完整性请求下拒绝仍 pending 的 Goal;Python 还核内部complete_goal_v1ACK,避免旧 runtime 静默忽略请求。splitContext复用同一 predicate。只有已核验正文可以继承,revision、full-source witness 和未知当前字段不借旧值。
全 diff 为 10 路径 +264/-69,包含现有 predicate 搬迁、6 个生产文件、3 个测试文件及双语协议说明。共享小模块有两个实际消费者;无需再抽额外 wrapper。
对主干的风险 / Risks
最强反例是“尾部停止条件被截断却仍被当完整来源复用”。独立合成 fixture 使用 CRLF、中文、emoji、24 条约束及末尾 stop;同一 oracle 在不可变 base 的 File/SQLite 均因 Goal 仍 pending 而失败,在 head 两项通过。每项实际读取 9 页,核对全部 1,856 原始字节;暖态完整重建、epoch 丢失恢复全文、错误 capture digest 拒绝,原文件不变。所有已加载产品模块均核到对应冻结源码。
关闭态另有 5 组相同完整 source-project 输入,base/head 输出逐字节相等,包括 required reads 和全部指令。PASS:292 Python、57 TypeScript、typecheck、standard premerge 的 6 个直接与 19 个选中检查,0 failure/hold。SKIP:68 个需显式原生 Codex binary 的既有 boundary/capture 场景;未作为通过,也未启动真实模型。相关 source、adapter、reader/lifecycle 的实际 File/SQLite 覆盖单列,未声称完整原生平台矩阵。未查询、轮询或等待 CI。
语义与 CI 对齐
这是既有来源投影的字段扩展,TS 继续持有完整性判断,Python 保留 IO。complete 表示来源交付条件,不是模型阅读证明;完整要求、先读后执行、fresh guard、停止与结算义务没有删减。冷态和丢失恢复可能增加传输/校验成本,作者披露的取舍不能外推为 token 或端到端效率收益。
我的整体评价 / Verdict
交付判断是 justified_increment:long_horizon 与 CLI 旅程在这个来源/恢复边界得到改善,剩余 C1 和真实采用继续留在原工作。没有修改渲染页面;检查的是 quota.py、context_readback.py 与 context_delivery.ts 的现有 CLI/native 来源路径。实际模型消费、已安装 App 和 Windows 原生生命周期未验证;未据此宣称体验或费用收益。保留 marked lineage 与关闭态兼容有实际消费者和持久 capture 依据;共享 predicate 的收敛合理,没有新增状态 authority。代码批准、原生 closeout/readiness、维护者合并和安装是分别判断的阶段。
English verdict: APPROVE d980d621219b10353fdaeb058a1a0fd5714f4389; complete native Goal delivery and exact recovery pass independent File/SQLite counterexamples; actual model and installed adoption remain unverified.
Goal And Delivered Outcome
Native context delivery previously left an unmarked/mixed registered Goal as a separate progressive read. The exact native full/delta capture therefore could not carry or reuse that complete material. This extracts an independently usable step from #7430: the existing opt-in native path delivers the full original Goal before capture, verifies its digest, and reuses unchanged text through the existing codec.
Ordinary
--context-delivery offkeeps its progressive source behavior. Generated-region ownership, canonical Todo authority, stops, pending reads, capture identity and settlement remain with their existing owners.Author Declaration
2cdff65d886d13121ffd78dccd96dd7413ab9d01, plus the maintainer-requested independent C1 delivery boundary in WIP: converge governed work inputs and packaged heartbeat consumers #7430.Scope And Continuation
The new helper contains the existing Goal-integrity rule plus the complete-file witness, shared by fulfillment and delta eligibility. Python performs registered IO and passes the requested profile; it does not select work or implement a second validity rule. The internal
complete_goal_v1acknowledgement prevents an older runtime from silently ignoring that request.This is complete within the packaged native source-delivery slice. #7430 retains the complete-contract writer/caller cutover and historical-reader retirement; #7560 covers the separate outcome-reading scope. Neither controller/executor sessions nor all C1 consumers are delivered here. No new configuration, serializer, authority store or frontend is added. Runtime installation and actual App adoption remain outside this PR.
Validation
d980d621219b10353fdaeb058a1a0fd5714f4389, rebased on2cdff65d886d13121ffd78dccd96dd7413ab9d01.Full-repository pytest, actual-model costs, installed-App adoption and the platform matrix are not qualified by this scoped proposal; no merge readiness is claimed.
The added fixture initially omitted its Turn identity/capture root; those failures remain separate from the later semantic failing-before result. No runtime gate or budget was weakened.
Matched input cost
Same synthetic task, harness, path lengths and page budgets; one cohort with concurrent background work. Total UTF-8 stdout includes CLI, hook output and every required Goal read. These are engineering observations, not serialized model requests or token/latency/causal gains.
Warm delivery avoids the separate Goal
cat; native CLI/hook call counts remain unchanged. Cold and loss recovery add about 1.2 KB, two native CLI/hook calls and one RPC, while removing the separate Goal read. This tradeoff is explicit; the broader C1 comparison and accepted-outcome/full-cost qualification remain open.The matched private harness is not published; the durable synthetic regression is reproducible with:
uv run --extra test python -m pytest -q tests/control_plane/test_goal_state_context_transport.py tests/control_plane/test_context_delivery_cli.py node --test tests/control_plane_ts/context_delivery.test.ts tests/control_plane_ts/interaction_contract.test.tsVisual Evidence
UI impact: none. This changes the source delivered by an existing opt-in integration; no viewport or control changes. Existing activation, CLI readback and native lifecycle are reused. Packaged CLI observations do not certify installed App or actual model adoption.
Type / Area / Boundary
Rollback: use the existing
--context-delivery offfor a new invocation. Preserve and finish an in-flight decision through its original capture and settlement identity; disabling presentation is not permission to replace that capture.