Repository navigation
fix(context): isolate native output defaults from capture IO - #7938
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.
Approval conclusion (author-owned PR; GitHub blocks formal self-approval)
动机 / Motivation
运行仓库既有严格 mypy 检查、生成 Turn 结算计划或读取 native context 分页的开发者和宿主消费者。 结算计划只需要一个输出预算常量,却从完整 capture IO 模块导入它,间接把大量不在声明检查入口内的依赖拉入原严格类型检查,原命令报 786 项错误。 同一组五个既有常量和预算函数移入无 IO 的 leaf module,生产消费者改从此处导入,旧路径显式重导出;原 17 个 roots、strict 配置和命令不变,当前 head 检查通过。 不宣称整个仓库类型无错、完整 TS 变绿、安装版或真实 Codex/模型采用、完整 C1/冻结实验资格、性能或全成本收益;不改变既有质量检查和合并门。 原依赖图内的类型债、完整 TS 的既有 unused binding 失败及一次较广 Python 试跑中的遥测关闭失败仍分别保留;真实宿主/安装采用继续归既有 context/runtime owner,当前 review 不将它们记为已修复。
改动思路 / Approach
常量属于既有 native transport profile;复用原常量和值,显式保留旧 import 路径,比让一个 scalar 依赖 capture IO 或新增懒加载/类型忽略更直接。真正结算决策仍在现有 TypeScript owner,没有新 Python policy owner。 当前 PR 只闭合 import 依赖边界及其兼容性:不修复那 786 项原依赖图错误,不缩小配置 roots,不修改 reader、结算规则、持久状态或预算值。 入口、原数据和权限仍由既有 owner 负责,helper 不产生新业务状态、工具授权或结算义务;失败和恢复仍沿原调用路径处理。用文字说明这个局部依赖/输入变化已足够,没有另加未验证渲染的图。
具体改动 / Changes
依据是先读的不可变 base f941b5939345c6d1c3d770a982182624e7ef393f 中 Quality Layers / 质量分层:Keep the declared strict source-checkout validation scope and real-path correctness; remove an unnecessary import dependency without changing defaults, emitted commands, capture bytes, negative refusals or settlement effects. 本 head 对这一 criterion 的映射为 implemented;它是可独立使用的 justified_increment,不把本 PR 新改的文档当作自身验收 oracle,真实宿主与 parent 完整成果仍属上述 remaining gap。
关键代码讲解
native_context_page_budget所在 leaf 仅含原五个字面常量和原 tuple helper,无 IO、环境读取或新 policy。旧 decision_capture 路径显式 alias,值只有一个 owner。build_turn_scoped_cli_settlement_plan只改 scalar import 来源,真实决策仍委托 TypeScript;实际完整四种 Todo/replan × ordinary/in-flight 计划的命令、身份、前置条件和 guidance 两端相同。read_context_capture原 SHA、UTF-8 cursor、预算与错误路径未改。相同 360057 字节 capture:默认 6 页、8192/3200 较小预算 143 页,两端全部原内容/输出相等;wrong digest、negative offset、zero budget 均同样拒绝。cold-import test用新 subprocess 检查因果依赖边界;独立实际 probe 在 base 加载 capture IO、head 不加载,避免 module cache 制造假阴性。
同环境执行原 python -m mypy --no-incremental,PYTHONPATH unset,未改 17 个 roots、strict 配置、Python 3.14.8/mypy 1.20.2/58 个锁定依赖:base 786 errors/125 files,head Success:17。这是移除多余依赖,不是修好了 786 项底层错误。四个生产模块的其余函数/class AST 相等。完整当前 settlement CLI 模块在两端各 167 PASS,实际隔离 File/SQLite 覆盖 guard→refresh→one spend→replay→readback;control-plane typecheck PASS。
对主干的风险 / Risks
完整 npm run test:control-plane 两端各 5906 PASS/1 FAIL/77 conditional SKIP:同一 content_digest_single_owner.test.ts:897/913 断言 delegation.ts 引入 ENVELOPED_SHA256_PATTERN 却未使用;完整失败块仅规范化 checkout 路径和耗时即相等,因果 source/test/package/lock/config 未改,已有 #7936 负责修复。它仍是 FAIL,不能写成全 TS 通过。
较广八模块原试跑另有 376 PASS/1 FAIL/46 SKIP:gitless settlement [False] 的所有结算/身份/one-spend/replay 断言后,在 test916 最后 usage_ping.control("disable") 抛出 settings unavailable,底层 payload 未捕获,原因仍 unresolved。同节点随后两端各 1 PASS、完整当前 CLI 模块两端各 167 PASS;没有代码/夹具/预算改动。判断当前 import-only 不变量已有完整四计划、整页字节/拒绝与真实 CLI 的独立证据,保留本次历史失败为非必需 diagnostic,不将其猜成 pre-existing/external,也不声称遥测不稳定已修复。46项 conditional native skips 不是安装版/模型资格。
Independent standard premerge:5 direct checks PASS;18 selected,17PASS+1 inherited maintainability advisory;0 blocking failure/skip/manual hold. Diff-scoped advisory found0 new carriers before full semantic validation. Raw ratchet and full TS failure remain FAIL. 原始 ratchet 在不可变 base 和当前 head 的完整 393 字节 stdout/空 stderr 相等,唯一未 review 的 render_canonical_todo_sections 因果源文件 whole blob 未变;因此归为 pre_existing_unrelated,原失败和作者 CQR FAIL 均保留,没有调阈值、改 checks 或新建通过 receipt。没有查询、轮询或等待 CI;CI unknown 不替代已执行的改动不变量验证,也不单独否决 review。
语义与 CI 对齐
复用现有 vocabulary/typed owner;没有 prose substring classifier、通用控制面中的 domain-specific obligation 或把强制义务叫作 guidance。Only the import graph changes: source-checkout strict mypy --no-incremental, with PYTHONPATH unset and the same17roots/config/dependency versions, changes from786errors/125files to Success17. Defaults64000/64000/64000/history20000/env name, complete emitted guidance and original reader/settlement behavior remain equal. Applied now: a dependency-free leaf and direct imports remove the unnecessary IO dependency without lazy magic, TYPE_CHECKING suppression, changed roots or duplicated policy. Further splitting transport constants is unnecessary. 本评审只判断完整 exact-head 改动与证据,未豁免独立 change-quality、readiness 或 maintainer merge authority。
我的整体评价 / Verdict
对 7938@da08cfc33fbf23341b1f539e618d330ea1851ec2 的结论为 APPROVE,无已验证的当前改动 blocker。既有 CLI 命令、错误、分页回读和结算入口不变,开发者恢复使用原类型检查命令,无需用户重新配置预算、复制输入或增加确认轮次。 One17-line leaf and explicit legacy aliases replace unnecessary import coupling. No runtime performance or total-cost claim follows from fewer mypy-transitive files. Existing paging/full-history budgets and actual settlement effects are unchanged. long_horizon 判断为 preserved,user_experience 为 preserved;Existing source-checkout Quality Layers contract and immutable strict configuration, plus real paired API/settlement evidence, independently bound this dependency-only repair. 当前 PR 只闭合 import 依赖边界及其兼容性:不修复那 786 项原依赖图错误,不缩小配置 roots,不修改 reader、结算规则、持久状态或预算值。 已检查完整6路径及既有 Chat/CLI 调用:没有渲染页、布局、首屏或设置编辑器变更。 没有视觉改动需截图;未宣称已安装 App 或真实宿主采用。 原依赖图内的类型债、完整 TS 的既有 unused binding 失败及一次较广 Python 试跑中的遥测关闭失败仍分别保留;真实宿主/安装采用继续归既有 context/runtime owner,当前 review 不将它们记为已修复。 GitHub 作者同账号以 COMMENTED 承载批准结论,不能称为正式自批准;原质量红项及必要合并门继续单独保留。
English verdict: APPROVE the reviewed exact head; independent local evidence covers the changed invariants, with disclosed failures and unverified adoption retained and no quality-gate or merge waiver.
The strict 17-file Python kernel check follows a full quota/Goal routing graph because settlement command assembly imports one native output constant from
decision_capture. At basef941b5939345c6d1c3d770a982182624e7ef393f, the declared mypy command reports 786 errors in 125 files. Removing that one import in an isolated diagnostic copy restores the existing check; the diagnostic constant copy is not part of this proposal.Move the existing five native transport defaults and budget helper to a dependency-light profile, point the settlement/reader/lifecycle callers at it, and preserve explicit compatibility exports from
decision_capture. All original values, guidance strings, command policy and explicit smaller recovery budgets remain unchanged. Python retains scalar transport configuration; this adds no decision owner, state schema, capability or frontend operation. The bounded refactor keeps an existing shared configuration with its actual consumers.Validation at
da08cfc33fbf23341b1f539e618d330ea1851ec2:uv run --extra test python -m mypy --no-incrementalpasses all original 17 roots, without aPYTHONPATHoverride. The new cold-import regression fails on base and passes on head.ENVELOPED_SHA256_PATTERNbinding indelegation.ts, independently proposed in fix(collaboration): remove unused digest owner binding #7936. All TypeScript sources and tests remain unchanged from the base. This required failure stays blocking.CQR receipt
cqr_d876e819e582cfabbfbdrecords the exact scope as fail becausefull-typescriptis a failed required validator. No baseline waiver or test exception is requested. Premerge: all six direct checks passed; 18 catalog/risk checks executed: 17 passed, 1 maintainability-ratchet failure classified by the existing canary owner as inherited advisory. The advisory names unchangedtodos/machine_section_projection.py::render_canonical_todo_sections; it remains disclosed. Its final gate remainsquality_invalid_receiptfor the failed required TypeScript validation recorded in CQR. This is a merge hold, not a passing premerge result. Independent review, required CI and ready merge-readiness remain outstanding; this proposal grants no merge authority.Initial native checks skipped without an explicit binary; the qualified run above supplied it. Initial package/probe setup failures (missing generated frontend assets and incomplete synthetic configuration setup) were retained and resolved before the successful wheel runs. Generated assets and raw evidence are not committed. This is a source proposal with isolated qualification, not a global installation or a release.