Skip to content

Find Node installed in the Python tool environment - #10073

Merged
cocolord merged 4 commits into
loopx-project:mainfrom
cocolord:codex/find-node-in-python-tool-environment-20261204-YJh0LD
Dec 4, 2026
Merged

cocolord merged 4 commits into
loopx-project:mainfrom
cocolord:codex/find-node-in-python-tool-environment-20261204-YJh0LD

Conversation

@cocolord

@cocolord cocolord commented Dec 3, 2026 •

Copy link
Copy Markdown
Member

Goal And Delivered Outcome

A Core command exported by pipx or uv tool install can use a private Python interpreter whose scripts directory is absent from PATH. On the baseline, the exported command returns node_unavailable even with an executable Node installed beside the private interpreter.

Core now checks that interpreter's scripts directory when its existing Node lookup on PATH finds nothing. Effect startup, deep readiness and the receipt-bound scheduler follow-up share the locator. A Node found on PATH retains precedence, including the existing version refusal for an unsupported executable.

Author Declaration

Criterion Disposition Evidence
Discover a Node executable in the selected Python environment implemented resolve_node_executable and installed Core comparisons
Select an official runtime distribution, release pin, and platform matrix deferred D1 remains with kernel maintainers

Self-check covered the actual installed entrypoints, the scheduler's shared resolver, and the missing and unsupported Node diagnostics.

Scope And Continuation

The repair is limited to executable discovery and its diagnostics. The package inputs in the experiment used a local runtime dependency fixture and a platform wheel fixture that placed the same pinned executable in the interpreter's scripts directory. D1 and M3 still require the release layout and same-release acceptance.

Validation

  • Tested revision: d37c9b4e15ce4e37e162159271475acd5aa39322
  • Run state: finished
  • Input classes: synthetic, public_fixture
Check kind Result Public-safe evidence
real_entrypoint passed Built Core wheels on macOS arm64 with Python 3.13.5, installed with pip, pipx, and uv, and invoked the installed loopx entrypoints with pinned Node 22.22.3.
real_backend passed Each expected success created an isolated SQLite Goal through loopx connect and read it back through loopx status. Missing, unsupported, and uninstalled Node returned node_unavailable before registry creation.
regression_parity passed 13 paired installation cases. Four launch modes changed from refusal to successful creation and readback with no Node on PATH. The other nine observations matched, including external PATH precedence.
unit passed 76 focused tests covering probe behavior, receipt-bound scheduler entry, startup diagnostics, and cold import boundaries.
static passed Ruff, DCO, diff checks, and standard premerge with 6 direct checks and 16 selected checks.
real_entrypoint passed Debian 12 arm64 in a disposable VZ VM, Python 3.11.2 and Node 22.22.3. Across 14 offline paired cases, the four installed entrypoints recovered SQLite creation and readback with no Node on the caller PATH. The other ten observations matched, including PATH precedence and refusal when Node is missing or unsupported.
real_entrypoint passed Native Windows x64 installed comparison on the same source revisions and the official Node 22.22.3 payload.

Frontend / Visual Evidence

  • UI impact: none

Type of Change

  • Bug fix
  • Test update

LoopX Area

  • Control plane
  • Host or runtime integration

Boundary Checklist

  • Public-safe diff and evidence summary.
  • DCO sign-off and bilingual diff gate passed.

Native Windows installed comparison

Windows x64 and Python 3.11.9 on the exact baseline and candidate recorded above. The native run passed all 14 paired cases. With Node absent from the caller PATH, the candidate's pipx launcher, uv tool launcher, ordinary venv launcher and platform-wheel launcher completed SQLite connect and readback. The other ten controls had matching outcomes, including PATH precedence, an older external Node, companion removal and uv tool run. The trial produced an 8.15 MB bare Core wheel, a 33.20 MB Node companion wheel and a 41.35 MB bundled Core wheel. Windows run

Review follow-up

