Skip to content

feat(eval): add native Host Harbor evaluation runner - #6938

Merged
M4n5ter merged 9 commits into
apache:rust-previewfrom
Colafornia:feat/eval-walking-skeleton
Nov 16, 2026
Merged

M4n5ter merged 9 commits into
apache:rust-previewfrom
Colafornia:feat/eval-walking-skeleton

Conversation

@Colafornia

@Colafornia Colafornia commented Nov 15, 2026 •

Copy link
Copy Markdown
Member
English

Summary

Adds maka-eval (products/eval) to run a Harbor Docker benchmark trial against the released native Rust Host and verify task scoring, conversation history export, and settled token/cost accounting end to end—without ACP shims or an external HTTP metering proxy.

Within #6667, this PR establishes the single-trial container execution and native Host metering foundation. Multi-cell experiment specifications and pricing (#6849), append-only attempt storage and crash recovery, a host-side credential-isolating metering gateway, multi-trial scheduling, and cohort parity gates will land in separate PRs.

Refs #6667

Design & Boundaries

Host (`maka-eval run`) ──► Harbor (`MakaHostAgent`) ──► Container (`maka-eval guest-run` ──► `maka host`)
                                  │
                                  ▼
                       Harbor Verifier (score) ──► Completeness Check (`run-summary.json`)
  • Direct native Host execution: Bootstraps an isolated container State Root over stdin and drives the session through the public Host client protocol, reusing existing workspace contracts for sandbox policy, session execution state, and usage reports.
  • Infrastructure faults vs. subject capability: Runner or Host failures abort immediately. Capability stops (step/time limits or blocked interactive prompts) and normal completions proceed to Harbor's Verifier; CLI validation enforces evidence completeness (no exceptions, finite score, exported transcript, and settled usage with zero missing token counts) rather than requiring a passing task score.
  • Background services across grading: On normal completion, the Host stays running until Harbor tears down the container so background services started during the task remain reachable while the Verifier grades. Stopped or failed runs retire the Host and clean up temporary state immediately.
  • Container hygiene & artifact indexing: Preserves the task image's PATH, hands off the request payload as 0600 owned by the container's runtime UID:GID and unlinks it immediately on read, and emits a compact run-summary.json containing top-level conclusions alongside paths to guest-result.json (which retains per-call usage), transcript.json, and Harbor's result.json.

Verification

  • rustfmt, clippy (--all-targets -D warnings), maka-eval unit tests (5/5), maka-settings-native library tests, CI routing tests (18/18), and Apache license/notice checks passed locally.
  • Live Linux aarch64 Harbor Docker container probes under a non-root user (UID 65534) verified:
    • A background HTTP server started during the run stays reachable throughout Verifier grading on normal completion (reward = 1.0) and leaves zero leaked containers after teardown;
    • Hitting the step budget (--max-steps 1) retires the Host and removes temporary state before Verifier runs;
    • Complete streaming token usage passes validation, whereas partial missing token usage (1 of 2 model calls missing usage) fails CLI validation even when reward = 1.0.
  • Earlier live container smoke against deepseek/deepseek-chat (local/smoke-acp) verified real model execution, token/USD accounting, and Verifier scoring (reward = 1.0). Live external API smoke and gpg source-release signing were not re-run on the final commit.

AI use

  • No generative tool made a substantive contribution
  • Generative tooling made a substantive contribution

Tool(s) and scope: Google Antigravity implemented products/eval, unit tests, bilingual READMEs, and container verification probes.

Checklist

  • Tests cover the change and fail without it
  • Format, typecheck and the affected suites pass locally

Does this PR entail a change in behavior?

  • Yes — described under Summary above
  • No

简体中文

概述

新增 maka-eval(products/eval),用于在 Harbor Docker 容器内直接驱动原生 Rust Host 完成单题评测,并端到端校验 Verifier 判分、会话历史导出与原生 token/成本账本结算,无需经过 ACP 垫片或外置 HTTP 计量代理。

在 #6667 的整体规划中,本 PR 负责打通“单题容器执行 + 原生 Host 计量对账”基础闭环。多单元实验规格与定价(#6849)、只追加尝试存储与崩溃恢复、宿主机侧凭据隔离计量网关、多题并发调度以及产品一致性对照门禁将在后续独立 PR 中交付。

Refs #6667

设计与边界

宿主机 (`maka-eval run`) ──► Harbor (`MakaHostAgent`) ──► 容器内 (`maka-eval guest-run` ──► `maka host`)
                                    │
                                    ▼
                         Harbor Verifier (判分) ──► 完整性验收 (`run-summary.json`)
  • 直接驱动原生 Host:通过 stdin 在容器内初始化隔离的临时 State Root,经由公开的 Host 客户端协议驱动会话,并直接复用工作区现有的沙箱策略、会话执行状态与用量报表契约。
  • 区分基础设施故障与被测表现:运行器或 Host 故障会立即中止并报错;因步数/超时上限或交互阻塞停止以及正常完成的会话均继续进入 Harbor Verifier 判分。CLI 验收只检查证据是否完整(无运行异常、判分数值有效、历史已导出、账本已结清且无缺失 token 计数),不要求题目得分为正。
  • 后台服务跨判分存活:正常完成时保留运行中的 Host 直至 Harbor 收尾销毁容器,确保任务期间拉起的后台服务在 Verifier 判分阶段保持可达;被中止或失败的运行则立即退役 Host 并清理临时目录。
  • 容器环境与产物分层:保留题目镜像原有的 PATH;请求文件以 0600 权限交给容器实际运行 UID:GID 并在读取后立即删除;顶层 run-summary.json 仅输出汇总结论及三份原始产物的路径索引(逐次调用明细保留在 guest-result.json,对话历史在 transcript.json,原始判分在 Harbor result.json)。

