Repository navigation
fix(machine-config): isolate capability reads from sibling settings - #7838
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; model=gpt-6.1-sol; provider=OpenAI; source=runtime_reported; reasoning_effort=max
Approval conclusion (author-owned PR; GitHub blocks formal self-approval)
动机 / Motivation
使用已有 PR review、上下文交付与 Goal 默认配置的操作者:即使所用能力配置正确,也可能被另一个能力的旧设置阻断。
原先同一文件中的无关 executor 配置不兼容,会令 review 或 context-config 直接失败;当前 head 只读取调用者实际需要的 namespace,保留合法的 on/off 与 review 策略,自身非法配置仍明确拒绝。
真实 CLI 对照中,原版本被无关设置阻断的四个合法读取场景在当前 head 成功;完整 inspect/preview/apply、非法自身配置和非法外层信封继续拒绝,十个场景配置字节均不变,也未创建 Goal 状态。
本 PR 不修复或激活被忽略的 sibling 配置,不授予写入或执行权限,不改 CI/review 策略、已保存开关或 Goal override,也不交付产品安装、发版或模型效果证明。
改动思路 / Approach
在现有 machine-configuration normalizer/store 增加显式只读 scope,调用者声明所需 owner;完整事务仍默认校验全文。Goal 默认组合的三个依赖与原组合函数放在同一 owner,避免多处手工同步。
本 PR 只交付已有读取链的 namespace 隔离与真实消费者接通;不改保存值、默认策略、完整配置事务或执行权限。
这次区分的是两项原本不同的工作:读取自己能力的策略,与证明整份配置可安全写入。读取前仍检查外层信封和每个所需 owner;忽略的 sibling 既不归一化,也不被认定有效。已有错误必须留给其真正 owner 修复,不能靠读取时吞异常或修改活动配置解决。
具体改动 / Changes
已逐项读完 e7eec6a67342a66a018b867f2fefb106c30ccd7e 的完整16文件 +189/-26 diff。独立依据为变更前 a098263f4fba407f4ee9c9b6f4c3b3d8bfe1c377 的 docs/reference/required-work-context.md; docs/reference/configuration-backup.md,并先读现有 registry、normalizer、store 和完整事务的 owner 定义。
- Machine default — implemented:已有 invocation 优先级、保存的 off/on、Goal override 不变。context/review/periodic-report/explore/cadence/storage 在已有 reader 上显式声明需要的 namespace;没有修改值或用全局 off 绕路。
- Configuration is not activation — implemented:
normalize_machine_configuration的默认namespace_ids=None仍逐项校验全文。显式 scope 必须非空、每个 owner 必须已注册,再验证所选现有值;缺少所选值沿原 default,非法所选值继续拒绝。unknown sibling 可以作为未解释数据保留,不能视为通过了其 owner 的校验。 - Adopt reviewed machine namespaces — implemented:
read_builtin_goal_machine_configuration与已有 Goal composition 同处,恰好读取 explore、cadence、CQR 三个既有依赖,供 history/onboarding/CQR 复用。完整 inspect、preview/apply/remove/rollback 继续走未传 scope 的严格 owner 和既有 revision fence,没有新增半份配置写入接口。
独立同条件实际 CLI 对照使用同一脚本、同一组合配置、离线 PR fixture 与不可变 source:原 a098 在 saved off、saved on、review false 和新增 unknown sibling 四个合法读取场景失败;当前 e7 十个场景的独立 oracle 全通过。完整 inspect/preview/apply 仍因非法 sibling 拒绝;非法自身 mode 和非法外层字段保留各自错误;unknown sibling 的 full inspect 仍拒绝。所有调用前后配置 bytes 相同,没有创建 Goal 状态。这是实际调用者与文件系统证据,不是只验证新 helper 的自洽性。
对主干的风险 / Risks
核心4模块 100 passed、8 skipped;直接受影响的 periodic-report、explore、new-Goal storage 与 onboarding 6模块另 141 passed。总计241通过,8项跳过均为既有显式 native benchmark binary opt-in,未拿跳过项冒充资格。Ruff、仓库配置17个 mypy targets、RFC/diff、standard premerge 的6项直接检查和11项 selected/executed checks 均通过。
当前 checkout 的整体 premerge 另有 quality_stale_receipt,scope已随 base/diff变化,未把它说成整体通过,也未由本 review 写入新的 passing receipt。CQR/merge readiness 由其原 owner 对现行完整 scope 更新;本次代码批准不清除此 hold。较早 source checkout 的无关配置错误、作者中断的宽范围运行及测试调用错误均保留历史状态,不冒充本轮独立回归通过。没有查询、轮询或等待 CI;未知 CI 不成为本轮代码批准的前置条件。
最大风险是把 partial read 当作 full validity,或者漏掉真正依赖。调用者搜索确认完整写入/回滚未传 scope;Goal helper 的三个 tuple 与当前 composition 的三个调用一致。非法 selected owner、missing owner、unknown sibling、外层信封、显式 Goal override 和完整写入负例共同覆盖了“解除过度阻塞”与“仍应拒绝”两个方向。只读 scope 不涉及配置修复、cache 或新状态,回退仍可还原原先完整读取行为。
我的整体评价 / Verdict
已检查 existing context-config、PR review、Goal history/onboarding 和 machine-config 事务调用链;没有设置页面或布局改动。原设置 editor 仍复用严格的完整事务 owner。
独立执行为 macOS、合成机器配置、真实 source CLI 和离线 PR fixture:241 passed,8 项既有 native opt-in 测试未启用;10 场景同条件 CLI 对照另列。未启动模型、CI 或产品安装,不证明整次发布或真实模型资格。当前 checkout 的 CQR scope hold 保留。
这是同一配置 owner 内的有界修复,让既有调用者无需修改别人的设置即可恢复有用工作;也保留了自身错误和完整写入的真实拒绝。三个 Goal 依赖的读取与组合同处,降低下一次修改时的重复同步成本。未发现当前精确 head 的阻断代码问题;批准与 CQR、合并、安装和最终发布资格继续分别判断。
English verdict: APPROVE for #7838e7eec6a. Independent actual-CLI base/head counterfactuals and241 tests verify isolated reads, unchanged saved intent and strict own/full-document validation. CI was not consulted. Current-checkout CQR scope qualification remains a separate merge hold.
Capability readers normalized every saved machine namespace before consulting their own policy. An incompatible setting owned by another capability could therefore block PR review, change-quality preparation and default-on context delivery even when the requested capability setting was valid.
Add explicit read scopes to the existing machine-configuration reader and migrate consumers to the namespaces they actually use. The existing Goal-default composition owns its three dependencies in one helper. Read scopes validate the envelope and each requested owner; missing selected values retain normal default resolution. Sibling values remain untouched and are not certified. Whole-document inspection, preview/apply and rollback retain their existing strict validation and revision fences. No saved preference, execution authority or review/CI policy changes.
Validation: 62 decisive contract, Goal-default, PR-policy and context on/off tests passed. Canonical mypy (17 configured targets), Ruff, semantic advisory, public-boundary scan and standard premerge passed. A wider optional module run was stopped after release-first prioritization: 181 passed, 8 explicit native opt-in skips and 2 errors in a new test calling a receipt-count helper without its required Turn argument. That assertion was corrected to check absence of all Goal state and is covered by the passing decisive run. The interrupted run is not a complete regression pass. Final committed-head quick premerge is recorded separately. No paid model calls, installed delivery qualification or benchmark outcome claim.