Revision e536bdcd54 against main@5d7ac0e622. Synced the existing Node discovery fix with current main. All 52 focused Node discovery, startup, entrypoint and Turn capture tests passed, including the Python scripts-directory fallback and missing-Node paths. Scoped Ruff passed. This update leaves the proposal behavior unchanged.

Review follow-up

Revision 1da4112a1a against main@0e784d7cba. The proposal diff is byte-for-byte unchanged against current main. A freshly built Core wheel from this revision used Node v26.0.0 in the Python scripts directory with Node absent from the caller PATH, created a synthetic SQLite Goal, and read it back through the installed CLI. Separate cold runtime scopes verified refusal before registry creation when Node was missing or when an unsupported launcher was first on PATH. The focused source suite passed 39 cases, along with Ruff and quick premerge.

Review follow-up

Revision 126c7ea479 against main@f8f19b11ed. The same five-file patch is reconciled with main including #10069. A freshly installed standalone Core used Node from its Python tool environment with Node absent from PATH. SQLite setup and status readback passed. With no Node, it refused before registry creation; an older Node on PATH kept precedence and was correctly rejected. The 35 focused source cases, dependency check, Ruff, and quick premerge passed.

Signed-off-by: lusendong.6789 <lusendong.6789@bytedance.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

动机 / Motivation

通过 pipx 或 uv 的私有 Python 环境调用已导出的 Core CLI 时,其他已安装脚本可能未进入 PATH。 基线只能从 PATH 查 Node。候选沿用 PATH 第一优先级,在没有命中时查当前解释器的 scripts 目录。

候选在相同的隔离 wheel 用例中创建 SQLite Goal 并用 status 读回。另三种路径的准入结果与基线一致。

本轮独评覆盖 macOS 的隔离 Core wheel 与 SQLite。D1 的发布形态及真实 Windows 执行留在原验收范围。

审读提交 d37c9b4,冻结基线 ca020c4。

改动思路 / Approach

五文件,新增 66 行、删除 16 行。生产变更只有共享探测和既有 scheduler 入口。 共享 Node locator 给 Effect 启动探测、deep readiness 与已绑定的 scheduler follow-up 提供选择。现有版本检查和执行准入仍由原 owner 处理。

具体改动 / Changes

  • PRIVATE。隔离安装能用私有 scripts 的真实 Node 创建和读回 Goal。 独立验证通过。 node_probe.py
  • PRECEDENCE。外部优先、缺失和版本拒绝保留。 独立验证通过。 entrypoint.py

冻结的接口契约 · 原有权威检查

关键代码讲解

对主干的风险 / Risks

四种安装输入在基线和候选各跑一次。候选的 201 项定向测试与 quick premerge 九项检查通过。正例使用真实 Node,PATH 旧版控制使用只返回版本的本地脚本。

安装入口出现的新成功只有私有 scripts 这一项;正常外部 PATH、外部旧版本和完全缺失行为保持一致。

未改变 Node 的发布形态。候选 wheel 中入口与探测模块字节均与精确提交一致。

我的整体评价 / Verdict

通过。 同一隔离 wheel 对照中,私有 Node 能被定位并通过真实 SQLite 创建和读回。

外部 PATH 的优先级和版本拒绝经配对复验。原生 Windows 安装沿用既有资格,未在本轮重跑。

English verdict: APPROVE at d37c9b4. The exported Core CLI now finds Node installed in its own Python environment. Paired standalone wheels verified SQLite readback, PATH precedence and failure before writes.

…0073-queue-current

Signed-off-by: lusendong.6789 <lusendong.6789@bytedance.com>
@cocolord
cocolord requested a review from maxliux5 as a code owner December 4, 2026 07:42
@cocolord
cocolord requested a review from loopx-agent December 4, 2026 07:42
…concile-10073-node-scripts-current-main-20261204

