Repository navigation
fix(quota): declare adaptive admission RPC return type - #8050
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)
动机 / Motivation
运行仓库 strict mypy 和使用现有自适应准入适配器的贡献者。同一17-source strict mypy 在不可变基线因 RPC 的 Any 返回触发 no-any-return;此 head 用已有 typing.cast 习惯声明原 dict/null 合同后通过,44项冻结准入输出与17项 TS owner 测试两端保持通过。恢复既定静态类型检查,保留同一个 RPC 请求、TypeScript 决策 owner、返回对象和拒绝路径。不增加运行时校验、能力、权限、默认策略或返回 schema,不以 focused 通过清除作者保留的完整 pytest/aggregate 合并资格 hold。
本评审绑定 641ed7ef42fc155abffc7dd86c844fbff59664fa。实际三点差异的不可变 merge-base 为 d29ec8bf2a105aac24629bcbf3dfb7c97aea51fe;packet 的 target main tip 2fd68e88313a34f2a6bbabf51c61a853964b01fa 已前进,不能把它误当成这一个提交的基线。未发现该差异的阻塞性代码问题,质量资格 hold 保留;作者同账号用 COMMENTED 承载结论。
改动思路 / Approach
在具体 Python adapter 复用相邻 typing.cast 惯例声明已有返回合同,generic RPC 保持 Any,TS 保持唯一准入决策 owner。本 PR 只修静态返回类型;cast 返回原对象,不新增 runtime validation、配置或能力。作者保留的完整仓库资格另行验收。这个适配器原本就承诺 dict/null,而通用 RPC transport 服务多种结果,声明为 Any 合理。改整个通用返回类型、增加另一套 decoder 或插入 runtime 校验都会扩大行为边界。这里让具体消费者声明既有合同即可;cast 直接返回原对象,并不验证返回内容或授予任何准入权。
静态检查通过必须与原运行语义一起判断。因此同时检查真实 TypeScript 返回分支,以及未改的完整 JSON、Markdown、RPC 次数冻结 oracle;不能只凭消掉一个 mypy 报错同意。
具体改动 / Changes
关键代码讲解
build_adaptive_task_orchestration_contract保留全部输入规范化、同一个 RPC method 和每个参数,只把原返回暂存为 contract,在第138行 cast 为已有 dict/null 类型。- 通用
effect_runtime_result仍返回 Any;没有新请求、重试或错误吞掉。原异常在 cast 前传播,合法 None 保持 None。 - 既有
admitAdaptiveChildren是 JsonObject/null 的唯一实际决策 owner,继续处理选举、依赖、能力、仓库和 scope;相邻 task_orchestration.py 第342行也使用原 cast 惯例。
没有专门的已接受书面类型修复规格;按 PR 明确的复现任务与现有 consumer/TS return 合同判断。完整差异仅 1文件3增2删,没有 Enum、状态、默认开关、schema 或 provider 变化。
同一命令 uv run --extra test python -m mypy --no-incremental:基线在适配器110行报1个 no-any-return,此 head 17 sources PASS。完整 frozen characterization 与 admission 两模块 44 passed,TS owner 17 passed,真实 task-orchestration-smoke.py 的 quota→TurnEnvelope→native request plan 在两端通过;没有真实子 Agent/模型执行。冻结 fixture、两个 Python 验收模块、TS owner、generic RPC、caller 与 pyproject 整个 Git blob 均未改;ignored 生成 lock 的实际字节也相同。
原 oracle 比较完整 JSON/Markdown 和 crossing 次数;mode_off 零 RPC,其余适用直接准入恰一次,null、其他 coordinator、缺 capability、User dependency、仓库/scope 边界及保留校验声明均仍受检查。Ruff PASS。standard 实际 6 direct+13 selected 通过;同基线/head ratchet 全通过,不继承 preview 的旧失败提示。
对主干的风险 / Risks
最强风险是 cast 掩盖不一致的真实 producer;它自身确实无法拒绝错误运行值。这里核对了真正 TS JsonObject/null 签名和返回分支,并执行不依赖新 cast 的既有冻结 oracle/真实 RPC/CLI 路径;这才支持原合同成立。生产决策、默认、权限和错误路径不变,回退仅需撤销一处类型声明,无状态迁移或额外用户准备。
作者当前 frame 将完整 repository pytest / aggregate required qualification 保持 unqualified/blocking。本轮聚焦改变边界的独立验证,未运行全仓库或查询远端 CI;未知全套结果/原因保持未知。精确 CQR 以 required skipped 行和 test_validation hold 实际记录为 FAIL,整体 premerge 仍 quality_invalid_receipt。focused green 不清除这个独立合并门,也不把未执行写成通过或实际失败归因。
初次本地准备错误地要求 target tip 必须等于 merge-base,在源码审查前停止;随后按 Git 真实 merge-base 恢复准确比较,未 rebase 作者或扩大差异。验证环境的 uv.lock 在两提交都非 Git tracked file,已按物理环境比较而非伪称修改/保留一个不存在的 Git blob。
我的整体评价 / Verdict
同意这个最小、完整的静态类型修复。在具体 Python adapter 复用相邻 typing.cast 惯例声明已有返回合同,generic RPC 保持 Any,TS 保持唯一准入决策 owner。本 PR 只修静态返回类型;cast 返回原对象,不新增 runtime validation、配置或能力。作者保留的完整仓库资格另行验收。同一 mypy 的失败→通过与全部原语义检查共同提供证据,不要求本 PR 为其他 consumer 创建公共 schema 或重写 typed owner。
已检查完整差异及实际 Existing apply_task_orchestration_contract→build_adaptive_task_orchestration_contract→effect_runtime_result→typed admitAdaptiveChildren.;没有 rendered page、布局、设置或新调用者能力变化,视觉评审不适用。未验证范围:未验证安装 Host/model、跨平台与长期完整成本;完整 repository pytest/aggregate required资格仍未完成。原调用者额外必需交互轮数为零,没有安装、模型切换、权限或真实 worker 启动。本 COMMENTED 批准判断与完整仓库质量及合并资格分开,不授予合并权。
English verdict: APPROVE — 641ed7ef42fc155abffc7dd86c844fbff59664fa restores the established adaptive RPC return declaration; the same17-source mypy passes and44 frozen/admission cases,17 TS tests and the native request-plan smoke retain parity. Full-suite/aggregate qualification and CQR remain held; no installed-host or merge authority is claimed.
Goal And Delivered Outcome
The configured strict mypy workload fails on the adaptive admission adapter: its declared
dict[str, Any] | Nonereturn receivesAnyfrom the generic RPC transport. Declare that established return type withtyping.cast, following the adjacent adapter idiom. The TypeScript admission function remains the sole decision owner; request arguments, default-off behavior and errors stay unchanged.no-any-returnon main atd29ec8bf2a105aac24629bcbf3dfb7c97aea51fe.main.Author Declaration
build_adaptive_task_orchestration_contractand TypeScriptadmitAdaptiveChildren, at the base above.loopx/control_plane/quota/task_orchestration_admission.pySelf-check: reviewed the final one-file diff, repository instructions, adjacent adapter idiom, RPC transport and TS return signature. No reviewer safe-fix was necessary.
Scope And Continuation
The implementation is complete within this type-only adapter repair. It adds no capability, policy, default, protocol vocabulary or provider routing. The cast returns the existing RPC result unchanged; it does not add runtime validation. Reverting the one commit restores the prior typing behavior. Complete CI qualification and independent exact-head review remain required before merge. This PR does not qualify installed Host execution or long-horizon outcomes.
Validation
641ed7ef42fc155abffc7dd86c844fbff59664fa(the exact candidate diff tested before commit).uv run --extra test python -m mypy: same configured 17 sources; immutable base failsno-any-return, candidate passestest_adaptive_child_admission_characterization.pyandtest_task_orchestration_admission.py: 44 passed on both base and head; frozen oracle unchanged, including null/default-off, election, capability/authority boundaries and RPC countsadaptive_children.test.ts: the same 17 TS owner tests pass on base and headexamples/control_plane/task-orchestration-smoke.py: quota → TurnEnvelope → native Host request plans pass on exact base and candidate; no real Host/model executionfail; required validation remains blockingThe focused checks cover the changed return boundary without modifying any expected outputs or validation rules. They do not establish full-suite health, independent review or installed adoption.
Frontend / Visual Evidence
UI impact: none. No caller capability, frontend/Lark/CLI journey, settings, presentation or state transition changes. Screenshots and provider promotion rehearsal are not applicable to this static typing repair.
Type And Area
Boundary Checklist