refactor: replace Headless with minimal Eval kernel - #2605
Conversation
93702ca to
5bbef37
Compare
M4n5ter
left a comment
There was a problem hiding this comment.
English
The overall direction is strong. Deleting Headless as a second Runtime authority and limiting @maka/eval to Experiment/Cell/Attempt/Result semantics matches the Runtime Host architecture well. Maka execution crosses the public Runtime Host boundary, while Harbor/Pier retain ownership of Trial preparation, verification, and finalization.
I found one concrete regression, one intent-dependent artifact question, and one important opportunity to simplify the Host integration.
1. Preserve maka inspect for Runtime Host state
This PR removes the entire inspect command because it includes Headless TaskRun support. However, the same command also provides valid Session/AgentRun inspection through the Runtime Host control plane.
Please remove only the TaskRun and Headless-root branches. Session/AgentRun inspection, execution.inspect.resolve/query, and live Runtime Host inspection remain useful Runtime Host capabilities and should not be removed as Headless residue.
2. Clarify the intended contract of runtime_host_execution
The checked-in experiment creates Runtime Host roots under /tmp/maka-runtime-hosts inside a Docker environment configured with delete: true. The persisted Eval result records:
{ kind: 'runtime_host_execution', executionId }After Trial finalization deletes the container, the corresponding Runtime Host root and its Session/Turn/Run data no longer exist. Whether this needs a larger fix depends on the intended meaning:
- If
runtime_host_executionis intended to be a durable, inspectable artifact, the Host root must be persisted or an immutable execution artifact must be exported before finalization. - If it is only correlation or diagnostic metadata, it should not be represented as an artifact. The simplest first-version solution is to remove it and rely on the native Harbor/Pier Trial artifacts.
I do not think the first version needs a new Eval-owned trace schema. The important part is that the result contract accurately reflects what remains available after the Trial has completed.
3. Collapse the hosted-execution adapter onto canonical Host authority
HostHostedExecutionRunner currently composes five protocol handlers, constructs a synthetic ConnectionContext, polls turn.query every 25 ms, and waits for global Host residency through an optional waitForResidencies port with a no-op fallback.
Runtime Host already has HostedExecutionAuthority, exact completion/settlement promises, and waitForHostedExecutionTerminal(). The hosted-execution protocol adapter should reuse those canonical signals through a narrow application service. This would remove the polling loop, global residency dependency, synthetic context, and optional lifecycle port.
The Domain Module should also be named hosted-execution, not eval-execution: Runtime Host provides a generic capability and should not know which consumer requested it.
The append-only Attempt model, earliest-valid-result rule, dedicated Host root per Maka attempt, and fail-closed writer lock are appropriately simple for the first version. I would keep those parts as they are unless a concrete need justifies more machinery.
中文
整体方向很好。删除作为第二套 Runtime authority 的 Headless,并将 @maka/eval 限定在 Experiment、Cell、Attempt 和 Result 语义内,符合 Runtime Host 架构。Maka execution 经过公开的 Runtime Host 边界,而 Harbor/Pier 继续拥有 Trial preparation、verification 和 finalization。
我发现了一个明确的功能回退、一个取决于作者意图的 artifact 问题,以及一项重要的 Host 集成简化机会。
1. 保留面向 Runtime Host 状态的 maka inspect
这个 PR 因为 inspect command 包含 Headless TaskRun 支持,而删除了整个命令。但同一个命令还通过 Runtime Host control plane 提供有效的 Session/AgentRun 检查能力。
请只删除 TaskRun 和 Headless root 相关分支。Session/AgentRun inspection、execution.inspect.resolve/query 和 live Runtime Host inspection 都是仍然有价值的 Runtime Host 能力,不应作为 Headless 残留一并删除。
2. 明确 runtime_host_execution 的预期契约
仓库内的实验配置在设置了 delete: true 的 Docker 环境中,将 Runtime Host root 创建在 /tmp/maka-runtime-hosts。持久化的 Eval result 中记录了:
{ kind: 'runtime_host_execution', executionId }Trial finalization 删除容器后,相应的 Runtime Host root 以及其中的 Session、Turn、Run 数据也会消失。是否需要较大的修复,取决于作者对该字段的设计意图:
- 如果
runtime_host_execution表示一份应当持久存在、可以事后检查的 artifact,那么需要持久化 Host root,或者在 finalization 前导出不可变的 execution artifact。 - 如果它只是用于关联或诊断的 metadata,就不应表示为 artifact。第一版最简单的方案是删除它,继续依赖 Harbor/Pier 原生持久化的 Trial artifacts。
我认为第一版没有必要再设计一套由 Eval 拥有的 trace schema。关键是 result contract 应准确反映 Trial 完成后仍然真实存在的内容。
3. 将 hosted-execution adapter 收敛到 canonical Host authority
HostHostedExecutionRunner 当前组合了五个 protocol handlers、构造 synthetic ConnectionContext、每 25ms 轮询一次 turn.query,并通过带有 no-op fallback 的 optional waitForResidencies port 等待全局 Host residency。
Runtime Host 已经拥有 HostedExecutionAuthority、精确的 completion/settlement promises,以及 waitForHostedExecutionTerminal()。Hosted-execution protocol adapter 应通过一个窄应用服务复用这些 canonical signals。这样可以删除 polling loop、全局 residency 依赖、synthetic context 和 optional lifecycle port。
Domain Module 也应命名为 hosted-execution,而不是 eval-execution:Runtime Host 提供的是通用能力,不应知道调用它的是哪个消费者。
Append-only Attempt、earliest-valid-result、每个 Maka attempt 使用专属 Host root,以及 fail-closed writer lock,对第一版来说都足够简单合理。除非出现明确需求,否则我建议保持这些部分不变,不再增加额外机制。
|
Thanks for the thoughtful review. I checked the three points against the current Issue contract and HEAD. On I addressed the other two concrete boundary issues:
I’m deferring the larger runner rewrite. The existing Focused Eval and Runtime Host tests, Biome, and 中文对照感谢细致的审查。我根据当前 Issue 约定和最新 HEAD 核对了这三点。 关于 另外两个具体边界问题已经处理:
更大的 runner 重构暂缓。现有 Eval、Runtime Host 聚焦测试、Biome 和 AI disclosure: This reply was drafted and posted with OpenAI Codex assistance. The author reviewed the decisions; the cited changes and focused validation were verified locally. |
79810ed to
dcd1084
Compare
|
@M4n5ter, @likun666661, I rebased #2605 onto the latest Since you both reviewed it earlier, would you mind giving the rebased version one last look and approving it if it matches #2598? The earlier feedback is addressed or documented in the thread. 中文对照@M4n5ter、@likun666661,我已经把 #2605 rebase 到最新 两位之前都审查过这个 PR,方便的话,麻烦再看一下 rebase 后的版本。如果符合 #2598,请 approve。 之前 review 提到的问题都已处理,或在 thread 中说明了取舍。 AI disclosure: OpenAI Codex helped draft and post this comment. I chose the reviewers and verified the rebase and local checks. |
M4n5ter
left a comment
There was a problem hiding this comment.
English
Approved. The updated PR matches the authority boundary in #2598: Eval owns experiment semantics, while Runtime Host remains the sole authority for Maka execution
I am withdrawing my earlier maka inspect finding. #2598 explicitly defines maka eval as the only public Eval CLI and includes removal of the old inspect entry point, so that deletion is intentional rather than an accidental Runtime Host regression
The two concrete boundary issues are resolved cleanly: the ephemeral runtime_host_execution artifact is gone, and the Domain Module is now named hosted-execution. Deferring the larger runner rewrite is also reasonable because this boundary currently has to settle continuations, usage, and verifier-visible environment resources together
One non-blocking follow-up is worth recording. After hosted.execution.start has already returned a settled completed or failed projection, runHostedExecution() performs a separate diagnostics request to decide whether runtime resources remain. If that observation request loses the connection, the catch path replaces the already-settled result with indeterminate, so Eval skips verification even though execution itself completed
The simplest follow-up is likely subtraction: for settled completed or failed results, close the connection and always call releaseToEnvironment(). An owned ephemeral Host with no residencies already exits with idleGraceMs = 0; a Host with a runtime-resource residency remains available to the verifier. This would remove the diagnostics round trip, the environmentResourcesRemain state, and the control-flow dependency on the runtime-resource label. If the diagnostics query is retained, its failure should at least not overwrite a settled execution result
This does not block approval because the current production caller runs one dedicated Host root inside the Trial environment, and the updated validation and CI are green
中文
已批准。更新后的 PR 符合 #2598 规定的 authority 边界:Eval 只拥有实验语义,Runtime Host 仍是 Maka execution 的唯一 authority
我撤回之前关于 maka inspect 的 finding。#2598 明确规定 maka eval 是唯一公共 Eval CLI,并将删除旧 inspect 入口列入范围,因此这属于有意删除,而不是 Runtime Host 功能的意外回退
另外两个具体边界问题已经干净地解决:短暂存在的 runtime_host_execution artifact 已删除,Domain Module 也已改名为 hosted-execution。暂缓更大的 runner 重写同样合理,因为当前边界确实需要共同封口 continuation、usage 和 verifier 可见的 environment resource
还有一项不阻塞合并的后续改进值得记录。hosted.execution.start 已经返回 completed 或 failed 的 settled projection 后,runHostedExecution() 又发起了一次独立 diagnostics 请求来判断是否仍有 runtime resource。如果这次观察请求断线,catch 路径会把已经确定的结果覆盖成 indeterminate,导致 Eval 在 execution 实际已经完成的情况下跳过 verifier
最简单的后续修法可能是继续做减法:对 settled 的 completed 或 failed 结果,关闭连接后始终调用 releaseToEnvironment()。没有 residency 的 owned ephemeral Host 已经会通过 idleGraceMs = 0 自行退出;存在 runtime-resource residency 的 Host 则会继续供 verifier 使用。这样可以删除 diagnostics 往返、environmentResourcesRemain 状态以及控制流对 runtime-resource 字符串标签的依赖。如果仍保留 diagnostics 查询,至少不应让它的失败覆盖已经 settled 的 execution result
这不阻塞本次批准,因为当前生产调用方在 Trial 环境内为每个 Attempt 使用独立 Host root,并且更新后的验证与 CI 均已通过
AI disclosure: OpenAI Codex assisted with this re-review and approval text. The reviewer verified the current head, addressed changes, and CI state before submission
对抗性审查结论:建议修改后合入这个 PR 的架构方向是对的:将 Eval 收敛到 不过,以下问题会使新公开的唯一 Eval 路径在部分场景不符合其契约,建议修复或明确收窄承诺后再合入。 P1 —
|
|
@liugddx Thanks for taking the time to review this, especially after the PR had already merged. I checked each point against the merged code and the local run records. There are a few useful follow-ups here, but I do not think any of them is P1. The The PR description missed an important detail: Harbor 0.20.0 was run end to end locally. The smoke covered the real Trial lifecycle, relay Agent, verifier, finalizer, and The Windows problem is real, but I would rate it P2. It fails before the Trial starts and does not corrupt results. For the first version, we can reject non-POSIX hosts with a clear error. The abort-after-terminal case is also real and belongs in #2662. Once Runtime Host has returned I will keep the follow-up small: #2662, plus one Eval PR for the README wording, the 中文对照@liugddx 感谢你在 PR 合并后仍花时间做这轮审查。我重新对照了合并后的代码和本地运行记录。这里有几项值得处理,但我认为都不到 P1。
PR 描述漏掉了一个重要信息:Harbor 0.20.0 已经在本地完整跑过。Smoke 经过了真实 Trial lifecycle、relay Agent、verifier、finalizer 和 Windows 问题成立,但我会定为 P2。它发生在 Trial 启动前,不会污染结果。第一版在非 POSIX host 上报清楚错误即可。 Terminal 后 abort 的问题也成立,应并入 #2662。Runtime Host 一旦返回 后续会保持精简:处理 #2662,再开一个小型 Eval PR,修正 README、补 AI disclosure: OpenAI Codex helped trace the reported paths and draft this reply. I checked the conclusions against the merged source, #2598, and the retained Harbor run records. |
Summary
Replace
packages/headlesswith a minimal@maka/evaldomain and make Runtime Host the sole authority for Maka execution.Experiment -> Cells -> Attempts -> Results; a cell istask x repetition x subjectmaka eval, and delete Headless, TaskRun, Autonomous Loop, Heavy/Self-check, specialized A/B workflows, legacy readers, duplicate runtime models, and their reverse dependenciesFixes #2598
Verification
npm run format:check: 1,483 files checkedgit diff --checkRepository-wide tests were not run locally. No live-provider/Docker four-arm smoke was run. The pinned Harbor/Pier native contracts were checked manually in isolated environments during development; checked-in automated tests cover the local framework/relay boundaries without claiming a live framework or provider integration proof.
Breaking change
This is an intentional cutover with no compatibility layer, legacy result reader, resume path, or result migration. Existing Headless experiments cannot resume. Environment variables carry only credentials and machine-local paths; the fully expanded Experiment spec remains semantic authority.
Review focus
The diff is
+5,632 / -131,081. Review the authority invariant first: Eval owns experiment semantics but must not construct Runtime objects or own Session, Turn, continuation, tools, events, or agent lifecycle. Runtime, Runtime Host, and Core must not acquire benchmark, repetition, score, or A/B concepts from Eval.Fresh-eye review after rebasing onto current
mainfound no reproducible production P0/P1. Remaining observations are P2 test-protection gaps, so no further production changes were made under the agreed stop rule.Checklist
Does this PR entail a change in behavior?