Signed-off-by: lusendong.6789 <lusendong.6789@bytedance.com>
…concile-10073-node-tool-environment-after-10069-20261204

Signed-off-by: lusendong.6789 <lusendong.6789@bytedance.com>

@cocolord cocolord left a comment

Copy link
Copy Markdown
Member Author

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 · OpenAI · self_reported

Approval conclusion (author-owned PR; GitHub blocks formal self-approval)

动机 / Motivation

从独立 Python 工具环境启动 Core 的用户会遇到这个问题,例如工具只把 LoopX 命令导出到 PATH。同一个工具环境里已经有 Node 时,旧版 Core 在 PATH 找不到 Node 就拒绝初始化 SQLite 注册表。新版能用当前 Python 的脚本目录找到它,完成初始化并读取状态。用主干和当前提交对应的 Core 安装包复验,旧版拒绝时未创建注册表,新版能创建 SQLite 注册表并读回状态。这条改动复用已安装的 Node,打包分发 Node 和原生 Windows 验收仍属于各自的范围。

改动思路 / Approach

把查找 Node 的顺序集中到现有运行时探测模块,让普通启动和原生调度入口共享同一规则。这一改动只选择本机已经安装的可执行文件,版本探测和调度授权仍由原来的代码处理。 PATH 中的 Node 优先使用,包括版本过旧的情况,仍交给原探测逻辑报错。只有 PATH 查找失败时,才检查当前解释器的 scripts 目录。复用 Python 的安装布局让命令适用于导出的工具环境,也避免在其他解释器或系统目录里猜测可执行文件位置。

具体改动 / Changes

依据 f8f19b1 的 docs/architecture/rfcs/monorepo-distribution-split-v0.md 检查。V1 在所测试的 Core 路径上使用当前环境已安装的依赖。D1 涉及 Node 本身的分发,这条只访问已经安装的版本,整个发布组合仍由分包工作验证。

关键代码讲解

  • resolve_node_executable 先查 PATH,再按当前解释器的 scripts 路径检查可执行文件。Windows 候选名是 node.exe;候选为目录时拒绝。
  • probe_node 使用同一定位函数,沿用最低版本和带超时的版本探测。缺失诊断能解释两个位置,故障引导针对实际选中的启动器。
  • _native_scheduler_followup_argv 在验证已有调度入口、宿主事实和 Turn ID 后才选择 Node。宿主的保护条件及随后的参数序列保持一致。五个文件增加 66 行、删除 16 行,覆盖了定位、诊断和生成命令三个使用点。

对主干的风险 / Risks

最需要保证的是 PATH 优先级和写入前检查。把一个旧 Node 放在 PATH 上时,它仍先被选中并拒绝,两个位置都没有 Node 时也仍在建立注册表前退出。成对的实装 Core 测试验证了缺少 PATH Node 时的新旧行为,当前 wheel 还验证了 SQLite 状态读回。原生调度用的是已安装入口的参数选择测试,检查缺少绑定参数时不选择原生入口,无生产调度写入。521 项源代码回归及 quick premerge 通过。Windows 的脚本命名由测试覆盖,真实安装的成对复验在 macOS 完成。

我的整体评价 / Verdict

这项改动让已有私有 Node 的导出工具可以直接继续初始化和读取状态,减少反复激活环境的操作。PATH 已能解析 Node 时,用户仍沿用同样的命令、版本门槛和检查。检查范围是 Core 的命令行、诊断和调度入口,没有渲染界面改动。 变化只涉及本机依赖发现,现有错误码和调度授权范围继续复用,实装对照和负例足以支持批准。

English verdict: APPROVE 126c7ea. Paired installed Core checks show private Node enables SQLite initialization and status readback without PATH activation. PATH precedence, missing-Node rejection and receipt-bound native argument selection are preserved. All 521 source tests passed.

@cocolord
cocolord merged commit e62edb4 into loopx-project:main Dec 4, 2026
27 checks passed
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