验证

  • 本地通过 rustfmt、clippy(--all-targets -D warnings)、maka-eval 单元测试(5/5)、maka-settings-native 库测试、CI 路由测试(18/18)以及 Apache License/Notice 检查。
  • 在非 root 用户(UID 65534)下完成 Linux aarch64 Harbor Docker 真实容器探针验证:
    • 正常完成路径下,任务启动的后台 HTTP 服务在 Verifier 判分期间保持可达(reward = 1.0),Harbor 收尾后无残留容器;
    • 触发步数上限(--max-steps 1)时,在 Verifier 运行前已完成 Host 退役与临时目录清理;
    • 完整流式 token 计量可通过验收,部分调用缺失 token 计量(2 次调用缺 1 次)即使 reward = 1.0 也会被 CLI 拒绝。
  • 先前已在 local/smoke-acp 上通过 deepseek/deepseek-chat 真实模型容器闭环验证(reward = 1.0);最终提交未重跑外网 API 烟雾测试与依赖 gpg 的源码发布签名检查。

AI 使用

  • 没有生成式工具作出实质性贡献
  • 生成式工具作出了实质性贡献

工具与范围:Google Antigravity 完成了 products/eval 实现、单元测试、双语说明文档与容器验收探针。

审查清单

  • 测试覆盖本次变更且无修复前会失败
  • 格式、类型检查与受影响测试集已在本地通过

本 PR 是否带来行为变更?

  • 是 — 如上文概述所述
  • 否

- Add products/eval (maka-eval) with host-side 'run' (Harbor trial orchestrator) and container-side 'guest-run' driving native 'maka host init --settings-stdin' and 'maka host serve --root' directly over HostClient and maka-app-client without ACP or an HTTP metering proxy.

- Bootstrap sandbox defaults and Harbor workspace roots via apache#6909 (chatDefaults.sandboxMode and projectDirectoryRoots), defaulting containerized Harbor runs to danger-full-access.

- Separate GuestRunStatus (completed / subjectStopped / infraFailed) from Verifier scoring so model-side stops reach grading, and validate settled Host usage (usageSummary pending.models == 0 plus cursor-paginated usage attempts sharing the same through fence) alongside paginated transcript.json export in validate_trial_evidence.

- Add Harbor BaseAgent bridge (products/eval/harbor/maka_host_agent.py) and bilingual READMEs.

Refs apache#6667.

Generated-by: Google Antigravity
@Colafornia
Colafornia marked this pull request as draft November 16, 2026 00:19
…giene

- Remove libc dependency/unsafe SIGTERM in favor of native HostClient::retire_with_options, drop duplicate RunArgs struct, drop stderr ring buffer (use Stdio::inherit()), drop composer draft workaround (use direct Client::mutation agent.send), drop 200ms execution polling race, and simplify internal cross-layer checks.

- Remove hardcoded PATH override in maka_host_agent.py so benchmark toolchains in task container images stay intact; write transcript.json and guest-result.json directly to Harbor's /logs/agent/maka mount.

- Immediately delete the request file in run_from_files before execution, isolate temp State Root under 0700 and clean it up on exit, align Harbor agent timeout (override_timeout_sec = timeout_ms / 1000 + 30s), reconcile stepsObserved from exported history/attempts, and reject all-missing token usage in validate_trial_evidence.

Refs apache#6667.

Generated-by: Google Antigravity
…en usage

- Transfer uploaded guest request file ownership to the live execution UID:GID as root while keeping 0600 permissions, handle missing or root (/etc/passwd pw_dir=/) home directories safely, and clean up stranded request files on failure in maka_host_agent.py.

- Settle pending.tools alongside pending.models in guest.rs, require pending.models == 0 and pending.tools == 0, non-zero model calls on Completed runs, and input.missing == 0 and output.missing == 0 in validate_trial_evidence so partial usage gaps fail verification.

Refs apache#6667.

Generated-by: Google Antigravity
- Reshape GuestRunResult into a 3-variant tagged enum (Completed / SubjectStopped / InfraFailed) wrapping GuestEvidence, removing flat Option duplication, session_err cloning, and unused container transcriptFile field while still preserving evidence if Host shutdown fails after run_session succeeds.

- Decouple export_history from step_ids backfill (leaving step reconciliation to query_all_usage_attempts + observe_run), return Result<Value, String> directly from query_settled_usage_summary, and omit redundant backend from agent.send so it uses create's persisted session backend.

Refs apache#6667.

Generated-by: Google Antigravity
@github-actions github-actions Bot added the effort/XL Under 2500 readable lines label Nov 16, 2026
@Colafornia
Colafornia marked this pull request as ready for review November 16, 2026 05:46
…t live Host

- Embed maka_host_agent.py via include_str! and materialize it under --out instead of resolving compile-time CARGO_MANIFEST_DIR at runtime.
- Query settings.usageSummary and settings.usage across the whole isolated State Root (sessionId: null) so delegated subagent calls are accounted.
- Validate complete token counts on successful model attempts while accepting SubjectStopped in-flight stream interruptions and recovered provider retries; always emit run-summary.json before validation.
- Fix Host startup readiness busy-spin, avoid inflating stepsObserved with the aborted over-budget step, register maka-eval in CI taskHelperConsumers, and replace synthetic struct unit tests with real Host + CLI integration tests.

Refs apache#6667.

Generated-by: Google Antigravity
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

effort/XL Under 2500 readable lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants