Repository navigation
fix: let terminal qualification correct effect-free vision input - #7605
Conversation
Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
…tion-20261029 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; OpenAI; gpt-6.1-sol; runtime_reported; reasoning_effort=max
Approval conclusion (author-owned PR; GitHub blocks formal self-approval)
APPROVE,未发现此精确源码切片的阻塞缺陷。审查 head 108ee7a588e7abb66a0d2df24e5cd0d1e295eb72,base 89a8efb44fa768e144de7d588be7befb7cc4340d;这是作者自审,不是第三方批准。审查期间主干已推进到 9f42f0bc5025c59d4bf67ae9dbef559d1f4b4231,该后续组合尚未验收,当前不宣称 merge-ready。
动机 / Motivation
运行 terminal settlement 资格的维护者,在模型提交格式不合法的完整 vision JSON 时遇到此问题。
原实现先创建 history 锁再拒绝空 vision patch,导致同一模型不能纠正输入;当前在锁前拒绝,并在原十次工具调用内以九次完成验证、写回、一次扣额和终态收尾。
实际 CLI 输入纠错和零写入拒绝已经验证;该 PR 仅交付这条恢复路径。 完整真实模型资格、生产安装、发布渠道和个人指南不由此 PR 认证。 完整真实模型资格和后续主干集成仍需发布 owner 在最终候选上验收。
改动思路 / Approach
结构性判断复用现有 TS owner,Python 只负责 CLI 和隔离夹具 IO;不另建状态、调度或权限 owner。
当前 PR 的边界是锁前拒绝与同一 actor 的有界纠错;不把文件观察推广为生产回滚或外部副作用证明。
单改宿主仍会被真实 CLI 已创建的锁文件拦住;忽略锁文件又会把实际修改当作无副作用。当前方案将完整 JSON 的纯结构检查提前,保留正常 writer 对当前状态与权限的检查。宿主用内容和元数据观察夹具,再通过本地类型标记返回拒绝;不会仅凭 appended=false 或错误文字继续。无 vision 和仅 inline patch 的调用仍走原路径。
| 真实触发 | 基线 | 当前 head |
|---|---|---|
| 完整 vision 的空 patch | 先创建 history 锁,调用五结束 | 锁前拒绝,同 actor 可在九次内完成原四阶段 |
| 拒绝后同字节重写、替换、权限或临时文件变化 | 仅错误代码不足以立即识别 | 独立观察发现变化,立即停止 |
| 已写回后进程失败并伪造 false 标记 | 不得当回滚 | 保留已发生事实,仍禁止继续 spend |
具体改动 / Changes
依据已读的 docs/reference/protocols/model-behavior-qualification-v0.md,规格修订固定为 89a8efb44fa768e144de7d588be7befb7cc4340d。该规格中的逐项要求映射如下:terminal-identity 原 Goal/Agent/Todo/Turn 与验证回执保持;terminal-order 验证→写回→扣额→终态顺序保持;terminal-budget 同 actor、十次上限、拒绝也计数且不自动重试保持;terminal-private-receipts 原始命令和工具输出不进入持久汇总保持。live-portfolio 是规格明确分开的低频真实模型发布门,本 PR 不以脚本化传输代替它。此处标识用于定位这些原文要求,不增加新验收标准。
关键代码讲解
handle_refresh_state_command:完整 JSON 在 history lock 之前调用既有prepare_vision_refresh,不采用其返回值替换请求或授权状态转换;仅 inline 的 patch 仍先合并历史,最终 writer 继续检查当前策略。新增的是调用时序,不是 Python 版 vision 判断。snapshot_disposable_fixture:观察整个临时根目录、所有文件内容摘要及 inode、mode、uid/gid、mtime/ctime;读取产生的 atime 不算修改。目录元数据也参与比较,因此创建后删除的临时文件不能凭内容恢复而逃过。符号链接和未知节点直接失败,不借它们观察根外内容。_execute_cli:真实进程非零、JSON 中两个精确 false,加上前后完整夹具相等,才产生内部_UnchangedFixtureRejection。其它异常继续失败。新类型为局部控制流标记,不是公开 schema、持久状态或执行凭证。_execute_terminal_cli:只将该本地标记作为同一模型的瞬时反馈,不推进 writeback 阶段,也不重置预算。成功路径仍核对提交回执的阶段和原身份。
全 diff 为六个文件、229 增加/24 删除;主要新增是原生产入口的回归及反例。没有新 CLI、迁移、前端页面或并行 authority。已搜索既有 vision、工具传输及相邻 replan actor,复用共同机械层并保留各场景独立状态机。
对主干的风险 / Risks
最强反例是实际写入已经发生,进程却返回 ok=false/appended=false。当前验证在真实 CLI 写回之后注入失败,确认不能继续扣额;另覆盖同字节重写、替换、权限、额外/临时文件和链接。原十次上限及外部身份、顺序错误仍会停止,不会为了纠错开启无限循环。
PASS:整合版本 215 项相关测试;同一两模块输入在不可变 base 为 49 通过、9 个预期暴露失败,在 head 为 58 全通过且零跳过。九个失败分别是正常纠错、两个 File/SQLite 零写入及六种即时停止反例;其余合法/拒绝路径保留。标准 premerge 六项直接检查、十七项选中检查全过;Ruff、配置 mypy 十七文件、公开边界及重新构建 wheel 的仓库外真实 CLI 拒绝通过。传输为 scripted,CLI、文件系统、File/SQLite 与 shell 隔离真实运行。
FAIL 保留:可选扩大 strict mypy 在同输入 base/head 各有相同的十五个既存 export/annotation 诊断,不记通过。旧 06762d / base 8983636 的必需展示预算 25836/25500 也仍是历史失败;89a8efb 已整合 #7579 的独立测量校准,本 PR 未改阈值,当前完整 premerge 重新通过。此修复没有声称减小输出或获得模型效率收益。
UNVERIFIED:额外 TS 纯预检的完整延迟、真实模型行为/成本、完整发布资格、生产安装及后续主干 9f42f0bc5 的组合。夹具观察只在受隔离的合成目录内成立,不能证明生产/外部副作用回滚。Windows 的权限和符号链接特例仍须相应平台条件;本机未跳过。没有 store/PG authority 实现变化,也没有引入 PG 资格宣称。按当前 Goal 的 wait_for_ci=false,没有读取或等待 CI。
语义与 CI 对齐
重用既有 vision/settlement 词汇;新增 rejection 类型与操作分类仅本地使用,语义 advisory 未发现新增受支持的闭集。协议从仅接收 pure progress 错误扩到经过完整夹具观察的普通 vision 拒绝,这是已公开并实际验证的有界语义变化。原同 actor、身份、预算、计数、结算顺序、立即停止及私密回执义务逐条保留;未把机读强制约束称为建议。
我的整体评价 / Verdict
这是 justified_increment:实际锁前拒绝和完整的有界纠错已经交付,后续 live portfolio 与发布组合继续归发布 owner。long_horizon 的改进限定为原预算内恢复并恰好结算一次,不是因果效率提升;user_experience 的改进是原 CLI 可纠正而无需人工重启,没有新增确认轮次。没有渲染页面变化,visual_review 为 not_applicable;桌面、真实模型理解及生产采用未验证。
结构检查、IO 观察和场景顺序分属原 owner,成本与规模适合已复现的问题。保留 inline 合并与持久回执兼容,不另加 rollback 框架。当前 head/base89a 的作者源码批准与后续目标主干集成/merge-readiness 分开;不得凭此合并或宣布版本发布。
English verdict: APPROVE at 108ee7a against 89a8efb; no blocking finding in the bounded correction slice. Real CLI positive/negative paths, 215 related tests and standard premerge passed. Author self-review only; later-main integration and full release qualification remain separate holds.
Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
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; OpenAI; gpt-6.1-sol; runtime_reported; reasoning_effort=max
Approval conclusion (author-owned PR; GitHub blocks formal self-approval)
APPROVE,未发现此精确源码切片的阻塞缺陷。审查 head 178d9e4296b3fd04b1b3262a9ce1bdf51f5e2c02,base 0d4bf99a4aa6080f2774f3c4477fb4adc1b5ac46;这是作者自审,不是第三方批准。已整合测试开始时的目标主干 0d4bf99a4aa6080f2774f3c4477fb4adc1b5ac46(含 #7600、#7601、#7606),补验上下文恢复消费者;后续合并仍须原生 readiness 和维护者授权。
动机 / Motivation
运行 terminal settlement 资格的维护者,在模型提交格式不合法的完整 vision JSON 时遇到此问题。
原实现先创建 history 锁再拒绝空 vision patch,导致同一模型不能纠正输入;当前在锁前拒绝,并在原十次工具调用内以九次完成验证、写回、一次扣额和终态收尾。
实际 CLI 输入纠错和零写入拒绝已经验证;该 PR 仅交付这条恢复路径。 完整真实模型资格、生产安装、发布渠道和个人指南不由此 PR 认证。 完整真实模型资格、生产发布渠道和本版个人指南仍需发布 owner 在最终候选上验收。
改动思路 / Approach
结构性判断复用现有 TS owner,Python 只负责 CLI 和隔离夹具 IO;不另建状态、调度或权限 owner。
当前 PR 的边界是锁前拒绝与同一 actor 的有界纠错;不把文件观察推广为生产回滚或外部副作用证明。
单改宿主仍会被真实 CLI 已创建的锁文件拦住;忽略锁文件又会把实际修改当作无副作用。当前方案将完整 JSON 的纯结构检查提前,保留正常 writer 对当前状态与权限的检查。宿主用内容和元数据观察夹具,再通过本地类型标记返回拒绝;不会仅凭 appended=false 或错误文字继续。无 vision 和仅 inline patch 的调用仍走原路径。
| 真实触发 | 基线 | 当前 head |
|---|---|---|
| 完整 vision 的空 patch | 先创建 history 锁,调用五结束 | 锁前拒绝,同 actor 可在九次内完成原四阶段 |
| 拒绝后同字节重写、替换、权限或临时文件变化 | 仅错误代码不足以立即识别 | 独立观察发现变化,立即停止 |
| 已写回后进程失败并伪造 false 标记 | 不得当回滚 | 保留已发生事实,仍禁止继续 spend |
具体改动 / Changes
依据已读的 docs/reference/protocols/model-behavior-qualification-v0.md,规格修订固定为 0d4bf99a4aa6080f2774f3c4477fb4adc1b5ac46。该规格中的逐项要求映射如下:terminal-identity 原 Goal/Agent/Todo/Turn 与验证回执保持;terminal-order 验证→写回→扣额→终态顺序保持;terminal-budget 同 actor、十次上限、拒绝也计数且不自动重试保持;terminal-private-receipts 原始命令和工具输出不进入持久汇总保持。live-portfolio 是规格明确分开的低频真实模型发布门,本 PR 不以脚本化传输代替它。此处标识用于定位这些原文要求,不增加新验收标准。
关键代码讲解
handle_refresh_state_command:完整 JSON 在 history lock 之前调用既有prepare_vision_refresh,不采用其返回值替换请求或授权状态转换;仅 inline 的 patch 仍先合并历史,最终 writer 继续检查当前策略。新增的是调用时序,不是 Python 版 vision 判断。snapshot_disposable_fixture:观察整个临时根目录、所有文件内容摘要及 inode、mode、uid/gid、mtime/ctime;读取产生的 atime 不算修改。目录元数据也参与比较,因此创建后删除的临时文件不能凭内容恢复而逃过。符号链接和未知节点直接失败,不借它们观察根外内容。_execute_cli:真实进程非零、JSON 中两个精确 false,加上前后完整夹具相等,才产生内部_UnchangedFixtureRejection。其它异常继续失败。新类型为局部控制流标记,不是公开 schema、持久状态或执行凭证。_execute_terminal_cli:只将该本地标记作为同一模型的瞬时反馈,不推进 writeback 阶段,也不重置预算。成功路径仍核对提交回执的阶段和原身份。
全 diff 为六个文件、229 增加/24 删除;主要新增是原生产入口的回归及反例。没有新 CLI、迁移、前端页面或并行 authority。已搜索既有 vision、工具传输及相邻 replan actor,复用共同机械层并保留各场景独立状态机。
对主干的风险 / Risks
最强反例是实际写入已经发生,进程却返回 ok=false/appended=false。当前验证在真实 CLI 写回之后注入失败,确认不能继续扣额;另覆盖同字节重写、替换、权限、额外/临时文件和链接。原十次上限及外部身份、顺序错误仍会停止,不会为了纠错开启无限循环。
PASS:最终整合版本 321 项 Python 测试、63 项 TypeScript 消费者测试及 TypeScript typecheck 通过。两模块同输入在不可变 base 是 49 通过、9 个暴露失败,在 head 是 58 全通过且零跳过;九个差异是正常纠错、两个 File/SQLite 零写入及六种即时停止反例。标准 premerge 六项直接、十七项选中检查全过,Ruff、配置 mypy 十七文件、公开边界与精确 CQR 通过。重新构建的 wheel 在仓库外实际安装,九个检查源码模块与包字节一致;非法 vision 拒绝不改文件/元数据,两个 CLI 入口的完整/选定上下文读取及摘要不符/残缺引用拒绝均通过。隔离的 Effect 进程已停止。模型传输为 scripted,CLI、文件系统、File/SQLite 与 shell 隔离实际运行。
FAIL 保留:可选扩大 strict mypy 在同输入 base/head 各有相同的十五个既存 export/annotation 诊断,不记通过。旧 06762d / base 8983636 的必需展示预算 25836/25500 也仍是历史失败;目标主干已包含 #7579 的独立测量校准,本 PR 未改阈值,当前完整 premerge 重新通过。此修复没有声称减小输出或获得模型效率收益。
UNVERIFIED:最终 Python 集合另有 5 个显式原生 Codex loopback 选入案例未运行。早一版0a02的417通过/51跳过保留原修订,六个作者文件的base/head blob逐一相同;最终已重跑58终端、263上下文和63TS消费者,不宣称417全部在新head重跑,未把跳过记作通过。真实模型行为/理解及完整成本、额外 TS 预检的整体延迟、完整发布资格和生产安装仍未验证。夹具观察仅对受隔离的合成目录成立,不能证明生产或外部副作用回滚。Windows 的权限、符号链接特例需要相应平台条件,本机这两项实际通过;没有修改 store/PG authority 或声称其新资格。遵循当前 wait_for_ci=false,未查询或等待 CI。
语义与 CI 对齐
重用既有 vision/settlement 词汇;新增 rejection 类型与操作分类仅本地使用,语义 advisory 未发现新增受支持的闭集。协议从仅接收 pure progress 错误扩到经过完整夹具观察的普通 vision 拒绝,这是已公开并实际验证的有界语义变化。原同 actor、身份、预算、计数、结算顺序、立即停止及私密回执义务逐条保留;未把机读强制约束称为建议。
我的整体评价 / Verdict
这是 justified_increment:实际锁前拒绝和完整的有界纠错已经交付,后续 live portfolio 与发布组合继续归发布 owner。long_horizon 的改进限定为原预算内恢复并恰好结算一次,不是因果效率提升;user_experience 的改进是原 CLI 可纠正而无需人工重启,没有新增确认轮次。没有渲染页面变化,visual_review 为 not_applicable;桌面、真实模型理解及生产采用未验证。
结构检查、IO 观察和场景顺序分属原 owner,成本与规模适合已复现的问题。保留 inline 合并与持久回执兼容,不另加 rollback 框架。当前 head/base0d 的源码与受影响消费者已验收;这是作者自审,独立账号审批、维护者的合并及 bypass 授权仍是各自的门。完整真实模型和发布渠道验收继续由最终候选承担。
English verdict: APPROVE at 178d9e4 against 0d4bf99; no blocking finding in the bounded correction slice. Real CLI positive/negative paths, 321 Python cases, 63 TS cases and standard premerge passed. 5 native-Codex opt-ins remain unrun in the final suite. Author self-review; final real-model release qualification and merge authorization remain separate.
Goal And Delivered Outcome
A terminal qualification scenario could not correct a malformed vision document: the CLI acquired and wrote a history lock before rejecting the input, so even the host's strict unchanged-fixture check stopped the scenario. This fixes that real CLI path and returns verified effect-free rejections to the same actor within its original ten-call budget.
maininloopx-project/loopx.Author Declaration
terminal_settlement_tool_behavior.pymodel_tool_behavior.pyproject_lifecycle_refresh_state.pySelf-check: reviewed all six changed files and the existing CLI/vision/file-lock owners. Python remains the CLI and qualification IO adapter; no duplicate state or permission owner was added. The same-domain refactor is a single fixture observation helper and a branded internal rejection result. No new frontend operation or shared state vocabulary is introduced.
Scope And Continuation
Complete for the input-correction defect. Complete vision JSON now receives context-free structural validation before the history lock; inline-only patches retain their history merge, and the writer still performs current state/policy validation. A nonzero result is recoverable only after independent fixture contents and metadata remain unchanged. No lock path is exempted.
The qualification portfolio, repeat count, settlement order and tool budget remain unchanged. Full real-model release qualification, the complete installed-user journey, release channels and the version's personal guide remain separate work; this PR does not certify or publish a release.
Validation
178d9e4296b3fd04b1b3262a9ce1bdf51f5e2c02real_entrypoint/real_backendunit/integrationregression_paritystaticstaticmanualCurrent required validation: standard premerge passes all 6 direct and 17 selected checks, with no manual hold. The exact-scope change-quality receipt matches head
178d9e4296b3fd04b1b3262a9ce1bdf51f5e2c02and immutable tested main0d4bf99a4aa6080f2774f3c4477fb4adc1b5ac46. This head integrates #7600, #7601 and #7606. Their context/recovery consumers pass 63 TypeScript tests and the repository typecheck; the rebuilt installed CLI passes full/selected capture recovery and digest/partial-input refusal through both entrypoints outside the checkout. All nine inspected changed/integrated modules match the wheel source.Retained historical failure: the earlier
06762d5506dc/ base898363635d4737f84b6a673a9a11265a121b6f57attempt failed its required CLI presentation budget at 25,836 / 25,500 characters, identically on immutable base/head. That run remains failed. This branch integrates tested target main0d4bf99a4aa6080f2774f3c4477fb4adc1b5ac46, which already contains the independently measured calibration in #7579. This PR authors no budget change. The six-file authored delta remains unchanged. The same two-module regression inputs yield 49 passes and 9 exposed failures on immutable main, and 58 passes with no skip on this head. Integration checks reran against current source. The earlier broader 417-pass / 51-skip suite remains bound to0a02ed54132bbea0723896b04fe747910368f692; all six authored base/head blobs are identical and affected context consumers reran. Those earlier skips are not passes or full native qualification. The optional expanded mypy check still fails with the same 15 diagnostics on this immutable base and head; the required configured suite passes.The wheel build initially found stale local frontend assets after integration. After the documented frontend build, wheel construction passed; all three changed modules match source, and the installed CLI outside the checkout rejects the invalid input without changing project/runtime files or metadata. Its isolated Effect process was shut down. This is a packaged rejection check, not full release qualification. No source-store or PostgreSQL authority implementation changes are included. Windows cannot exercise the executable-permission and privileged-symlink counterexamples; these two specific cases are skipped there, and native draft authoring requires an available OS isolation backend.
Frontend / Visual Evidence
Type of Change
LoopX Area
Shared-authority RFC fixture impact
N/A: no authority-provider, storage routing or compatibility-projection change. Existing typed vision ownership and File/SQLite boundaries are retained.
Boundary Checklist