Repository navigation
perf(cli): avoid echoing acceptance state after batched writes - #7178
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)
APPROVE — 未发现阻断问题。 评审对象 588947890c081497306d5576cd7c64e8e38ebffd,比较基线 385771e56371315976ebe1166a3c07fea8b539df。仅批量写入确认移除完整合同字段;单独读取及持久状态保持原语义。
动机
在已有状态写回中批量记录验收要求或证据评审的 CLI 与 Agent 调用者。过去每次批量写入都会把累积的全部验收要求再次塞回确认结果,其他交付物越多响应越大;现在确认结果保留操作状态和规范版本,完整要求仍从已有 inspect 或当前工作上下文读取。
File、SQLite 的预览、应用、重放和后续写回失败恢复都返回精简确认,同时保留两个成果的九项要求、原始来源及非独立验证边界。本次不压缩或删除持久要求,不修改验收判定、授权、单独 refine 或会话工具的完整读取,也不宣称已测得长期模型成本收益。
改动思路
原生 acceptance 所有者仍检查 Goal/Agent、来源和 CAS 版本,并在普通写回前提交 refinement。变化发生在返回给调用者的公共投影:批量确认只需要知道哪个操作已计划、应用或重放,以及现在的规范版本。完整验收基础仍在规范状态和既有完整读取里,因此可以删除重复回显而不删要求本身。
只在现有公共投影中选择是否附带完整合同,写入、版本与恢复仍由原生所有者负责,无需另建缓存或协议。当前边界仅为批量写入的确认响应:移除重复合同字段,完整读取、持久状态及恢复语义保持不变。 做更大的缓存、第二套 serializer、协议版本或 CLI 选项都没有额外价值;维持现状会继续让无关成果增加每次确认的输出。这个 helper 是既有 Python 传输投影,不是新增 Python 决策所有者。潜在兼容成本是旧批量 JSON 消费者不能继续索引被移除的字段,文档和本评审均明确指出。
具体改动
关键代码讲解
handle_refresh_state_command仅在已有--goal-outcome-update-json分支调用public_goal_acceptance(..., include_contract=False)。精简发生在 refinement 结果投影之后,未更改 CAS、提交次序、普通写回或后续失败时附带 receipt 的逻辑。public_goal_acceptance继续复用原 allowlist,新增关键字默认值True。只有显式 False 才省略goal_acceptance_contract;操作状态、operation_id、provider_revision、source_authority 和已有诊断字段均保留。调用者搜索确认单独 refine/inspect、会话 outcome 工具、HTTP 与 objective 路径仍使用完整默认投影。- 工作流说明明确批量确认不是完整验收基础:当前上下文完整时无需为了确认再读一遍,基础缺失或过期时仍需 inspect。原有来源要求、完整要求保留、当前 Goal/Agent 约束、停止条件和原操作重放没有被“节省输出”弱化。
- 测试在 File、SQLite 上保留两个成果九项要求,覆盖 planned/applied/replayed、无关成果内容不变、原始来源不变、self-review 仍非独立验证,以及 refinement 已提交但普通写回随后失败后的恢复。普通不带 refinement 的写回没有新增确认字段。
独立规范为 skills/loopx-project/references/outcome-refinement.md,规范版本 385771e56371315976ebe1166a3c07fea8b539df。Reuse context and batch changes:完整基础、既有写回路由与历史要求/来源保留,已实现。Continue and recover:丢响应或后续写回失败时复用原操作和原版本,不重复提交,已实现。评审使用修改前的要求判断,而不是用新文字自证。
对主干的风险
主要风险是调用者把精简确认当作完整状态,或失败后丢失已应用结果导致重复变更。前者由明确命名的单字段移除、保留完整默认读取和文档边界控制;后者继续由原生操作幂等性负责。独立执行三个验收相关 Python 模块 74 passed,没有失败或跳过,包含实际 File/SQLite 的预览、应用、重放、拒绝和后续写回失败恢复。
另外比较不可变基线与当前版本的五组完整投影输入:默认结果逐值一致,compact 结果恰好只少完整合同字段,其他公共元数据和诊断不变,没有归一化。把当前新增的两个后端回归运行在不可变基线产品源码上,两者都在预期的“确认中不得包含完整合同”断言失败,当前完整模块通过,证明用例能区分本次契约变化。这个预期基线红灯不是主干故障或当前回归。
标准 diff premerge 6 个直接检查和 13 个选择检查全部通过,零警告、失败和人工 hold。没有查询或等待 CI,也没有把作者报告的字节收益当作本人的测量。这里没有 opt-in/default-off 宣称:批量 JSON 的默认返回确实发生了已披露变化;其余调用者的完整默认路径另有直接对照。没有新增 actor 生命周期、通用状态词汇或执行义务。
语义与 CI 对齐
本次为 reuse_existing:继续使用已有 acceptance 状态、操作标识和公共投影,没有新增持久协议词汇。agent-consumed 文本逐条保留读取基础、来源、顺序、权限和恢复义务;新增说明只界定精简确认与完整读取的用途。74 项实际调用者验证及五组完整投影对照支持 intentional_change_validated,但不证明模型一定遵循新文字。
我的整体评价
long_horizon:preserved;要求、来源、原操作恢复及停止边界均保留。user_experience:improved;确认响应省去无关成果的重复全文,当前完整上下文仍可复用,没有强加额外读取轮次。代码集中在既有所有者、规模与问题相称,兼容取舍已经公开,不需要另建状态或重写运行时。
已检查批量 CLI 回执、公共投影 helper 以及现有会话/inspect 调用者;无页面、布局或设置变更。未验证安装后技能采用或真实模型的长期成本收益;实际 CLI/File/SQLite 与默认投影已验证。最强剩余限制是这种行为说明的真实模型采用及长期收益,而非本次已验证的状态/恢复正确性。APPROVE 仅适用于 588947890c081497306d5576cd7c64e8e38ebffd;GitHub 的 COMMENTED 作者结论和后续 merge-readiness、维护者合并授权仍是不同边界。
English verdict: APPROVE at 5889478. The batched acknowledgement intentionally removes only the full contract; canonical requirements, provenance, CAS and partial-failure replay remain intact, with standalone full reads unchanged. Independent validation: 74 Python tests, five complete base/head projection pairs, two expected baseline regression failures, and all 6 direct plus 13 selected premerge checks passed. No installed/model-efficiency claim or merge authority is implied.
Goal And Delivered Outcome
A batched outcome review through
refresh-state --goal-outcome-update-jsoncurrently echoes the complete Goal acceptance contract, including unrelated outcomes, after every write. The acknowledgement now retains the existing operation status, canonical revision and provenance metadata while leaving the complete contract at its existing read entrypoints.The same-input projection comparison over two real isolated CLI declarations (two outcomes, nine retained requirements) is 4,368 → 187 bytes on File and 4,380 → 199 bytes on SQLite, using compact UTF-8 JSON. These are acknowledgement-projection sizes, not end-to-end latency, model-token or long-horizon benefit measurements.
Intended base:
main; implementation baseline385771e56371315976ebe1166a3c07fea8b539df.Author Declaration
skills/loopx-project/references/outcome-refinement.mdat385771e56371315976ebe1166a3c07fea8b539df, “Reuse context and batch changes” and “Continue and recover”; the bounded projection direction in the overall roadmap's S7/R7. This PR supplies the concrete response-compaction repair.goal-acceptance inspectand admitted work context retain their full contract; standalone refine and conversation tools retain their existing full responseSelf-check: read the production caller and all repository consumers of
goal_outcome_update, updated the existing test consumer to use canonical readback, and compared the same input through the immutable-base/current projection. The change adds no decision owner or persistent state. Python remains the existing CLI/transport projection; TypeScript acceptance and settlement rules are unchanged.Scope And Continuation
Complete author implementation for the batched response. Intentional JSON response change:
goal_outcome_update.goal_acceptance_contractis omitted. Consumers needing complete requirements use the existing inspect/admitted-context read. Do not add an immediate inspection solely to acknowledge the receipt.The shared helper's default full projection remains for active standalone/native callers. The bounded refactoring pass reused that allowlist with one caller-selected option; no new module, CLI flag or compatibility shim was added. Internal store/journal payloads and complete reads remain outside this response-only slice. Adoption and total model-input savings remain to be observed through the existing context-cost program.
Validation
588947890c081497306d5576cd7c64e8e38ebffd; runtime/test bytes match the working-tree executions below.fail: the optional mypy failure has not received independent qualification. Passing native tests/premerge do not clear that hold; CI and maintainer review remain separateThe initial new fixture had invalid trailing whitespace and then assumed outcome insertion order; those test-authoring failures were corrected. The valid baseline still fails for the intended response defect. No existing requirement assertions were weakened. The native tests verify complete durable source/readback and once-only recovery; no model execution, installed-host adoption, provider performance or complete-suite qualification is inferred. Authority stores and provider routing are unchanged.
Frontend / Visual Evidence
UI impact: none. This changes the existing agent-facing batched CLI acknowledgement and its workflow guidance; no capability, settings or viewport is added. Complete App/native readback retains the same helper default. First viewport/preview: N/A.
Type of Change
LoopX Area
Shared-authority RFC fixture impact
N/A: no authority-store, migration, source promotion or provider-routing change. File and SQLite are actual isolated backends; no PostgreSQL performance qualification is claimed.
Boundary Checklist
The paired mypy runs used the same interpreter/dependencies and command arguments in independent immutable checkouts. All source-location mapping was confined to proven identical lines of the changed file; error messages, codes, notes and multiplicity were retained. This is author attribution, not independent acceptance or a passing typecheck. The temporary baseline worktree was removed after verifying no tracked changes.
中文:最终相关测试 74 项通过,标准 premerge 的 6 项直接检查和 13 项选中检查通过。额外 mypy 在不可变 base/head 均报告相同的 5,181 项错误;逐项源码归因不等于类型检查通过。其可选失败尚未独立确认,当前 CQR 仍为 fail:代码评审已发布,该可选失败的独立资格仍待确认;不以局部通过替代该门。
Review And Qualification Update
The published exact-head code review records APPROVE at unchanged head
588947890c081497306d5576cd7c64e8e38ebffd, compared with implementation baseline385771e56371315976ebe1166a3c07fea8b539df. It reports 74 passing tests, five complete projection pairs, two expected baseline regression failures, and 6 direct plus 13 selected premerge passes. These are the reviewer’s reported executions; this update does not claim another author test run.The current target reference moved to
7129efcdef7a7110bd49b760b7de8359544889ecthrough #7180; the four PR paths and reviewed instruction, ownership and build-manifest paths are unchanged from the original baseline. Exact-scope quality review was refreshed against that reference and remains FAIL (cqr_e71678acfa6381da912c): the historical broad-mypy failure still lacks independent execution/causal qualification. The published code review does not supply that specific qualification. Original failure evidence and the full-suite, CI, adoption and long-horizon limitations above remain.