Skip to content

fix(dsh): pin continuation Core commands to the resolved CLI executable - #9309

Merged
huangruiteng merged 5 commits into
loopx-project:mainfrom
LIHUA919:codex/dsh-cli-parity-9300
Nov 24, 2026
Merged

huangruiteng merged 5 commits into
loopx-project:mainfrom
LIHUA919:codex/dsh-cli-parity-9300

Conversation

@LIHUA919

@LIHUA919 LIHUA919 commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Part of #9300

Goal / source

Issue #9300 (source review by @xiaobaifly7): DSH continuation Turns carry Core-rendered text that always prefixes bare loopx — heartbeat-prompt --thin task bodies and quota should-run settlement command_template strings both render through loopx_cli_argv() — while the plugin's /loopx skill runs the command the plugin resolved (LOOPX_BIN, PATH loopx, managed launcher, or python -m loopx.cli). When the Agent shell's PATH names a different LoopX install, guard/writeback/settlement run a different Core binary than admission used.

Gap

The Driver called heartbeat-prompt and quota should-run without --cli-bin, and the plugin exports no LOOPX_BIN/PATH adjustment for the Agent shell.

Change (packages/dsh-loopx-plugin)

  • resolveLoopXCommand derives a one-executable Core route (LoopXCommand.cliBin) for single-executable candidates: a configured LOOPX_BIN passes through as-is (absolute) and the bare loopx PATH candidate resolves against the probe PATH to that absolute file (first executable match, mirroring spawn discovery). Core's validate_cli_bin rules are respected — no shell text such as "$LOOPX_BIN" is ever passed.
  • The Driver passes the route as the global --cli-bin on quota should-run (pins settlement/recovery templates rendered through loopx_cli_argv()), and as both the global option and the heartbeat-prompt subcommand option on heartbeat-prompt --thin (the subcommand value is what task-body command prefixes embed). Rendered text starts with <abs> --cli-bin <abs> ..., which re-pins every nested Core invocation.
  • Host-injected commands that predate the field keep their plain file route (coreRouteBin); the Driver never re-resolves an injected name against its own PATH.

Managed runtime and fallback

On POSIX, the plugin now generates an executable launcher in the managed runtime directory. The launcher invokes the same Python executable and managed script by absolute path, and the Driver passes it as Core's --cli-bin for the continuation guard and settlement templates.

Windows managed runtimes, standalone python -m loopx.cli fallback, and runtimes where no executable launcher can be bound still render bare loopx and report cli_route_unpinned. An absolute executable LOOPX_BIN pins those sessions. Issue #9300 remains open for the uncovered routes.

Validation

  • Maintainer follow-up: exercised the managed resolver, real Core heartbeat guard, and durable settlement on macOS with another loopx first on PATH. Both generated commands used the managed runtime and settlement returned all expected receipts.

  • Red/green with an independent oracle: new driver tests assert the argv handed to Core contains the absolute --cli-bin route in the global position (and both positions for heartbeat-prompt) instead of the previous bare-loopx-only prefix; red on the pre-fix tree, green after.

  • Resolver tests: absolute configured path passes through; bare configured and PATH loopx names resolve against the probe PATH; PATH precedence and non-executable files are skipped; interpreter-prefixed routes stay unpinned; unresolvable bare names degrade to the probed name (never an invented path).

  • Full plugin suite: 381 passed (372 baseline + 9 new), including the real-Path admission-closeout integration spec that runs the real Core (python -m loopx.cli) through the new flags; pnpm typecheck green.

  • Real-Core render check: heartbeat-prompt --thin --cli-bin /opt/pinned/loopx renders thin_prompt_command: /opt/pinned/loopx --cli-bin /opt/pinned/loopx ... --registry ... heartbeat-prompt --thin ....

  • uv run --extra test loopx canary premerge --from-git-diff --git-diff-base f4eeed9d325bfd6e8994175798a8d7480ab8c199: ok (direct checks, catalog canaries, risk profile smokes incl. dsh-loopx-plugin quality/package/runtime, public boundary).

Boundary

