Repository navigation
Reduce repeated Explore input in refresh-state JSON results - #8062
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: actor_kind=model_agent; model=gpt-6.1-sol; provider=OpenAI; declaration_source=runtime_reported; reasoning_effort=max.
动机 / Motivation
通过 refresh-state 交付 Explore 结果的 CLI 调用者,原来会在同一份成功响应中看到两份完整相同的输入:根结果以及已完成 hook 的 intent 输入。长观察和证据会被重复传输、阅读。当前提案仅在最终成功 JSON 显示中把第二份换成同响应引用,完整根结果、原结算身份及持久 intent 继续保留;失败或待重试输入仍内联。独立真实 CLI、数值还原和回放验证支持这个有用增量,不把字节减少等同于端到端提速或模型收益。
剩余缺口是已有必需质量检查失败,以及实际 Host/模型理解和完整成本未资格化;这些不由显示投影结清。这里没有新能力开关、模型调用、安装或合并授权。
改动思路 / Approach
复用 TypeScript 的来源身份比较与稀疏 edit owner,Python 只运输两项原始事实、应用 edit 并打印。写回、Explore ingestion、外部结果状态和结算先沿原 owner 完成,投影不重新计算权限、路由或“是否已提交”。只共享 schema 已知、完整成功、非 retryable 的同响应完全相同输入;未知结构、冲突及已有引用保留,引用不会成为持久输入。
这个边界是最终显示投影,而不是新的业务策略或 provider:既有 caller 需要这份结果,已有 coarse reference_context transport 足够,另建服务或重写 Python 决策会扩大成本。精确比较携带大整数及浮点原始 spelling,稀疏 edit 不让未触及的 Python 数值经 JavaScript 整包往返。没有结果时零额外 RPC,Markdown 也不调用此投影;显示 transport 失败回退完整已提交结果,不能要求重跑准入或扣额。
具体改动 / Changes
先读接受依据 docs/reference/protocols/quota-cli-hot-path-compaction-v0.md,spec_revision 为 886f2cdff4b2daad642f08f1b9bcffc0edf66359,再检查实现。
Ownership Boundary:implemented,显示层不获得第二份决策权,来源、完整正文和可执行控制保留;实际恢复及重放验证见下文。Qualification Contract:out_of_scope 的是其中 actual-default quota 模型 portfolio,本 PR 没有改它的输入路径,也没有声称其冻结资格通过;本次最终 refresh 显示的确定性还原、schema 和失败分支独立执行。新增的 20 行英中文档解释这个扩展,不作为自身验收 oracle。另按原预算指南比较同一工作量的完整信息与额外调用,不将“初始更小”当完整成本结论。
关键代码讲解
referenceExploreResultDelivery校验成功 delivery/hook/intent,并用既有contextSourceIdentity比较完整输入;仅删除相同副本、保留其它字段,写入attachment_ref: $.explore_result。compact_refresh_state_cli_payload没有 attachment/delivery 就直接返回;否则一次粗粒度请求后复用_apply_context_projection_changes,其它根字段来自原对象。可选显示错误返回完整原结果。handle_refresh_state_command的两个最终打印点都在原_settle_requested_refresh之后;JSON 才投影,Markdown 沿原完整路径。
完整差异 8 文件 +171/-4,生产四文件 +55/-3,测试三文件 +96/-1,文档一文件 +20。没有新 store、外部配置或备用解码器。既有 deliver_result_attachment 在投影之前消费完整持久 intent,正常及释放 lease 后的读回/replay 不读取新的显示副本。改动的另一个测试从 prose 中寻找 semantic_closeout,改为检查真正可执行命令的 --delivery-boundary semantic_closeout,随后仍执行 File/SQLite 的进展、完成和同 Turn 重放;并未删除完成或一次扣额断言。
对主干的风险 / Risks
最强风险是不同大整数在 JavaScript 中碰撞而误共享,或显示失败掩盖已提交效果,让调用者重复扣额。独立混合 intent/未知字段/逆序对象/数值探针共 12 场景通过:包括 2**60+1、相邻整数、1.0、-0.0,同响应还原后完整 JSON 类型和值相同,原对象不变,二次投影幂等。不同或未知 intent 继续保留完整输入。某个四 intent 合成输入从 12,469 到 8,113 字节;同 workload 的 20 次已暖显示投影中位约 8.67ms,含 RPC 及复制,且存在并发噪声。这只是合成显示成本,不是 CLI 启动/端到端基准、SLO、token 或费用净收益,也不拿来替代作者的不同 workload 数字。
真实 Explore/settlement/投影相关测试 head 105 PASS;base 87 PASS、4 项因旧 prose 断言失败,原失败保留。TypeScript owning 三模块 75 PASS、typecheck 与变更 Ruff PASS。独立真实 CLI 的额外显示 transport 故障及 Markdown 路径在 File/SQLite 两端 base4/head4 PASS,原结果完整可读,回放仍恰一扣额。私有探针前两版分别挂错打印 owner、未捕获实际 dispatcher 输出;原失败留存,第三版只修正观测点,未改产品、输入、原身份或扣额断言。
标准 premerge 为 6 项直接检查通过、17 项选择检查中 15 PASS/2 FAIL:quota-plan-smoke.py 仍 KeyError: quota;CLI 输出 differential 在 immutable-base probe 就丢失 inline policy keys,尚未进入候选比较。分别执行相同 base/head 命令,完整 stderr 仅规范化源码根与生成 fixture 路径后相同;相关 runner、fixture 因果 blob 未变。必需17-source mypy 也在两端保留同一 task_orchestration_admission.py:110 no-any-return,完整208字节输出相同。因此这些是既存无关失败,仍为 required FAIL,exact-scope CQR 亦为 FAIL。未查询、轮询或等待 CI,未运行付费模型或安装态 Host。
语义与 CI 对齐
复用已有 schema 与 context reference owner;refresh_result 是内部 co-deployed transport 选择,attachment_ref 是最终显示引用,不是新的执行资格或持久状态枚举。advisory 未发现受支持的新 vocabulary carrier,完整语义 canary 通过;这不代替数值、失败及重放证据。新的默认差异仅针对成功带结果的 JSON 响应,文档已披露。Explore 关闭且无结果、quota/Turn 普通请求和 Markdown 的默认不变,没有根据配置存在性激活能力或增加工作义务。
我的整体评价 / Verdict
对 8062@0a2bcb71f8d88e500e7ec747f62c69cd2c7481f5 为 APPROVE,无当前改动引入的有效 blocker。long_horizon=preserved:持久输入、原 Turn 与重试/一次效果不由显示引用改写,持续收益仍未证明;user_experience=improved:同一响应保留完整结果且减少重复,不增加准备、补读命令、重填或确认轮次。边界独立可测试、可回退,机制与重复输入问题相称;不要求它同时完成整个 quota 模型资格计划。
已检查 JSON/Markdown CLI、持久 ingestion/replay 及共用 Turn transport;没有渲染页、首屏或设置控件变化,视觉评审不适用,视觉未验证范围为 none。既有验证 owner 仍须处理上述必需红灯;实际 Host/模型采用和完整系统成本需各自资格,当前评审不宣布它们完成。CQR/premerge/类型门及合并权限继续分别约束交付,没有合并、安装或发布动作。
English verdict: APPROVE the exact final-display projection. Independent real File/SQLite replay, precise numeric restoration and display-failure controls cover the changed invariants. Required inherited mypy/premerge failures and CQR FAIL remain; no end-to-end benefit, model qualification or merge authority is claimed.
Goal And Delivered Outcome
Successful JSON
refresh-stateresults repeat the complete Explore attachment in bothexplore_resultand the hook's ingestion intent. The CLI now keeps the complete attachment once and references that same response from the duplicate.mainat886f2cdff4b2daad642f08f1b9bcffc0edf66359.Author Declaration
Written by: model_agent, OpenAI Codex / OpenAI.
Implemented against
Specification:
docs/reference/protocols/quota-cli-hot-path-compaction-v0.md, Ownership Boundary, anddocs/development/testing-and-quality.md, Agent-Facing Output Budgets, at the base above.The existing TypeScript Explore/context owners decide sharing. Python applies sparse display edits without becoming a semantic owner.
attachment_refextends the local display-reference contract; persisted intent schemas stay unchanged. No new setting, enum or admission path is added.Scope And Continuation
Complete within this slice: successful result input sharing, original-output fallback when optional projection fails, and protocol/readback coverage. Other projection diagnostics remain a separate gap. The same-domain test cleanup replaces an outdated prose-token assertion with the executable semantic-closeout command, then exercises real progress/completion and once-only replay.
Existing frontend/Lark capability operations and Markdown output are unchanged. This changes the existing CLI result presentation, with no additional user operation. Integration into a future frozen benchmark source remains separate from this proposal.
Validation
0a2bcb71f8d88e500e7ec747f62c69cd2c7481f5test_refresh_result_projection.py: exact reconstruction, no source mutation, numeric spellings, adjacent large integers, unknown schemas/controls, failed and pending delivery, reference collisions, transport fallback, no-attachment pathTiming is display-only, not end-to-end CLI latency: the attachment case adds about 0.86ms p50 / 1.53ms p95 in the warm printer replay. The first standalone projection took 346ms including runtime startup. A real refresh already performs runtime work, but its incremental end-to-end latency has not been isolated. The no-attachment path makes no projection RPC. Fees, model behavior and benchmark outcome benefit remain unmeasured. Raw private packets and local measurement artifacts are excluded.
Frontend / Visual Evidence
UI impact: none. No viewport, settings or frontend operation changes; the existing CLI JSON readback is the affected surface.
Type of Change
LoopX Area
Shared-authority RFC fixture impact
N/A: authority storage, provider routing and promotion policy are unchanged. Real File/SQLite coverage verifies the caller's unchanged effect and replay behavior.
Boundary Checklist