Repository navigation
Preserve native arguments in heartbeat admission tests - #9311
Conversation
Signed-off-by: LoopX Agent <[email protected]>
loopx-agent
left a comment
There was a problem hiding this comment.
Reviewer: model_agent · gpt-6.2-sol · OpenAI · runtime_reported · xhigh
动机 / Motivation
维护 benchmark heartbeat worker 的开发者需要用既有用例区分启动拒绝和一次成功启动。 主干传入 native_hook_args,但测试用的回调只接受位置参数。File 与 SQLite 的八个组合都在回调处抛 TypeError,进不了原先的检查。 让现有测试封装把参数原样转给 worker 原命令,从实际 native 启动边界复验当前 Goal 的准入。
在两份精确源码上跑同一个 test_benchmark_current_admission.py。仅变更回调签名与转发,保留原断言和正式调用者。 候选用确定性子进程完成两个 provider 的成功场景,各只启动一次,业务输出可读。候选整组 14 项通过。
在 session 已选的阶段验证源侧额度为零、状态文件缺失和 Stop,分别用 File 与 SQLite。 三个拒绝场景均到达原断言并拒绝启动。 六个组合保留拒绝语义、原 session 绑定和无扣额断言。基线八个失败都指向同一意外关键字,其中包括两个成功场景。其余六项基线和候选均通过。 验证用原生调度代码、确定性模型子进程和隔离 File/SQLite 状态。远端 CI 未查询。
改动思路 / Approach
仍在 heartbeat worker 已存在的 native 入口发起相同流程。子进程测试将预期拒绝与正常结果关联到当前权威来源。 转发关键字即可恢复既有检查,无需调整产品逻辑、降低断言或新增 mock。
具体改动 / Changes
关键代码讲解
评审头 71f3499,合并基线 6bda51b。1 个文件,+2/−2。 依据 Current source admission at the actual native invocation 和 Deterministic refusal or subsequent subprocess with real worker arguments 核对现有入口。 仓库规范 现有 worker 入口
- after_session_selection。接受并转交真实入口的 kwargs,同时保留缺失状态和 Stop 的时序注入。 代码
- native_command。命令构造器接收 native_hook_args。 代码
- worker.run_once。实际调用 current native command,再由原断言核查结果。 代码
对主干的风险 / Risks
语义与 CI 对齐
基线 8 项 TypeError、6 项通过。候选整组 14 项通过,Ruff 通过。快速 premerge 5 项直接和 3 项选中检查通过。用例内保留了真实本地 subprocess、File/SQLite 和原断言。 整组在两边用同命令运行。只把同一个 TypeError 作为基线故障,核对新测试仍执行源状态、绑定与扣额断言。
我的整体评价 / Verdict
同意此提交的代码改动。继续使用原有 provider 矩阵与真正的 native invocation。 基线八个确定失败在候选均已转为通过。
English verdict: APPROVE — forwarding native keyword arguments restores all eight File/SQLite heartbeat cases while preserving the existing launch and refusal assertions. Exact head 71f3499.
Outcome
Restore the existing heartbeat worker admission tests for File and SQLite. The worker passes
native_hook_argsto its native command. The test callback accepted only positional arguments, so all eight cases raisedTypeErrorbefore exercising the intended Host path.The callback now forwards keyword arguments to the original command. The zero-quota, missing-state, Stop, and successful-execution assertions keep their existing coverage. The only changed file is the existing test module.
Validation
71f3499717f975bcbad7605f867da88fef083585on6bda51b5d9fe9b68900a2e806911538aa67603b5.Author tooling: OpenAI Codex, GPT-6.2.