Skip to content

Isolate private capture platform support from quota type checking - #9549

Open
loopx-agent wants to merge 1 commit into
mainfrom
codex/kernel-typecheck-capture-profile
Open

loopx-agent wants to merge 1 commit into
mainfrom
codex/kernel-typecheck-capture-profile

Conversation

@loopx-agent

@loopx-agent loopx-agent commented Nov 27, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Quota settlement uses the host's private capture support to decide whether to include a paged output option. The former local import pulled capture orchestration and its application dependencies into the strict kernel type check. Move the platform predicate to the native context profile and share it with the existing capture API and quota planner.

The platform contract still requires a POSIX host with a callable getuid. The test exercises Windows, POSIX without getuid, and supported POSIX against the same predicate, the capture UID boundary, and the generated settlement command.

Validation

  • The unchanged python -m mypy command reports 3,992 errors in 402 files on base 509360fb0d3e. The candidate passes all 17 configured sources with Python 3.11 and mypy 1.20.2.
  • The same command passes when this patch is applied to the exact Steward return candidate at 68c57b27de29.
  • The existing strict Todo adapter command, selected Ruff checks, standard premerge canary, and CLI output budget smoke pass.
  • Five targeted platform and real File/SQLite settlement cases pass. The TypeScript control-plane suite passes 6,887 cases with four skipped. Seven TLS remote-authority and three Python gateway cases pass.
  • Broader Python runs reproduce the same two replacement-lease readiness failures on both revisions, one per backend. The base has 223 passes and 10 skips. The candidate adds the settlement unit suite and has 308 passes and 11 skips. Both runs preserve their two failures.

Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>

@loopx-agent loopx-agent left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewer: model_agent · gpt-6.2-sol · OpenAI · runtime_reported · xhigh

Approval conclusion (author-owned PR; GitHub blocks formal self-approval)

通过本次精确提交评审。

动机 / Motivation

维护 LoopX 配额结算的开发者需要用现有严格类型检查验证改动。 在主干运行既有 python -m mypy 时,结算计划的一次延迟导入把检查带进包括宿主捕获编排的依赖图,产生 3,992 条错误。 同一条命令既要在检查阶段保持小而可审计的范围,也要按当前平台生成可执行的扣额命令。 候选在相同配置下恢复 17 个输入文件全部通过,实际计划在三种平台条件下产生与基线逐字一致的命令。 此次只调整判定的依赖方向。平台资格、结算、回执记录与恢复由现有入口负责。

改动思路 / Approach

让规划器和捕获 API 都从已有 native context profile 读取同一个判定,保留旧模块的再导出。 Profile 持有无 I/O 的宿主条件,规划器只组装 CLI,捕获模块仍持有私有文件校验。 保持原私有捕获资格与标志、原始结算绑定、失败和重放语义。 四个文件净删 15 行,通过再导出保留老调用。没有新的选项、持久状态、用户动作或平台激活条件。

具体改动 / Changes

精确提交 8796549。目标基线 509360f。4 个文件,增加 19 行、删除 34 行。核对严格类型检查与依赖边界(strict-kernel-import)、私有捕获资格(private-capture-capability)、原轮结算与回执(original-settlement-receipts)。 原始契约

关键代码讲解

  • build_turn_scoped_cli_settlement_plan。生成扣额命令时由共享判定控制 64000 字节分页参数,沿用原 Goal、Todo 与 Turn 绑定。 源码
  • private_capture_supported。把 POSIX 且存在可调用 getuid 的原条件放入已有输出 profile。 源码
  • private_capture_uid。保留旧导出和身份失败出口,为原有私有文件校验返回当前 UID。 源码
  • refresh settlement result delivery。捕获不可用时把已结算结果与原回执留在内联响应。 源码

对主干的风险 / Risks

用全新的 Python 进程实测基线构造计划后载入 decision_capture,候选未加载。POSIX/Windows 条件用合成对象验证,POSIX 可调用 getuid 保留页参数,Windows 和 POSIX 缺 getuid 均省略参数且保留原错误。四个 File/SQLite 用例确认捕获不可用或失败后,仍能按原身份和三张回执恢复,原轮只扣一次。 Python 3.11.17、mypy 1.20.2 下,基线 402 个文件报 3,992 条错误,候选及叠加 #9547 后均为 17 个配置输入全通过。候选 Python 89 通过、1 跳过、2 失败,基线 90 通过、1 跳过、2 失败,候选将两项原平台测试合成一个参数化用例。Ruff 和 git diff --check 通过。

语义与 CI 对齐

File 与 SQLite 的替代租约用例在基线和候选均于第 819 行失败。原 Turn 再入时 normal_delivery_allowed 返回 true,预期 false。失败发生在执行后续写回拒绝与扣额断言之前。 独立范围是 macOS 上的 Python、真实隔离 File/SQLite、合成 Windows 和缺失 getuid 条件。原生 Windows、生产隐私存储和远端 CI 未复验,原租约替换用例仍需单独修复。 租约替换断言

我的整体评价 / Verdict

APPROVE。 严格类型检查恢复,依赖边界在实际调用中收窄。捕获后的重读保持原语义,结论限定于这次依赖调整及其直接影响的结算路径。 以原规划器和捕获 API 的输出对照约束这次小改动,保留租约回归的失败记录。 固定主干与候选复用相同 Python 环境,按 File/SQLite 对齐失败位置、条件和断言,再独立运行冷导入、命令和 UID 对照。

English verdict: APPROVE at 8796549. The unchanged strict mypy check passes all 17 sources. Paired File and SQLite runs preserve private-capture failure handling and exact settlement replay. Two replacement-lease readiness failures also reproduce on main.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant