Skip to content

feat(cli): establish npm release boundary - #3169

Merged
M4n5ter merged 5 commits into
mainfrom
feat/cli-npm-release-boundary
Aug 17, 2026
Merged

feat(cli): establish npm release boundary#3169
M4n5ter merged 5 commits into
mainfrom
feat/cli-npm-release-boundary

Conversation

@M4n5ter

@M4n5ter M4n5ter commented Aug 17, 2026

Copy link
Copy Markdown
Member
English

Summary

  • Separate the production dist/cli.js executable from reusable CLI logic and keep the repository-only dev launcher on its own profile.
  • Make maka-agent explicitly bin-only while preserving maka, maka-agent, TUI, run, activate, Runtime Host commands, and the lazily loaded maka eval surface.
  • Add maka eval install-state preflight for machine paths, bundled relay assets, pinned Harbor/Pier Python environments, and Docker availability before any trial starts. The probe reuses the trial supervisor's credential-filtered environment.

Refs #3166

Verification

  • npm --workspace maka-agent test — 262 tests passed.
  • npm --workspace @maka/eval run build && npm --workspace @maka/eval run test:dist — 72 Node tests and all non-Docker Python suites passed; the existing Docker namespace suite skipped because no daemon is available in this environment.
  • npm run lint
  • npm run format:check
  • npm run build
  • npm run typecheck
  • git diff --check
  • Production entry smoke: --help, --version, and eval --help; importing maka-agent as a JavaScript library is rejected by the package boundary.

A real Harbor/Pier trial and install-from-tarball matrix are intentionally left to the packaging and release-gate follow-ups in #3166.

Review focus

Please review the public command boundary and whether the Eval preflight covers the correct external prerequisites without changing experiment semantics. Tarball construction, bundled dependencies, file allowlists, and release automation are out of scope for this PR.

AI use

Select exactly one:

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

Tool(s) and scope: OpenAI Codex assisted with implementation, tests, documentation, and local verification under M4n5ter's direction. The commit includes the required Generated-by: OpenAI Codex trailer.

Checklist

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

Does this PR entail a change in behavior?

  • Yes — described under Summary above
  • No
中文

概述

  • 将生产环境的 dist/cli.js 可执行入口与可复用 CLI 逻辑分离,并让仓库专用 dev launcher 继续使用独立 profile。
  • maka-agent 明确收敛为 bin-only 包,同时保留 makamaka-agent、TUI、runactivate、Runtime Host 命令,以及按需加载的 maka eval
  • maka eval 增加安装态预检,在启动任何 trial 前检查机器路径、包内 relay 资源、固定版本的 Harbor/Pier Python 环境和 Docker 可用性。探测过程复用 trial supervisor 的凭证过滤环境。

关联 #3166

验证

  • npm --workspace maka-agent test:262 项测试通过。
  • npm --workspace @maka/eval run build && npm --workspace @maka/eval run test:dist:72 项 Node 测试及全部非 Docker Python 测试通过;当前环境没有 Docker daemon,既有 namespace 集成测试按设计跳过。
  • 全仓 lint、format check、build、typecheck 与 git diff --check 通过。
  • 生产入口的 --help--versioneval --help smoke 通过;将 maka-agent 作为 JavaScript library 导入会被包边界拒绝。

真实 Harbor/Pier trial 和 tarball 隔离安装矩阵留给 #3166 后续的打包与发布门禁 PR。

审查重点

请重点确认公共命令边界,以及 Eval preflight 是否在不改变实验语义的前提下覆盖了正确的外部前置条件。Tarball 构建、bundled dependencies、文件白名单和发布自动化不在本 PR 范围内。

AI 使用

OpenAI Codex 在 M4n5ter 的指导下辅助了实现、测试、文档和本地验证。提交已包含项目要求的 Generated-by: OpenAI Codex trailer。勾选状态以英文区为准。

检查清单

  • 已新增能够覆盖变更且在缺少实现时失败的测试。
  • 本地 lint、format、typecheck 和受影响测试均已通过。
  • 本 PR 包含行为变化,已在概述中说明。

Separate the production bin from repository CLI logic and close the package's accidental JavaScript import surface while preserving the current public commands.

Fail Maka Eval before trial startup when pinned Python, Docker, or machine prerequisites are unavailable, using the same credential-filtered preparation environment as the trial supervisor.

Generated-by: OpenAI Codex
@coderabbitai

coderabbitai Bot commented Aug 17, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: e206fa65-ff10-48f1-ac16-f1b6bea6dc07

📥 Commits

Reviewing files that changed from the base of the PR and between 8fc0387 and f819a87.

📒 Files selected for processing (2)
  • packages/eval/src/__tests__/install-preflight.test.ts
  • packages/eval/src/install-preflight.ts

Included review availability: Your plan includes up to 3 reviews per rolling hour; 0 remain after this review.


📝 Walkthrough

Summary

This PR defines the npm release boundary for maka-agent. It separates the production dist/cli.js executable from reusable CLI logic. It makes the package bin-only while preserving maka, maka-agent, TUI, run, activate, Runtime Host, and maka eval.

It also adds maka eval installation preflight validation. Before a built-in trial starts, the CLI checks machine paths, writable trial storage, relay assets, pinned Harbor/Pier Python environments, subject toolchains, and Docker availability. It uses the trial supervisor’s credential-filtered environment. It reports failures without installing software or writing trial results. The preflight rejects dangling trial-directory symlinks while allowing genuinely missing directories that can be created.

Source of truth and design

The PR extends the existing CLI and evaluation paths. It does not create a parallel command implementation. cli-core.ts is the shared source for CLI parsing, dispatch, errors, and process handling. cli.ts remains the release executable. dev-cli.ts remains the repository-only development launcher.

The design is the smallest coherent solution shown by the diff. The thin production entry point enforces the package boundary. The shared core prevents duplicated CLI behavior. The preflight helpers centralize environment preparation, path validation, command execution, timeout handling, cancellation, and error normalization. Canonical path validation prevents symlink-based escapes.

No deletion is recommended without further review. The removed cli.ts logic moved into cli-core.ts. The removed index.ts barrel supports the bin-only package boundary. The added tests cover retained behavior and new preflight failures.

Validation

The diff adds tests for package metadata, command behavior, exit handling, credential filtering, writable and missing paths, dangling symlinks, prerequisite validation, Python and Docker checks, mounts, version mismatches, path traversal, symlink escapes, and cancellation. It also validates failure before trial startup.

The stated verification includes affected-workspace tests, linting, formatting, builds, type checking, production-entry smoke tests, and package-boundary checks. Direct current check results are not available here, so required checks remain unverified.

Real Harbor/Pier trials, tarball installation matrices, bundled dependency checks, file allowlists, and release automation remain deferred to follow-up work in #3166.

Review-relevant risks

  • The empty exports map and removal of main, types, and the package index change the public import contract. Material public-contract changes require independent human review under repository policy.
  • The release entry point and CLI command surface now depend on cli-core.ts. Material release behavior changes require independent human review under repository policy.
  • maka eval can block trials during preflight and changes credential and network-policy environment handling. Material user-visible or security changes require independent human review under repository policy.
  • The PR changes npm package boundaries and defers tarball and release validation. Material release-process changes require independent human review under repository policy.
  • Required check status is unverified from direct evidence. The person performing the merge reviews the final diff, and a maintainer makes the final determination.

Walkthrough

The PR extracts CLI behavior into cli-core.ts, updates package entry-point metadata, and adds built-in executor preflight validation. The evaluation harness now uses shared environment and path-validation utilities, with tests and documentation for prerequisite failures.

Changes

CLI core extraction

