Repository navigation
feat(eval): settle host usage and per-request pricing - #6849
Conversation
6af4c42 to
1cfa874
Compare
44441d2 to
c5577bc
Compare
8f9b9db to
b00e363
Compare
EnglishReviewed commit: The pure-library boundary is sound: immutable attempt facts, appended recovery evidence, shared adjudication for selection/admission/projection, and centralized token pricing are useful foundations for #6667. Before building the store and runner on this contract, I would address the incorrect retry below, explicitly settle the resampling policy, and simplify the duplicated spec parser. 1. Correctness: a verifier-confirmed subject failure can become retryable infrastructure failure. Please fix before merging. Location: The lower-bound metering gate checks only I reproduced this through {"kind":"subject_failed","score":0.0,"reason":"subject budget exhausted"}Both have The first path also projects to v1 Please base metering eligibility on the combined subject/verifier classification, so a verifier-confirmed subject failure receives the same failure policy as the corresponding subject-reported failure. A focused behavior test should retain the failure and its reward and reject retry. The current suite does not exercise 2. Measurement policy: a post-hoc billing conflict reopens sampling for an already selected result. This consequence needs an explicit decision. Locations: Starting from a completed, verified zero-score attempt with Downgrading conflicting billing evidence to #6667 allows derived eligibility to change under explicitly versioned rules, so I am flagging a policy gap here rather than claiming that every eligibility change is forbidden. Please decide and document whether a billing conflict only invalidates full cost, or also invalidates the capability result and authorizes resampling. If the latter is intended, record that semantic decision and add a behavior fixture covering selection, v1 score, and retry admission before and after recovery. The existing conflict assertions cover usage/cost but do not pin down these experiment-level consequences. A concise documented rule and fixture are sufficient; this does not require a runtime registry or another state machine. 3. Simplification: the experiment schema's field structure is maintained twice. Locations: the spec types and serde declarations, lines 71–133, and The typed declarations already describe the nested fields, enum variants, and serde rules. The manual parser separately maintains required/optional field lists, enum strings, value extraction, and reconstruction of the same structures. Adding a field requires keeping both representations aligned. Please converge on one authority for field shape: let serde handle structural/type/required/unknown-field checks, and keep custom logic for the actual semantic constraints—identifiers, uniqueness, supported schema versions, and numeric compatibility. In particular, preserve the intentional acceptance of integer-valued JSON floats such as Validation: Review prepared and posted by OpenAI Codex at M4n5ter's request. 简体中文审查提交: 这个纯库的边界是合理的:原始 attempt 不可变、recovery 追加、选择/准入/投影共用判定入口、Token 计价集中管理,都能作为 #6667 的基础。在 store 和 runner 继续依赖这份契约之前,建议先修复下面的错误重试,明确重新采样的规则,并收掉配置解析里的重复维护。 1. 正确性:verifier 已确认的 subject failure 会被改判成可重试的 infrastructure failure,建议合并前修复。 位置: LowerBound 计量检查只看 复现走的是 {"kind":"subject_failed","score":0.0,"reason":"subject budget exhausted"}两者都是 第一条路径还会投影成 v1 建议根据 subject 和 verifier 的联合分类应用计量 eligibility,让 verifier 确认的 subject failure 与对应的 subject 自报失败遵守同一套规则。补一个验证“保留失败及 reward、禁止重试”的行为用例即可。现有测试没有覆盖 2. 测量策略:事后计量冲突会重新开放已选中结果的采样,这个后果需要明确裁决。 位置: 从一条已完成、已验证、得分为 0、计量为 冲突计量降级为 #6667 允许通过明确版本化的规则改变 derived eligibility,因此这里指出的是策略缺口。请明确:计量冲突只使完整 cost 失效,还是连能力结果一起作废并允许重新采样?如果选择后者,应记录这个语义决策,并用行为 fixture 固定 recovery 前后的结果选择、v1 分数和重试准入。现有冲突断言覆盖了 usage/cost,还没有固定这些实验层面的后果。简短的规则说明和 fixture 就足够,无需增加运行时 registry 或另一套状态机。 3. 简化:实验配置的字段结构维护了两份。 位置:配置类型及 serde 声明,第 71–133 行,以及 类型声明已经描述了嵌套字段、枚举和 serde 规则,手写 parser 又分别维护 required/optional 字段名单、枚举字符串、值提取和相同结构的拼装。以后新增字段,需要同时维护这两份表示。 建议把字段结构收敛到一个 authority:由 serde 处理结构、类型、必填及未知字段检查;手写逻辑保留 identifier、去重、支持的 schema version 和数值兼容等语义约束。特别要保留当前有意支持的 验证: 本评论由 OpenAI Codex 按 M4n5ter 的要求整理并发布。 |
|
Quick status update: I'm keeping this PR in draft for now while #6938 lands the single-trial Harbor container + native Rust Host execution and metering loop first. Once #6938 merges, I'll rebase this branch onto 简短同步一下状态:当前先推进 #6938 落地单题 Harbor 容器执行与原生 Rust Host 计量闭环,本 PR 暂保持 Draft。等 #6938 合入后,我会基于 Posted via Google Antigravity on behalf of @Colafornia. |
571caa5 to
2c30dd6
Compare
Astro-Han
left a comment
There was a problem hiding this comment.
I found one P2 in the new fixture at 2c30dd6c1b27bcd8653e06d2239744acf53feb5c: it fails the repository's JSON formatting gate.
The original tooling job 133414387588 checked merge commit bc2b2c6c6aa981bf2da4888f91cd3a779c37c327. biome format . reports exactly one file, products/eval/tests/fixtures/ts_oracle_85a1031c.json, and exits 1. I verified that this new file is absent from the current target and byte-identical between the PR head and the tested merge. This establishes the cause of this formatting failure; it does not attribute the other failing CI jobs to this PR.
This is a scoped CI follow-up. I have not completed the 11-file contract review or run the Rust differential tests, Docker benchmarks or formatter locally.
Automated review notice: This comment was posted by an automated review agent operated by Astro-Han. It is not an independent human review and does not replace one.
| @@ -0,0 +1,117 @@ | |||
| { | |||
| "oracleCommit": "85a1031c10d104456127f35aac1523b9ffb1a384", | |||
| "sourceSha256": {"packages/core/src/canonical-json.ts":"5673a6591307487542d403c912e2d8013a29c414affa92c64573d51177420dfd","packages/core/src/tool-args-identity.ts":"466b1c114f0127c40273882e2c60cf1f6238161cad062ebdc62b26017a4b2313","packages/eval/src/spec.ts":"4550765b909ca74932dfcb5ceb0bc330ada665ef33bb48feb63a010e4a71022e","packages/eval/src/experiment.ts":"0d458ae56688feda440bf31d53e772be36d797aecb1c94410217a0d0c91d05e0","packages/eval/src/result.ts":"c0f0ef26221282b80e936c5e24a95e8e16e6dfc11589f8da3b1e09f0edfe9400","packages/eval/src/attempt-store.ts":"f03aae0e6f2a109af02945f2b7df885c94a10cbb6cada7988113aa4708c51ccd","packages/eval/src/provider-metering.ts":"724e4abee7d5552eec7c43cb741e93983d711a595fc03dfa16241b288f36a4b5","packages/eval/src/runner.ts":"ef6a29d7141d1e0d1fe3f2dbc968b7a953f837ae2622f674ac9b3820086bd687","packages/eval/src/egress-audit.ts":"ec0b815955ec76b082862100f2ef086524d89231264ee93c6f6bb2e3afeb1bac"}, | |||
There was a problem hiding this comment.
[P2] Make the frozen oracle fixture pass the formatting gate
The compact JSON here is rejected by the repository's biome format . check: tooling job 133414387588 reports this file as its only formatting error and exits 1. The tested merge contains exactly these bytes. Please make the checked-in representation compatible with the formatting policy while preserving the oracle values and source hashes; otherwise the PR's tooling check remains red.
2c30dd6 to
8f8d570
Compare
Astro-Han
left a comment
There was a problem hiding this comment.
My previous formatting finding no longer applies at 8f8d570e31e23835efb454d8c01b27e61419907c. I fetched this head and verified that products/eval/tests/fixtures/ts_oracle_85a1031c.json, the compact JSON fixture that caused the earlier Biome failure, has been removed along with the old contract-oracle implementation. I withdraw that specific P2 finding for this head. This is not a claim that the new CI has completed successfully.
The PR has been substantially rewritten and now changes eight files for Host usage settlement, per-request pricing, and GuestRunResult decoding. I checked the removal and the decoding change, but have not completed a review of the new accounting implementation or run its Rust and live Harbor tests. In particular, the newly described arbitrary_precision fix still needs execution evidence; the failures previously observed on other heads do not establish whether this version fixes them.
Automated review notice: This comment was posted by an automated review agent operated by Astro-Han. It is not an independent human review and does not replace one.
8f8d570 to
f099ecb
Compare
f099ecb to
617b3ff
Compare
|
@M4n5ter Ready for another look ( Since #6938 already landed single-task container execution and Host usage collection, we stripped out all the un-wired batch schemas and duplicate rate tables, keeping this PR focused on
@M4n5ter 这边改完了( #6938 把单题容器执行和 Host 用量采集跑通之后,我们把之前这版里还没接上入口的批量配置 schema 和重复费率表全删了,只留
Posted via Google Antigravity on behalf of @Colafornia. |
Settle whole-root Host usage once per `maka-eval run` via upstream
`Quote::validate` and `Quote::estimate`, model `UsageSettlement` as
`Complete { cost_usd } | LowerBound`, downgrade missing differential
cache splits or uncounted calls to `lower_bound` (`costUsd: null`)
without discarding valid trial rewards, and persist `metering` /
`costUsd` (or `meteringError`) in `run-summary.json`. Also pass
`onComplete: "none"` when polling `SessionRead` synchronously in
`eval_runner` and exercise missing cache splits through the mock SSE
stream rather than mutating settled artifacts.
Refs apache#6667.
Generated-by: Maka (Antigravity / Gemini)
617b3ff to
c47d314
Compare
English
Summary
#6938 added single-task Harbor container execution (
maka-eval run/guest-run) and collected whole-root Host usage, but only checked that successful model calls reported input and output tokens.This PR settles Host usage and per-request pricing in
maka-eval runand recordsmetering(completeorlower_bound) andcostUsd(ormeteringError) inrun-summary.json.Multi-task
ExperimentSpecparsing, attempt storage, and retry selection are left to the follow-up batch-runner PR so they land with the CLI command that uses them.Refs #6667.
Changes
maka-eval runsettlesguest-result.jsononce, writesmeteringandcostUsd(ormeteringError) torun-summary.jsonfirst, and reuses that result for exit validation while keeping guest infrastructure failures as the primary error.Quotes: Each model attempt is validated and priced throughmaka-agent-facts(Quote::validateandQuote::estimate) instead of a separate rate table inproducts/eval. Missing differential cache counts or uncounted failed/aborted calls setmeteringtolower_bound(costUsd: null) without discarding valid verifier rewards.eval_runnerpolling race after feat(agent): redesign AX prompts, universal maka:// Read, and human-symmetric Session* tools #6958: PassonComplete: "none"when pollingSessionReadsynchronously insideexecso feat(agent): redesign AX prompts, universal maka:// Read, and human-symmetric Session* tools #6958's defaultnotify_callerwakeup does not add an extra parent step, and retire test Hosts on a dedicated thread duringDrop.Verification
Tested on
origin/rust-preview(e97e6fd7d):maka-eval runonterminal-bench/log-summary-date-ranges(deepseek/deepseek-flash), finishing withreward: 1.0,9/9model calls (87,247input,74,496cache-read,2,952output,432reasoning tokens),metering: "complete", andcostUsd: 0.003907338matchingusage.models.cost.knownUsd.cargo test --locked -p maka-evalandcargo test --locked --workspace --bin maka-eval --test eval_runner(4/4passed, coveringcompletepricing, missing-cache downgrade tolower_bound, subagent + 429 retry,max-stepsstop,meteringErrorpersistence, andinfraFailedreporting).cargo fmt -p maka-eval -- --check,cargo clippy --locked -p maka-eval --all-targets --no-deps -- -D warnings,RUSTDOCFLAGS="-D warnings" cargo doc --locked -p maka-eval --no-deps,node scripts/asf-license-headers.mjs check, andnode --test scripts/ci.test.mjs(18/18).Did not run full-repo
just checklocally.AI use
Select exactly one:
Tool(s) and scope: Google Antigravity implemented the usage settlement and integration test updates; OpenAI Codex assisted with review issue localization. The commit retains the
Generated-bytrailer.Checklist
Does this PR entail a change in behavior?
简体中文
概述
#6938 落地了单题 Harbor 容器执行(
maka-eval run/guest-run)和 Host 整根目录的用量采集,但当时只检查了成功调用有没有报输入/输出 token,还没有算账单。这个 PR 在
maka-eval run里补上 Host 用量结算和逐请求计价,把metering(complete或lower_bound)和costUsd(账本异常时写meteringError)写进run-summary.json。多题配置
ExperimentSpec、尝试存储和重试选样放到后面的批量运行 PR 里,跟实际调用它们的子命令一起提交。关联 #6667。
主要改动
maka-eval run只对guest-result.json结算一次,先把metering和costUsd(或meteringError)写进run-summary.json,退出校验直接复用同一份结果;容器基础设施报错时仍优先报底层根因。Quote计价:不在products/eval里另起费率表或重复统计 token,直接调maka-agent-facts的Quote::validate和Quote::estimate按单次请求算钱求和。遇到缺差异化缓存计数、429 报错或半途打断等算不出完整总价的情况,只标为lower_bound(costUsd: null),保留有效的判分结果。eval_runner在exec里同步轮询SessionRead时显式传onComplete: "none",避免 feat(agent): redesign AX prompts, universal maka:// Read, and human-symmetric Session* tools #6958 默认开启的notify_caller自动唤醒多跑一步;同时把IsolatedEnv::drop里的 Host 停机放到独立线程执行。验证
基于
origin/rust-preview(e97e6fd7d)验证通过:deepseek/deepseek-flash跑通terminal-bench/log-summary-date-ranges,reward: 1.0,9/9次模型调用(输入87,247/ 缓存命中74,496/ 输出2,952/ 推理432tokens),结算为metering: "complete",costUsd: 0.003907338,与 HostknownUsd完全一致。cargo test --locked -p maka-eval与cargo test --locked --workspace --bin maka-eval --test eval_runner(4/4通过,覆盖完整计价、缺缓存降级lower_bound、子会话 + 429 重试、max-steps停止、缺 token 落盘meteringError及infraFailed报错)。cargo fmt -p maka-eval -- --check、cargo clippy --locked -p maka-eval --all-targets --no-deps -- -D warnings、RUSTDOCFLAGS="-D warnings" cargo doc --locked -p maka-eval --no-deps、node scripts/asf-license-headers.mjs check、node --test scripts/ci.test.mjs(18/18)。未在本地跑全仓
just check。AI 使用
请只勾选一项:
工具及范围:Google Antigravity 完成了用量结算实现与集成测试更新;OpenAI Codex 协助定位了评审问题。提交保留
Generated-by标记。检查清单
本 PR 是否改变行为?