Plugin runtime + tests + plugin README only; no Core Python change (Core's --cli-bin semantics and validators are already covered by tests/test_command_invocation.py). No UI surface changed, so no first-screen capture applies.

The DSH continuation Driver rendered automatic-Turn text through Core
without --cli-bin, so thin heartbeat task bodies and quota settlement
command templates always prefixed bare loopx: when the agent shell's
PATH names a different LoopX install than the plugin-probed command,
guard, writeback and settlement ran a different Core binary than
admission used (loopx-project#9300).

resolveLoopXCommand now derives the one-executable Core --cli-bin route
for single-executable candidates, resolving bare names against the probe
PATH to that absolute file, and the Driver passes it as the global route
on quota should-run and as both the global and heartbeat-prompt options
so rendered task bodies embed the pinned executable. Host-injected
commands without the new field keep their plain file route.

Interpreter-prefixed routes (managed launcher, python -m loopx.cli)
cannot be expressed as one --cli-bin executable; their continuation text
keeps Core's bare loopx route and the Driver discloses that once in its
warning log, with LOOPX_BIN pointing at one absolute executable as the
pinning remedy.

Signed-off-by: Lihua <1017343802@qq.com>

@loopx-agent loopx-agent left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Reviewer: model_agent · gpt-6.2-sol · OpenAI · runtime_reported · xhigh

[P2] 相对 PATH 让续跑仍能选中另一套 Core。 设置 PATH=bin:/usr/bin:/bin,在宿主、项目和 Agent 三个 cwd 下放置各自的 bin/loopx。路由被保存为 bin/loopx。版本探测、Driver 的 runJsonCommand 与切换 cwd 后的渲染路由执行分别命中三个不同文件。 解析和版本探测应共享同一个实际可执行路径,业务 spawn 与 Core 渲染的 --cli-bin 使用该绝对路径。无法绑定时沿既有 fallback 给出可诊断状态。 准确头源码

动机 / Motivation

用 DSH 启动或续跑 LoopX Goal,且宿主、项目或 Agent shell 使用不同工作目录及安装的用户。 基线的 Core 续跑正文及结算模板默认写入裸 loopx,由 Agent shell 的 PATH 决定运行实例。

该 PR 对绝对 PATH 文件能固定 Core。PATH 含相对目录时,版本探测、Driver 准入及 Agent 续跑仍会因 cwd 改变而使用手边不同的程序。 Node 实际启动三个隔离版本,依次命中 host、project、agent。单改为绝对路径的对照中,续跑仍使用 host 原版本。 现有 Core 继续拥有回执、写回与结算。这个窄修评估 DSH 的命令选择和传递。

改动思路 / Approach

DSH adapter 持有 executable 发现和子进程传输,Core 持有命令模板和准入回执验证。 解析和版本探测应共享同一个实际可执行路径,业务 spawn 与 Core 渲染的 --cli-bin 使用该绝对路径。无法绑定时沿既有 fallback 给出可诊断状态。 在 DSH resolver 和现有 Core --cli-bin 之间固定单文件可执行路径。解释器加脚本的传输另行处理,作为明确披露的未覆盖分支。

本次以 GitHub #9300 的契约核 SAME_CORE_EXECUTABLE 与 NESTED_CORE_ROUTE。续跑使用与 plugin 探测的 Core 同一可执行来源。 heartbeat 正文、guard 及结算模板都使用同一可执行来源。 依据

具体改动 / Changes

实际合并基点到准确头是 5 files +367/-8。真实合并基线为 f4eeed9。当前 GitHub base 的 Core 命令路由文件与该合并基点同 blob,新主干合成无冲突。

关键代码讲解

  • coreCliBinRoute 扫描 PATH 并把同一个程序名称交给 Core。join 保留相对路径,且候选 spawn 仍使用裸名称。 准确头源码
  • resolveLoopXCommand 在宿主工作目录探测版本,返回 file 和独立计算的 cliBin。 准确头源码
  • readQuota 在 Session 工作目录运行原命令,并把计算后的路由传给 Core 的 guard 模板。 准确头源码
  • readHeartbeat 同时在全局和 heartbeat 子命令参数传递同一路径,由 Core 渲染任务正文。 准确头源码

对主干的风险 / Risks

PASS。绝对 PATH 目录下,resolver 给出绝对路径。即使 Agent 换了工作目录且 PATH 仍含另一个安装,绝对路径控制组仍命中原宿主可执行文件。 当前精确头 381 项包测试和 TypeScript 检查通过,包含原包的真实 Core closeout 集成。独立的实际子进程实验覆盖绝对成功与相对失败;未向远端查询 CI。

FAIL。 设置 PATH=bin:/usr/bin:/bin,在宿主、项目和 Agent 三个 cwd 下放置各自的 bin/loopx。路由被保存为 bin/loopx。版本探测、Driver 的 runJsonCommand 与切换 cwd 后的渲染路由执行分别命中三个不同文件。 Node 将有效的相对 PATH 和配置路径绑定到各次 spawn 的 cwd,生成的续跑前缀可以再次改变安装来源。

语义与 CI 对齐

只在已激活的 Session 续跑读取 guard 和 heartbeat。单文件 route 有值时添加参数,解释器前缀沿既有裸命令分支。 Executable selection is host-local. Binding, Goal authority and settlement policy remain inside Core. 绝对路径适用范围在 README 已说明。相对路径仍发生选择偏移,应在同一 resolver 归一化并测试。 相对路径问题通过真实 Node 子进程和隔离可执行文件复现。现有真实 Core 集成测试及 381 项包测试通过。尚未在 Windows 和挂载的 Agent shell 做现场验证。

我的整体评价 / Verdict

这次修复应留在 DSH 命令适配器。让可执行文件解析、版本探测、guard 和生成的续跑命令共用一个路径,然后复验目录切换。 在 DSH resolver 和现有 Core --cli-bin 之间固定单文件可执行路径。解释器加脚本的传输另行处理,作为明确披露的未覆盖分支。 相对路径问题通过真实 Node 子进程和隔离可执行文件复现。现有真实 Core 集成测试及 381 项包测试通过。尚未在 Windows 和挂载的 Agent shell 做现场验证。

English verdict: REQUEST_CHANGES at 94292f3. A relative PATH directory can make the version probe, Driver admission, and rendered continuation select different LoopX executables. Bind both execution and rendering to the same verified executable.

Comment thread packages/dsh-loopx-plugin/src/cli.ts Outdated
const searchPath = env.PATH ?? env.Path
for (const directory of searchPath?.split(delimiter) ?? []) {
const resolved = probeExecutableFile(directory, name)
if (resolved !== undefined) return resolved

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

[P2] 相对 PATH 让续跑仍能选中另一套 Core。 设置 PATH=bin:/usr/bin:/bin,在宿主、项目和 Agent 三个 cwd 下放置各自的 bin/loopx。路由被保存为 bin/loopx。版本探测、Driver 的 runJsonCommand 与切换 cwd 后的渲染路由执行分别命中三个不同文件。

解析和版本探测应共享同一个实际可执行路径,业务 spawn 与 Core 渲染的 --cli-bin 使用该绝对路径。无法绑定时沿既有 fallback 给出可诊断状态。 在多个 cwd 下使用同名不同标识的真实可执行文件。分别执行版本探测、Driver guard 和渲染命令,断言实际命中同一文件,覆盖裸名称和相对 LOOPX_BIN。

Review P2 on loopx-project#9309: a relative PATH entry (PATH=bin:/usr/bin:/bin) let
coreCliBinRoute store a relative route (bin/loopx), so the version probe
(host cwd), driver admission spawns (Session cwd), and the rendered
Core route execution (agent cwd) could each select a different loopx
install; the continuation prefix could still change the Core source.

The resolver now binds one absolute executable before probing:
explicit paths normalize against the discovery working directory, bare
names resolve to the exact PATH file, and relative PATH entries are
made absolute at discovery. The bound path becomes the candidate file,
so the version probe, every business spawn, and the Core-rendered
--cli-bin text run the same file. When no single executable can be
bound (unlocatable name, illegal --cli-bin value), the candidate keeps
bare probe semantics, Core keeps its bare loopx fallback route, and the
driver's existing typed warning discloses the unbound state;
coreRouteBin now only validates the resolver-bound route.

Adds a real-subprocess three-cwd regression matrix (probe, driver
admission from the Session cwd, and sh -c execution of the rendered
route in the agent cwd) with per-directory decoy installs, plus the
absolute-PATH control group; the relative case is red on 94292f3 and
green now, the control holds in both.

Signed-off-by: Lihua <1017343802@qq.com>
@LIHUA919

Copy link
Copy Markdown
Contributor Author

Reply to the P2 (relative PATH route drift): fixed in 920700c (single commit on top of 94292f3, same reviewable head lineage).

Normalization approach

  • resolveLoopXCommand now binds one absolute executable before probing and makes it the candidate file: explicit paths normalize against the discovery working directory (resolve()), bare names resolve to the exact PATH file, and relative PATH entries are made absolute at discovery (join(resolve(directory), name) with an executable-bit check). The version probe, every later business spawn (runJsonCommand), and the Core-rendered --cli-bin text therefore all run the same file — SAME_CORE_EXECUTABLE and NESTED_CORE_ROUTE for the relative case too.
  • When no single executable can be bound (unlocatable name, illegal --cli-bin value), the candidate keeps bare probe semantics, Core keeps its bare loopx fallback route, and the driver's existing typed warning discloses the state once (cli_route_unpinned with the closed candidate label). coreRouteBin is now a validating accessor over the resolver-bound cliBin only; it never re-resolves or invents a path.
  • Interpreter-prefixed routes (managed launcher, python -m loopx.cli) stay on the unpinned branch with the same disclosure as before.

Three-cwd regression matrix (real Node subprocesses)

tests/driver.spec.ts → route binding across working directories reproduces your setup: PATH=bin:/usr/bin:/bin with a distinct bin/loopx fixture in the host, project, and agent directories (each script reports its own absolute path on stderr). Three stages per run:

Stage cwd Pre-fix 94292f3 Fixed 920700c
1 version probe (resolver) host host file; route stored as bin/loopx (red: isAbsolute fails) host file; route = absolute host file
2 driver admission (runJsonCommand) project session cwd project decoy file (route re-resolved) host file only
3 rendered route execution (sh -c "<route> --cli-bin <route> …") agent would re-resolve per cwd host file only

The relative-entry case is red on 94292f3 and green on 920700c; stage 2 additionally asserts every admission spawn (>3) reported the same single executable and no admission warnings.

Control group

The absolute-PATH variant of the same matrix (first PATH entry absolute, decoys still present in both other cwds) passes on both the pre-fix and fixed heads — matching your independent experiment — and an explicit absolute PATH entry stays bound exactly as written. A unit test also pins the relative-entry normalization itself (normalizes a relative PATH entry against the discovery directory), and the unlocatable-name test now expects the unpinned fallback (cliBin undefined, bare file retained).

Validation

Full plugin suite 384 passed (381 prior + matrix/control/normalization additions, including the real-Core admission-closeout integration), pnpm typecheck green, loopx canary premerge --from-git-diff --git-diff-base f4eeed9d3 (current merge-base after fetching latest main, which has not touched packages/dsh-loopx-plugin since) passed: 16 checks, 0 failures.

@loopx-agent loopx-agent left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Reviewer: model_agent · gpt-6.2-sol · OpenAI · runtime_reported · xhigh

[P2] 插件自管运行时仍会把续跑交给另一套 Core。 未配置 LOOPX_BIN 时,存在自管 launcher 的真实 DSH resolver 优先选中它。用准确头的 Core 渲染真实 heartbeat 正文后,首个续跑 guard 仍以裸 loopx 开头,实际运行它命中了独立 PATH 替身。当前描述的 Fixes #9300 会一并关闭这个仍存在的安装路径问题。 让插件自管入口提供可直接执行、指向原隔离 runtime 的 launcher,向现有单可执行文件接口传它的绝对路径。用另一套 PATH 做反事实,核对 guard 和结算均命中同一 Core。若本 PR 先落单文件修复,保留 #9300 待后续解决自管路径,移除自动关闭声明。 准确头源码

动机 / Motivation

从 DSH 自管运行时或显式 LoopX 安装启动 Goal 的用户,需要续跑使用 Driver 实际准入的 Core。 基线的续跑命令由 Core 以裸 loopx 输出,Agent shell 的 PATH 可以命中另一个安装。 单文件 CLI 现在在 discovery 时绑定绝对路径,随后版本探测、准入与渲染沿此路径。自管 Python launcher 仍生成裸 loopx。 未配置 LOOPX_BIN 时,存在自管 launcher 的真实 DSH resolver 优先选中它。用准确头的 Core 渲染真实 heartbeat 正文后,首个续跑 guard 仍以裸 loopx 开头,实际运行它命中了独立 PATH 替身。当前描述的 Fixes #9300 会一并关闭这个仍存在的安装路径问题。 现有 Core 继续持有 Goal 许可、quota 与回执。验收范围是已绑定 DSH Session 的命令来源一致。

以 2026-11-23T07:42:15Z 的要求核对当前准确头。SINGLE_EXECUTABLE_ROUTE 为 implemented。 MANAGED_RUNTIME_ROUTE 为 not_met。 原始要求

改动思路 / Approach

DSH adapter 拥有 CLI 发现及进程调用,Core 拥有命令模板、绑定和 Turn 准入与结算。 保留单可执行文件的路径绑定,把自管路线接到同一 Core 路由,由现有 bootstrap 提供可直接执行的 launcher。 让插件自管入口提供可直接执行、指向原隔离 runtime 的 launcher,向现有单可执行文件接口传它的绝对路径。用另一套 PATH 做反事实,核对 guard 和结算均命中同一 Core。若本 PR 先落单文件修复,保留 #9300 待后续解决自管路径,移除自动关闭声明。 旧显式绝对 file 的 host 注入命令若没有新增 cliBin 会走 unpinned。两参数的受管 launcher 是更常见的未覆盖产品路径。

具体改动 / Changes

实际合并基点 f4eeed9 到准确头共 6 files +538/-19。与当前主干合成无冲突。主干另一条 Codex 恢复提示分支不进入本次 DSH 请求。改动沿用既有 typed 记录和路由词汇,生产路径、测试和适用文档均按此差异复核。

关键代码讲解

  • resolvePluginLoopXCommand 已有自管 launcher 时正常 bootstrap 路径把它交给 discovery。 准确头源码
  • resolveLoopXCommand 对单文件绑定绝对路由,对自管 Python+脚本保留 prefix。 准确头源码
  • coreRouteBin 调用方有显式 cliBin 才能给渲染端传路由;无绑定返回 undefined。 准确头源码
  • readQuota 仅在 resolver 给出路由时由既有参数固定渲染模板。 准确头源码

对主干的风险 / Risks

复测三个工作目录的相对 PATH 反例,版本、业务 spawn 以及 Agent shell 路由均命中宿主同一文件;显式绝对 LOOPX_BIN 的真实 Core 正文也固定了路径。 未配置 LOOPX_BIN 时,存在自管 launcher 的真实 DSH resolver 优先选中它。用准确头的 Core 渲染真实 heartbeat 正文后,首个续跑 guard 仍以裸 loopx 开头,实际运行它命中了独立 PATH 替身。当前描述的 Fixes #9300 会一并关闭这个仍存在的安装路径问题。

384 个包测试、TypeScript、package/runtime 及直接运行完整 quality 阶段通过。标准 premerge 16 项有 2 项超时,都在同一 quality 阶段的 120 秒限制。 实测使用 Node 和当前源码 Core 的真实 heartbeat 渲染,以及本地替身作为另一套 CLI。没有驱动活跃 DSH Session 或查询远端 CI,也未实测 Windows。

语义与 CI 对齐

旧显式绝对 file 的 host 注入命令若没有新增 cliBin 会走 unpinned。两参数的受管 launcher 是更常见的未覆盖产品路径。 本轮使用本地准确头验证。未查询远端 CI。

我的整体评价 / Verdict

保留单可执行文件的路径绑定,把自管路线接到同一 Core 路由,由现有 bootstrap 提供可直接执行的 launcher。 未配置 LOOPX_BIN 时,存在自管 launcher 的真实 DSH resolver 优先选中它。用准确头的 Core 渲染真实 heartbeat 正文后,首个续跑 guard 仍以裸 loopx 开头,实际运行它命中了独立 PATH 替身。当前描述的 Fixes #9300 会一并关闭这个仍存在的安装路径问题。 实测使用 Node 和当前源码 Core 的真实 heartbeat 渲染,以及本地替身作为另一套 CLI。没有驱动活跃 DSH Session 或查询远端 CI,也未实测 Windows。

English verdict: REQUEST_CHANGES at 920700c. The previous relative-PATH split is fixed. The ordinary managed launcher still renders a bare LoopX guard, and the real rendered command selects another executable on the agent PATH.

: [
...managedCandidates,
{ file: 'loopx', prefix: [], skillCommand: 'loopx' },
...managedCandidates.map(spec => ({ spec, label: 'managed-launcher' as const })),

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

[P2] 插件自管运行时仍会把续跑交给另一套 Core。 未配置 LOOPX_BIN 时,存在自管 launcher 的真实 DSH resolver 优先选中它。用准确头的 Core 渲染真实 heartbeat 正文后,首个续跑 guard 仍以裸 loopx 开头,实际运行它命中了独立 PATH 替身。当前描述的 Fixes #9300 会一并关闭这个仍存在的安装路径问题。

让插件自管入口提供可直接执行、指向原隔离 runtime 的 launcher,向现有单可执行文件接口传它的绝对路径。用另一套 PATH 做反事实,核对 guard 和结算均命中同一 Core。若本 PR 先落单文件修复,保留 #9300 待后续解决自管路径,移除自动关闭声明。 用插件自管 runtime 和另一套 PATH CLI 运行已有公开发现和真实 heartbeat 渲染,再执行生成的 guard 与结算命令,核对所有边界选中同一 Core。

@mergify

mergify Bot commented Nov 24, 2026

Copy link
Copy Markdown

This pull request has merge conflicts with main and cannot be merged
until they are resolved. Please rebase or merge the base branch, @LIHUA919.

Choose the remote for the base repository, not an out-of-date fork.
For a fork clone, first inspect git remote -v; upstream must point
to https://github.com/loopx-project/loopx.git. If it is absent, add it
with git remote add upstream https://github.com/loopx-project/loopx.git.
Then run:

git fetch upstream
git rebase upstream/main
# Resolve each conflict, git add the resolved files, then git rebase --continue.
git push --force-with-lease origin HEAD

For a same-repository clone whose origin points to
https://github.com/loopx-project/loopx.git, use origin instead of
upstream for fetch/rebase. If you prefer merging the base, use
git merge <base-remote>/main and push normally.

Keep the DCO Signed-off-by trailer on every commit when you rebase.
https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork

@mergify mergify Bot added the needs-rebase Mergify: the pull request has merge conflicts with its base branch label Nov 24, 2026
Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
@mergify mergify Bot removed the needs-rebase Mergify: the pull request has merge conflicts with its base branch label Nov 24, 2026
loopx-agent
loopx-agent previously approved these changes Nov 24, 2026

@loopx-agent loopx-agent left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Reviewer: model_agent · gpt-6.2-sol · OpenAI · runtime_reported · xhigh

动机 / Motivation

从 DeepSeek Harness 自动续跑 Goal 的用户,需要 Shell 中的后续命令使用 Driver 实际准入的 LoopX。 当另一套安装排在 PATH 首位,自管运行时虽然用于准入,基线生成的裸 loopx 守卫仍由另一套安装执行。 当前提交的正常 POSIX 自管路径固定可执行入口。真实准入、守卫与结算均沿同一安装,返回同一 Turn 的三份回执。 本轮变更落在 DSH 的 CLI 发现、命令转发、自管运行时包装和测试,Core 继续负责准入、额度与结算。 Windows 自管运行时、无法生成包装器的目录和 Python 模块回退仍可产生裸命令。这些路径继续由开放问题 #9300 跟踪。

改动思路 / Approach

保留 Core 已有的单可执行文件约定。DSH 在能定位文件时传 --cli-bin,自管 Python 加脚本的 POSIX 组合由插件生成包装器,避免在 Agent Shell 改写 PATH。 本轮变更落在 DSH 的 CLI 发现、命令转发、自管运行时包装和测试,Core 继续负责准入、额度与结算。 旧求改指出的普通 POSIX 自管启动路径现在可以用相同的 CLI 约定验证。 前次评审

具体改动 / Changes

关键代码讲解

  • discoverExecutablePath。发现阶段把 PATH 及显式文件锚定绝对路径,版本探测和后续进程沿同一文件。 精确提交源码
  • managedExecutable。按 Python 与启动脚本组合生成绝对入口,原子发布可执行文件,旧命令仍引用旧组合。 精确提交源码
  • resolvePluginLoopXCommand。正常 POSIX 自管入口绑定 cliBin。只读目录保留可运行的 Python 路线。 精确提交源码
  • readQuota。传全局 --cli-bin,使 Core 结算模板保持同一入口。 精确提交源码
  • readHeartbeat。给全局和 heartbeat 子命令传同一路由,使生成的守卫继承绑定。 精确提交源码

按 2026-11-23T07:42:15Z 的问题范围,SINGLE_EXECUTABLE_ROUTE 与 POSIX_MANAGED_ROUTE 已实现,REMAINING_FALLBACK_ROUTES 由原问题继续跟踪。 验收来源

对主干的风险 / Risks

相同合成环境下,主干的真实渲染触发 PATH 中的替身。候选在同一入口固定自管包装器,并在替身位于 PATH 首位的条件下通过真实守卫与结算。只读目录保持原回退。 现有可执行路径的路由由 cliBin 字段明确承载。使用自定义 resolveCommand 时,若要固定渲染路线,须提供该字段。 首次独立集成运行达 30 秒超时,后续同提交未改用例在 17 秒内通过。集成测试诊断另确认该常规写回模板可执行,退出码为零。 受控运行覆盖源码 Core 和 macOS 上的 POSIX Shell。Windows 原生路径和活跃 DSH Session 已安装态有待验证。

语义与 CI 对齐

Node 24、真实 Core、本地临时 File 权威状态和另一套 PATH 替身。精确头的未修改集成用例通过,守卫成功并读回三份同 Turn 回执。 CLI、Driver、初始化定向用例 233 项通过,TypeScript、插件构建和 git diff --check 通过。打包插件的 DSH 0.2.2-rc.3 真实隔离 profile 冒烟验证了初始化、技能读回及 Start/Pause。 整包 391 项通过,既有 SQLite 旧 Pause 用例一次超时,首次单跑复验仍超时。随后基线与候选先后独立运行均通过,测试、GoalBar 和子进程调用源码一致。超时原因仍待确认。 既有 Core 最低版本 2.4.0 已提供全局及 heartbeat 子命令两处 --cli-bin。静态类型与真实命令保持同一路由。 最低版本参数

我的整体评价 / Verdict

普通 POSIX 自管路径现可完成本轮交付。长程续跑在不同 Shell 路径下保留同一 Core,原额度和身份规则继续由 Core 执行。用户可以通过同 Turn 回执定位实际进程路径。Windows 自管运行时、无法生成包装器的目录和 Python 模块回退仍可产生裸命令。这些路径继续由开放问题 #9300 跟踪。

English verdict: APPROVE at 373a6e3. The POSIX managed route now keeps the same Core through admission, the rendered guard and settlement despite a competing PATH installation. Issue #9300 remains open for unbound fallback routes.

Round-2 review side note on loopx-project#9309: a host-injected command with an
explicit absolute file but no resolver-bound cliBin fell to the
disclosed unpinned branch even though that file is exactly what the
Driver spawns. coreRouteBin now passes one absolute, prefix-free
injected file through unchanged (never re-resolved), while bare or
relative names, interpreter-prefixed routes, and values Core's parser
would reject stay unbound with the existing cli_route_unpinned
disclosure.

Adds unit coverage for the route handed to Core across injected shapes
and driver-level red/green tests for the absolute pass-through and the
bare/relative unpinned disclosure.

Signed-off-by: Lihua <1017343802@qq.com>
@huangruiteng
huangruiteng merged commit 02843a0 into loopx-project:main Nov 24, 2026
8 of 10 checks passed
@LIHUA919

Copy link
Copy Markdown
Contributor Author

Reply to the round-2 review (P2: managed runtime still hands continuation to another Core, MANAGED_RUNTIME_ROUTE not_met at 920700c): fixed via path (a) at 373a6e3, plus be2bd0b for your side note. MANAGED_RUNTIME_ROUTE is now met on POSIX with a real-subprocess counterfactual; the remaining uncovered routes are disclosed and tracked below.

How the managed launcher is pinned now

  • Managed candidates normalize the probed interpreter to an absolute path first, then resolvePluginLoopXCommand generates one executable launcher inside the same already-isolated plugin runtime directory: #!/bin/sh\nexec <abs-python> <loopx_cli.py> "$@", written atomically (wx + rename, mode 0700) and named by the sha256 of its content. No new download, install, PATH entry, or permission surface — it only execs the exact Python the adapter probed and the existing managed script.
  • That launcher is bound as cliBin, so the version probe, every Driver admission spawn, and the Core-rendered --cli-bin text run one entry point. Content-hash naming keeps already-queued continuation commands pinned to the runtime that admitted them if a later resolution selects another Python; a read-only runtime directory degrades to the existing cli_route_unpinned disclosure instead of failing.
  • Honest scope: Windows managed runtimes and the python -m loopx.cli fallback still cannot be expressed as one validate_cli_bin-safe executable (sh shim / .cmd/.ps1 were the reasons examined in round 2); they keep the disclosed bare-loopx route, the PR body says Part of [Bug]: DSH continuation Turns run bare "loopx" while the plugin's /loopx skill runs "$LOOPX_BIN" #9300, and [Bug]: DSH continuation Turns run bare "loopx" while the plugin's /loopx skill runs "$LOOPX_BIN" #9300 remains open for them.

Counterfactual regression (real Core, real subprocesses)

New integration test keeps managed Core across a different agent PATH (tests/admission-closeout.integration.spec.ts): a different loopx is placed first on PATH (stand-in verified to win loopx --version), the plugin resolver still selects the managed runtime, and then: the real Core renders the thin heartbeat with the bound launcher route → the rendered guard executes via sh -c from the other-PATH cwd and admits → the durable-writeback settlement template executes through the same route and returns all three receipts → the invocation log proves heartbeat-prompt, quota should-run, and refresh-state were all served by the managed runtime. Repeated resolution binds the identical launcher (stable route for queued commands).

Your side note (host-injected absolute file without cliBin)

Fixed in be2bd0b: coreRouteBin passes one absolute, prefix-free injected file through unchanged — it is exactly what the Driver spawns — while bare/relative names, interpreter-prefixed routes, and parser-hostile values stay unbound with the existing disclosure. Red/green: the two pass-through tests fail at 373a6e3 and pass at be2bd0b; shape coverage added in cli.spec.ts (route handed to Core for rendering).

Validation

  • Plugin suite 402/402 locally (includes the real-Core admission-closeout integration) and twice inside premerge; pnpm typecheck green.
  • loopx canary premerge --from-git-diff --git-diff-base e5d5945f6 (current merge-base): 16/16 checks passed, public boundary clean over 9 changed files.
  • CI: the dsh-plugin matrix (ubuntu + windows) passed at 373a6e3; be2bd0b's run was still queued when this was posted — its delta over 373a6e3 is the pass-through plus tests, covered by the local gates above.
  • Mergeable: dry-run against latest main (e116109) is clean; the earlier mergify conflict predates the main merge in b41af16.

Premerge timeout (2 checks, same second, quality phase)

Reproduced and characterized on the final head (10-core M4, 4P+6E):

condition quality phase vs the 120 s per-check budget
ambient 56–68 s 47–57 %
+4 CPU hogs 95 s ~79 % (at the 80 % warning line)
+8 CPU hogs 142 s over budget

The check is a serial chain (typecheck → 402-test suite → two smokes) and is selected twice per premerge run (once via the catalog profile, once via the risk profile), which is why a contended host reports exactly two same-second timeouts of the same 120 s limit. The time is dominated by the 14 pre-existing real-Core admission-closeout integration tests (~60 s ambient); this PR adds ~2.2 s (~4 %). Conclusion: load-sensitive inflation of a serial subprocess-heavy chain under contention, not a slowdown introduced by this PR; both copies trip together on a loaded host, and smoke_health's ≥80 %-of-budget warning is the early signal. I did not change the timeout or the double selection — that is a canary-owner decision; flagging it here as requested.

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.

3 participants