Layer / File(s) Summary
CLI contracts and parsing
packages/cli/src/cli-core.ts
Adds command types, launch options, argument parsing, help and version output, resume hints, and TUI option validation.
CLI dispatch and termination
packages/cli/src/cli-core.ts
Adds lazy command dispatch, data-root resolution, fatal-error handling, deferred exits, and launcher logic.
CLI entry points and release surface
packages/cli/src/cli.ts, packages/cli/src/dev-cli.ts, packages/cli/package.json, packages/cli/src/__tests__/*
Release and development entry points use the shared launcher. Package metadata exposes an empty exports map. Tests cover binaries, help output, exports, and exit probes.

Executor preflight validation

Layer / File(s) Summary
Built-in executor preflight
packages/eval/src/install-preflight.ts
Adds validation for executor configuration, paths, assets, Python frameworks, Docker availability, command limits, cancellation, and normalized errors.
Evaluation CLI integration
packages/eval/src/cli.ts, packages/eval/src/harness-executor.ts
Built-in executors expose and run preflight before experiments. Injected executors bypass preflight.
Shared preparation environment
packages/eval/src/harness-environment.ts, packages/eval/src/harness-executor.ts
Centralizes environment allowlisting, credential removal, relay path setup, and confined egress and network-policy paths.
Preflight validation and documentation
packages/eval/src/__tests__/*, packages/eval/README.md
Tests cover successful and failed prerequisite checks. Documentation describes validation and failure behavior.

Estimated code review effort: 4 (Complex) | ~45 minutes

Merge Risk: 🟠 High · up to f819a

This change adds Eval installation and path preflight checks, but the current implementation can still allow symlinked paths to escape the configured source directory before execution policies apply, creating a concrete isolation and data-exposure risk. Merge should be blocked until that path-boundary issue is fixed; several lower-impact correctness and maintainability follow-ups also remain.

Sequence Diagram(s)

sequenceDiagram
  participant CLI
  participant cliCore
  participant CommandHandler
  participant Process
  CLI->>cliCore: invoke launchMakaCli
  cliCore->>cliCore: parse arguments
  cliCore->>CommandHandler: dispatch command
  CommandHandler-->>cliCore: return exit code
  cliCore->>Process: perform deferred exit
Loading
sequenceDiagram
  participant EvalCLI
  participant HarnessExecutor
  participant Preflight
  participant Python
  participant Docker
  participant Experiment
  EvalCLI->>HarnessExecutor: create built-in executor
  HarnessExecutor->>Preflight: validate installation
  Preflight->>Python: check framework
  Preflight->>Docker: check daemon when required
  Python-->>Preflight: return result
  Docker-->>Preflight: return result
  Preflight-->>EvalCLI: complete validation
  EvalCLI->>Experiment: run with validated executor
Loading
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Ai Use Disclosure ✅ Passed The PR selects one AI-use declaration, names OpenAI Codex and its scope, and all five commits in the PR range contain the standalone Generated-by: OpenAI Codex trailer.
Title check ✅ Passed The title clearly identifies the main change: establishing the npm release boundary for the CLI.
Description check ✅ Passed The description includes the required summary, issue reference, verification, AI-use disclosure, checklist, behavior change, and review scope.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/cli-npm-release-boundary

Comment @coderabbitai help to get the list of available commands.

@M4n5ter
M4n5ter marked this pull request as ready for review August 17, 2026 10:33
@hqhq1025
hqhq1025 requested a lite review from Copilot August 17, 2026 10:33
@qodo-code-review

Copy link
Copy Markdown

PR Summary by Qodo

Establish bin-only Maka CLI release boundary and eval install preflight

✨ Enhancement 🧪 Tests 📝 Documentation ⚙️ Configuration changes 🕐 40+ Minutes

Grey Divider

AI Description

• Make maka-agent a bin-only npm package by removing JS/TS export surfaces.
• Split production CLI entry from reusable CLI core and keep dev launcher separate.
• Add maka eval preflight for paths, bundled relay assets, Python framework, and Docker.
Diagram

graph TD
  A["dist/cli.js (npm bin)"] --> B["cli-core (dispatch)"]
  B --> C["Runtime Host cmds"]
  B --> D["@maka/eval CLI"] --> E["Executor preflight"] --> G{{"Python env"}}
  E --> H{{"Docker daemon"}}
  E --> F[("Relay assets")]

  subgraph Legend
    direction LR
    _code["Code module"] ~~~ _db[("Bundled files")] ~~~ _ext{{"External dependency"}}
  end
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Use conditional exports instead of empty exports
  • ➕ Allows a supported JS import surface (e.g., internal helpers) while still exposing bins
  • ➕ More ergonomic for internal consumers than deep relative imports
  • ➖ Re-opens the risk of accidental public API commitments
  • ➖ Harder to enforce a strict release boundary for maka-agent
2. Move preflight into executor startup (harness-executor)
  • ➕ Guarantees preflight runs for any caller, not just the CLI
  • ➕ Keeps responsibility closer to where failures occur
  • ➖ Harder to fail before any attempt directory initialization/logging semantics
  • ➖ Can complicate executor lifecycle and testing (preflight vs execution side effects)

Recommendation: Current approach is appropriate: empty exports enforces a clear bin-only boundary for npm releases, and running preflight in the CLI provides early, user-friendly failures before trials start while reusing the credential-filtered preparation environment. The alternatives either weaken the boundary (conditional exports) or risk changing execution semantics (executor-level preflight).

Files changed (14) +877 / -416

Enhancement (2) +226 / -1
cli.tsRun builtin executor preflight before executing experiments +4/-1

Run builtin executor preflight before executing experiments

• Adds a preflight step for builtin Harbor/Pier executors when running via the public CLI. Ensures preflight is skipped when a custom executor loader is injected via overrides, and avoids double-loading the executor.

packages/eval/src/cli.ts

install-preflight.tsAdd Harbor/Pier install preflight for paths, relay assets, Python, and Docker +222/-0

Add Harbor/Pier install preflight for paths, relay assets, Python, and Docker

• Implements 'preflightBuiltinExecutor' to validate required machine paths and mounts, verify bundled relay assets exist, probe the pinned Python distribution/version, and check Docker daemon availability for docker environments. Runs checks using the same credential-filtered preparation environment as the trial supervisor and provides targeted error messages.

packages/eval/src/install-preflight.ts

Refactor (6) +401 / -409
cli-core.tsExtract reusable CLI parsing/dispatch into cli-core +351/-0

Extract reusable CLI parsing/dispatch into cli-core

• Introduces a standalone CLI core that owns argument parsing, help/version output, exit handling, and command dispatch. Keeps eval lazy-loaded and preserves existing TUI/run/activate/runtime-host behaviors while making the launch options explicit.

packages/cli/src/cli-core.ts

cli.tsReduce production CLI entry to a thin launcher +2/-363

Reduce production CLI entry to a thin launcher

• Replaces the previous all-in-one CLI implementation with a minimal entrypoint that calls 'launchMakaCli' using the release launch options. This isolates the production 'dist/cli.js' surface from reusable CLI logic.

packages/cli/src/cli.ts

dev-cli.tsUpdate dev launcher to use cli-core +1/-1

Update dev launcher to use cli-core

• Switches the repository-only dev CLI launcher to import 'launchMakaCli' from 'cli-core', keeping the dev profile behavior intact.

packages/cli/src/dev-cli.ts

index.tsRe-export CLI types/helpers from cli-core +1/-1

Re-export CLI types/helpers from cli-core

• Moves the public re-exports of 'parseMakaCliArgs' and 'MakaCliCommand' from 'cli.ts' to 'cli-core.ts' for internal workspace consumers.

packages/cli/src/index.ts

harness-environment.tsExtract harness preparation environment builder +43/-0

Extract harness preparation environment builder

• Creates 'createHarnessPreparationEnvironment' to build the credential-filtered environment used for harness preparation. This centralizes environment construction for reuse by both trial execution and install preflight.

packages/eval/src/harness-environment.ts

harness-executor.tsReuse shared harness environment builder +3/-44

Reuse shared harness environment builder

• Replaces the inline 'preparationEnvironment' helper with the new shared 'createHarnessPreparationEnvironment' function, keeping behavior consistent while removing duplication.

packages/eval/src/harness-executor.ts

Tests (4) +247 / -4
cli.test.tsAdd tests for bin-only boundary and supported help surface +28/-2

Add tests for bin-only boundary and supported help surface

• Switches tests to import from 'cli-core'. Adds assertions that the package manifest exposes only 'bin' and an empty 'exports', and validates that '--help' lists only supported release commands (excluding dev-only entries).

packages/cli/src/tests/cli.test.ts

pi-tui-runner.test.tsPoint TUI runner tests at new CLI core module +2/-2

Point TUI runner tests at new CLI core module

• Updates dynamic imports used in child-process probes to reference 'cli-core.js' instead of 'cli.js', keeping existing runner behavior coverage intact.

packages/cli/src/tests/pi-tui-runner.test.ts

cli.test.tsAdd CLI-level test that preflight fails before attempts start +71/-0

Add CLI-level test that preflight fails before attempts start

• Introduces a test ensuring 'runMakaEvalCli' fails with exit code 2 when required machine paths are missing, and that it does not write results beyond initializing the experiment spec output.

packages/eval/src/tests/cli.test.ts

install-preflight.test.tsAdd unit tests for builtin executor preflight +146/-0

Add unit tests for builtin executor preflight

• Covers success path (Python probe + Docker probe) and failure paths (missing mounts, mismatched Python framework version). Verifies credential-filtered environment behavior by ensuring secrets are not forwarded into preflight processes.

packages/eval/src/tests/install-preflight.test.ts

Documentation (1) +2 / -0
README.mdDocument eval CLI install-state preflight behavior +2/-0

Document eval CLI install-state preflight behavior

• Adds documentation that the public eval CLI validates machine paths, bundled relay files, pinned Python environments, and Docker availability before starting trials. Clarifies that the CLI does not install missing prerequisites.

packages/eval/README.md

Other (1) +1 / -2
package.jsonMake maka-agent bin-only via empty exports +1/-2

Make maka-agent bin-only via empty exports

• Removes 'main'/'types' and sets 'exports' to '{}' to prevent importing the package as a JS library. Retains the 'maka' and 'maka-agent' bin mapping to 'dist/cli.js'.

packages/cli/package.json

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (3)
packages/eval/src/install-preflight.ts (2)

38-42: 📐 Maintainability & Code Quality | 🔵 Trivial | 🏗️ Heavy lift

Consider reusing the decoded executor options instead of re-parsing spec.executor.config.

packages/eval/src/harness-executor.ts already decodes and validates the same fields in decodeOptions (frameworkVersion, pythonPathEnv, trialsRootEnv, tasksRootEnv, mounts, egressProxy, preparationEnvironment), including env-name shape, uniqueness, and machine-path presence. cli.ts calls loadExecutor before preflightBuiltinExecutor, so that decoding always runs first. This file adds a second parser (configText, configObject, configArray, configValueText) over the same JSON, so the two can drift.

A smaller solution is to expose the decoded HarnessOptions from the built-in executor and pass it to the preflight, keeping decoding at one source of truth. The preflight then only performs filesystem and process probes.

As per path instructions: "Determine whether it is the smallest coherent solution at the existing source of truth. Flag concrete cases where code can be deleted or simplified."

Also applies to: 196-218

Source: Path instructions


80-83: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

The bundled relay root is now computed in two places.

packages/eval/src/harness-executor.ts line 357 computes the same ../harbor path relative to the module directory. Export one shared constant or helper and use it in both files, so a future layout change cannot leave the preflight checking a stale location.

♻️ Suggested direction
-  const relayRoot = resolve(dirname(fileURLToPath(import.meta.url)), '../harbor');
+  const relayRoot = bundledRelayRoot();

Define bundledRelayRoot() in a shared module (for example harness-environment.ts) and call it from startTrial as well.

packages/eval/src/harness-environment.ts (1)

3-9: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Consider an options object for the two adjacent optional string parameters.

egressAllowedHost and networkPolicyPath are adjacent optional strings. A swapped call site compiles and produces a wrong sanitized environment silently. A named-field parameter removes that failure mode. This is now a shared, security-relevant helper with two call sites, so the surface is worth pinning.


ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: a86c2b89-e57c-4e4e-bbaf-f749c83dde16

📥 Commits

Reviewing files that changed from the base of the PR and between a81719d and ea4386c.

📒 Files selected for processing (14)
  • packages/cli/package.json
  • packages/cli/src/__tests__/cli.test.ts
  • packages/cli/src/__tests__/pi-tui-runner.test.ts
  • packages/cli/src/cli-core.ts
  • packages/cli/src/cli.ts
  • packages/cli/src/dev-cli.ts
  • packages/cli/src/index.ts
  • packages/eval/README.md
  • packages/eval/src/__tests__/cli.test.ts
  • packages/eval/src/__tests__/install-preflight.test.ts
  • packages/eval/src/cli.ts
  • packages/eval/src/harness-environment.ts
  • packages/eval/src/harness-executor.ts
  • packages/eval/src/install-preflight.ts

Included review availability: Your plan includes up to 3 reviews per rolling hour; 1 remains after this review.

Comment thread packages/cli/src/cli-core.ts

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR tightens the npm release boundary for the Maka CLI by separating the production executable entrypoint from reusable CLI logic, and adds an install-state preflight to maka eval so external prerequisites are validated before any trial starts.

Changes:

  • Split the CLI into a bin-only dist/cli.js entrypoint plus a reusable cli-core module, and update tests/exports accordingly.
  • Add maka eval install preflight checks for machine paths, bundled relay assets, pinned Harbor/Pier Python distributions, and Docker daemon availability.
  • Deduplicate harness environment construction into a shared helper used by both preflight and execution.

Reviewed changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
packages/eval/src/install-preflight.ts New install-state preflight for Harbor/Pier executors (paths/assets/Python/Docker) before trials start.
packages/eval/src/harness-executor.ts Reuses the new shared harness environment builder instead of inlining it.
packages/eval/src/harness-environment.ts New shared environment-filtering helper for harness/preflight processes.
packages/eval/src/cli.ts Runs install preflight before starting an experiment attempt (builtin executor only).
packages/eval/src/tests/install-preflight.test.ts New tests validating preflight ordering, env filtering, and error reporting.
packages/eval/src/tests/cli.test.ts New CLI test ensuring preflight failure happens before any attempt starts.
packages/eval/README.md Documents the new public CLI preflight behavior for prerequisites.
packages/cli/src/index.ts Re-exports CLI parsing/runner APIs from cli-core instead of the executable entrypoint.
packages/cli/src/dev-cli.ts Dev launcher now imports launchMakaCli from cli-core.
packages/cli/src/cli.ts Production bin entrypoint now delegates to cli-core and always launches.
packages/cli/src/cli-core.ts New module containing the CLI implementation previously in cli.ts.
packages/cli/src/tests/pi-tui-runner.test.ts Updates test harness imports from cli.js to cli-core.js.
packages/cli/src/tests/cli.test.ts Adds assertions for bin-only package surface and updates imports to cli-core.
packages/cli/package.json Removes library entrypoints and sets exports: {} to enforce bin-only boundary.
Suppressed comments (2)

packages/eval/src/install-preflight.ts:68

  • The egressProxy preflight currently resolves composeRelativePath/networkPolicyRelativePath without guarding against ".." escapes and also reports missing fields as executor.config.composeSourceEnv (missing the egressProxy prefix). This can produce confusing diagnostics and allows path traversal-style inputs that are only rejected later by harness-executor.
    const proxy = configObject(egressProxy, 'egressProxy');
    const sourceEnv = configText(proxy, 'composeSourceEnv');
    const source = machinePath(sourceEnv);
    await requirePath(source, `machine path ${sourceEnv}`, 'directory');
    await requirePath(

packages/eval/src/install-preflight.ts:179

  • optionalDirectory rethrows raw stat() errors (e.g., EACCES) without the machine-path label, which makes preflight failures less actionable than requirePath(). Consider wrapping non-ENOENT errors the same way requirePath does.
    const metadata = await stat(path);
    if (!metadata.isDirectory()) throw new Error(`${label} is not a directory: ${path}`);
  } catch (error) {
    if ((error as NodeJS.ErrnoException).code === 'ENOENT') return;
    throw error;

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread packages/eval/src/install-preflight.ts
Comment thread packages/eval/src/install-preflight.ts Outdated
@qodo-code-review

qodo-code-review Bot commented Aug 17, 2026

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📜 Skill insights (0)

Grey Divider


Remediation recommended

1. Preflight ignores termination signals ✓ Resolved 🐞 Bug ☼ Reliability
Description
runMakaEvalCli intercepts SIGINT/SIGTERM and aborts its controller, but the newly added preflight
does not receive that signal, so an active Python or Docker probe keeps the CLI alive until it
finishes or reaches the 10-second timeout. This delays shutdown in interactive use and
SIGTERM-driven automation.
Code

packages/eval/src/cli.ts[52]

+    if (!overrides.loadExecutor) await preflightBuiltinExecutor(spec, specPath);
Evidence
The CLI installs SIGINT/SIGTERM listeners that only call controller.abort(), and only
runExperiment currently receives the resulting signal. The new preflight call occurs first without
a signal, while runCheckedCommand configures only a fixed timeout on execFile, proving that
cancellation cannot reach either external probe.

packages/eval/src/cli.ts[26-40]
packages/eval/src/cli.ts[47-60]
packages/eval/src/install-preflight.ts[85-121]
packages/eval/src/install-preflight.ts[124-150]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The Eval CLI's SIGINT/SIGTERM handlers abort a controller, but `preflightBuiltinExecutor` and its `execFile` probes do not receive that signal. Propagate cancellation so an in-progress prerequisite probe terminates promptly rather than waiting for completion or the 10-second timeout.

## Issue Context
Pass the existing CLI signal into preflight, support it in the preflight dependency/command signatures, check for an already-aborted signal around filesystem-only stages, and provide it to `execFile` so Node terminates an active Python or Docker probe.

## Fix Focus Areas
- packages/eval/src/cli.ts[26-59]
- packages/eval/src/install-preflight.ts[21-33]
- packages/eval/src/install-preflight.ts[85-121]
- packages/eval/src/install-preflight.ts[124-150]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


2. Duplicated machine-path validation, unclear separation of concerns ✓ Resolved 🐞 Bug ⚙ Maintainability
Description
In packages/eval/src/cli.ts, loadExecutor(spec, specPath) constructs the Harbor/Pier executor
(whose decodeOptions/decodeMount in harness-executor.ts already checks pythonPathEnv,
trialsRootEnv, tasksRootEnv, egressProxy.composeSourceEnv, and mount sourceEnv presence via
process.env[name]) before the new preflightBuiltinExecutor runs its own, stricter checks
(filesystem existence/type, executability, Python framework version, Docker) for an overlapping set
of the same fields. The two validators are separate implementations with different strictness and
error messages, so a future field added to the executor config schema could be validated in only one
of the two places, silently weakening the preflight guarantee documented in the eval README.
Code

packages/eval/src/cli.ts[R50-52]

    const loadExecutor = overrides.loadExecutor ?? builtinExecutor;
+    const executor = loadExecutor(spec, specPath);
+    if (!overrides.loadExecutor) await preflightBuiltinExecutor(spec, specPath);
Evidence
harness-executor.ts's decodeOptions (checked for
pythonPathEnv/trialsRootEnv/tasksRootEnv/egressProxy.composeSourceEnv) and decodeMount (checked for
each mount's sourceEnv) both throw 'machine path X is unavailable' purely from presence-of-env-var
checks, run synchronously during loadExecutor before install-preflight.ts's
requirePath/optionalDirectory perform the more thorough disk-existence and type checks on the same
fields. Because both validators enumerate the same config fields independently rather than sharing
one source of truth, and preflight runs strictly after executor construction rather than being the
first gate, extending the executor config schema in only one location is an easy oversight that
would go unnoticed by the other.

packages/eval/src/harness-executor.ts[875-883]
packages/eval/src/install-preflight.ts[44-60]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Machine-path validation (pythonPathEnv, trialsRootEnv, tasksRootEnv, mounts, egressProxy composeSourceEnv) is implemented twice with different strictness: once as a lightweight env-var-presence check inside `decodeOptions`/`decodeMount` in `harness-executor.ts` (run during `loadExecutor`), and again as a thorough filesystem-existence/type check inside `preflightBuiltinExecutor` in `install-preflight.ts`. The eval CLI calls `loadExecutor` before `preflightBuiltinExecutor`, so the weaker check runs first.

## Issue Context
`packages/eval/src/cli.ts` builds the executor and only afterward invokes the newly added preflight. Because both places enumerate overlapping config fields independently, a future config field added to only one of the two validators would silently reduce the coverage the README promises ('validates ... before any trial starts').

## Fix Focus Areas
- packages/eval/src/cli.ts[50-52]
- packages/eval/src/harness-executor.ts[875-883]
- packages/eval/src/harness-executor.ts[916-926]
- packages/eval/src/install-preflight.ts[30-60]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

Context
Review mode: 🧠 Deep: This is a behavior-changing release-boundary refactor plus a substantial Eval preflight implementation spanning independent CLI, packaging, environment, external-process, and trial-start paths, making multiple subtle defects plausible.

Grey Divider

Tip of the day
💡 Did you know, you can route each action level your way: inline, summary, both, or drop

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

Comment thread packages/eval/src/cli.ts Outdated
Comment thread packages/eval/src/cli.ts Outdated
Run install checks from the Harbor/Pier executor's decoded configuration so schema validation, egress paths, and preparation environments cannot drift. Propagate cancellation through prerequisite probes and remove the library barrel made unreachable by the bin-only CLI boundary.

Generated-by: OpenAI Codex

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 321d7990-940a-40f8-89ff-50420f23b102

📥 Commits

Reviewing files that changed from the base of the PR and between ea4386c and 2b5e7c1.

📒 Files selected for processing (7)
  • packages/cli/src/__tests__/cli.test.ts
  • packages/cli/src/index.ts
  • packages/eval/src/__tests__/install-preflight.test.ts
  • packages/eval/src/cli.ts
  • packages/eval/src/harness-environment.ts
  • packages/eval/src/harness-executor.ts
  • packages/eval/src/install-preflight.ts
💤 Files with no reviewable changes (1)
  • packages/cli/src/index.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/cli/src/tests/cli.test.ts

Included review availability: Your plan includes up to 3 reviews per rolling hour; 2 remain after this review.

Comment thread packages/eval/src/harness-environment.ts Outdated

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 14 out of 14 changed files in this pull request and generated no new comments.

Suppressed comments (1)

packages/eval/src/install-preflight.ts:140

  • This catch labels all failures as “Docker daemon is unavailable”, which is misleading when the Docker CLI itself is missing (e.g. ENOENT) or not executable. Prefer a more accurate message that covers both missing CLI and daemon failures.
      throw new Error(`Docker daemon is unavailable: ${errorMessage(error)}`);

Canonicalize the trusted egress root and selected Compose and policy files before accepting them, so lexical containment cannot be bypassed through a symlink.

Generated-by: OpenAI Codex

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
packages/eval/src/install-preflight.ts (1)

210-218: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Validate that an existing trials root is usable.

optionalDirectory accepts an existing directory without checking write and search access. Line 58 uses this helper for options.trialsRootEnv, but startTrial later changes its mode and writes the trial configuration below it. A non-writable trials root therefore passes preflight and fails only after evaluation setup starts.

For an existing trials root, check W_OK | X_OK. For a missing trials root, validate the nearest existing parent before accepting the path.

🧹 Nitpick comments (1)
packages/eval/src/harness-environment.ts (1)

57-72: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Keep one source of truth for path containment.

Lines [57-72] add shared helpers, but the supplied snippets still show equivalent implementations in packages/eval/src/install-preflight.ts and packages/eval/src/harness-executor.ts. Import these helpers from packages/eval/src/harness-environment.ts and delete the local copies. Otherwise, the symlink and containment fixes can diverge across preflight and trial execution.

As per path instructions, flag concrete code that can be deleted or simplified to keep the smallest coherent solution.

Source: Path instructions


ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: a594e6b6-525d-4038-a51e-37b0f3c510ba

📥 Commits

Reviewing files that changed from the base of the PR and between 2b5e7c1 and be70bc0.

📒 Files selected for processing (4)
  • packages/eval/src/__tests__/install-preflight.test.ts
  • packages/eval/src/harness-environment.ts
  • packages/eval/src/harness-executor.ts
  • packages/eval/src/install-preflight.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/eval/src/tests/install-preflight.test.ts

Included review availability: Your plan includes up to 3 reviews per rolling hour; 1 remains after this review.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 14 out of 14 changed files in this pull request and generated no new comments.

Suppressed comments (1)

packages/eval/src/harness-environment.ts:72

  • resolveRealPathWithinRoot() will currently surface raw realpath() system errors (e.g., ENOENT/EACCES) without the provided label, which makes egress path failures harder to diagnose and inconsistent with the clearer messages produced by requirePath() in the preflight. Wrapping realpath() failures with a label-specific error keeps diagnostics actionable when egress assets disappear or are unreadable at runtime.
): Promise<string> {
  const resolved = resolvePathWithinRoot(root, path, label);
  const [canonicalRoot, canonicalPath] = await Promise.all([realpath(root), realpath(resolved)]);
  assertPathWithinRoot(canonicalRoot, canonicalPath, label);
  return canonicalPath;

Keep install preflight aligned with the filesystem operations required to prepare a trial, including creatable missing roots. Improve prerequisite diagnostics when Docker or canonical egress paths are unavailable.

Generated-by: OpenAI Codex

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 2f8e281b-436a-4fdd-bcad-0c59938a6612

📥 Commits

Reviewing files that changed from the base of the PR and between be70bc0 and 8fc0387.

📒 Files selected for processing (3)
  • packages/eval/src/__tests__/install-preflight.test.ts
  • packages/eval/src/harness-environment.ts
  • packages/eval/src/install-preflight.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/eval/src/harness-environment.ts

Included review availability: Your plan includes up to 3 reviews per rolling hour; 0 remain after this review.

Comment thread packages/eval/src/install-preflight.ts
Distinguish a genuinely missing trials directory from a dangling symlink so install preflight cannot approve a path that recursive mkdir will reject.

Generated-by: OpenAI Codex
@M4n5ter
M4n5ter merged commit 5d9ce0d into main Aug 17, 2026
13 checks passed
@M4n5ter
M4n5ter deleted the feat/cli-npm-release-boundary branch August 17, 2026 13:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants