Skip to content

fix(launcher): accept CRLF Python runtime records - #7796

Merged
loopx-agent merged 1 commit into
mainfrom
codex/python-runtime-record-crlf-20261101
Nov 1, 2026
Merged

loopx-agent merged 1 commit into
mainfrom
codex/python-runtime-record-crlf-20261101

Conversation

@BigDataDZ

Copy link
Copy Markdown
Contributor

Goal And Delivered Outcome

  • Outcome basis / optional anchor: reproducible source-launcher interpreter selection defect; no new roadmap acceptance is claimed.
  • Goal/source and gap: a CRLF-terminated .loopx-python record is read with its trailing carriage return intact. A working recorded interpreter is rejected and a different project/PATH interpreter can silently win.
  • Observable before → after: the six-case native subprocess suite has one CRLF selection failure on the unchanged base and passes all six after normalization. LF and unterminated records, stale-record fallback, explicit precedence and explicit-error stopping remain covered.
  • Issue/task and intended base: self-contained bug report and repair; main at ec91c4dbbb9aecf0abd0395455fc52466506f2b2.

Author Declaration

  • Written by: model_agent — OpenAI Codex, under the contributor's direction.

Implemented against

  • Specification and revision: existing selection order and explicit-override stop behavior in scripts/loopx-python.sh at the base above; this PR's request is the basis for line-ending compatibility.
Criterion Disposition Symbol / path Test or command
A CRLF record names the same interpreter as LF implemented select_loopx_python record reader python_record_line_endings.test.ts
Preserve selection precedence and invalid explicit override refusal implemented existing selector branches, unchanged same six-case suite
Execute the selected real interpreter, including a path containing spaces implemented existing --exec entrypoint suite invokes real Python through tagged wrappers
  • Self-check before submission: reviewed all selector callers and the Windows installer's record writer; removed only one terminal CR from recorded input. Explicit environment values and general whitespace are not trimmed. The tests use real Bash and Python processes, with synthetic interpreter wrappers and temporary records.

Scope And Continuation

  • Completed scope and remaining work: complete within the shared shell selector. No runtime version policy, capability, scheduler or Goal state changes. The historical old-snapshot fallback in scripts/loopx is outside this helper's contract.
  • Slice boundary / successor: N/A. This fixes input decoding at the existing owning boundary and can be reverted independently.
  • Bounded refactoring pass: no extraction needed; normalization belongs immediately after the existing read, with no duplicate selection owner.

Validation

  • Tested revision: the commit on this PR.
  • Run state: finished
  • Input classes: synthetic
Check kind Result Public-safe evidence / limitation
regression_parity passed Same six cases: base 5 passed / 1 failed (CRLF selects fallback); repaired selector 6 passed.
real_entrypoint passed Native Windows Git Bash and Python 3.12: the selector's --exec runs the recorded real interpreter; stale and explicit-error cases retain their behavior.
unit passed New suite plus existing test_python_runtime.test.ts: 9 passed, 2 existing POSIX-only cases skipped.
static passed Strict targeted TypeScript compilation, bash -n, diff whitespace check and RFC bilingual check. Advisory found no supported changed product vocabulary; the test tuples are local inputs, not a shared contract.
integration not_run No native Linux/macOS execution or full repository test run on this Windows host. Hosted checks remain required.
  • Coverage and gaps: this qualifies record reading and real interpreter handoff. It does not claim a packaged App/dashboard launch or a platform-wide installation qualification. No model calls, benchmark jobs or active Goal writes.

Frontend / Visual Evidence

  • UI impact: none. Existing CLI/source-launcher behavior only; no frontend or Lark operation added.

Type of Change

  • Bug fix
  • Test update

LoopX Area

  • Build, packaging, installer, or CI

Technical Direction

  • Direction / acceptance reference: existing interpreter-selection owner; no new capability/provider or parallel decision owner.

Shared-authority RFC fixture impact

N/A: no authority schema, provider routing or projection change.

Boundary Checklist

  • No private state, credentials, raw logs, internal links or local machine paths in the diff or PR body.
  • No duplication of maintainer-owned benchmark work.
  • One source-record decoding defect, focused tests.
  • No paired RFC changed; bilingual diff check passes.
  • UI impact is none.
  • DCO sign-off on every commit.

Signed-off-by: BigDataDZ <76271875+BigDataDZ@users.noreply.github.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; model=gpt-6.1-sol; provider=OpenAI; runtime_reported; reasoning_effort=max

动机 / Motivation

通过 Bash 启动 LoopX、且安装器记录使用 CRLF 换行的用户。此前安装器写出的 CRLF 格式 Python 记录会把行尾回车带进路径,使有效解释器被忽略并回退到另一个环境;现在会使用原来记录的解释器。已验证 CRLF 记录能选中原解释器并执行产生结果的 Python 程序,同时保留显式配置、空格路径和失败恢复行为。范围是共享 Bash 选择器对记录行尾的读取;未修改解释器发现顺序、显式配置语义或安装发布流程。

改动思路 / Approach

换行属于安装记录的输入格式,应在现有读取分支归一化,避免对显式路径或所有空白做宽泛清理。本 PR 仅移除记录末尾一个 CR,保留既有解释器优先级、失效记录回退和显式配置失败停止。反对提交的最强理由是输入归一化可能改变合法文件名;因此只去掉记录格式的一个回车,并验证空格及显式 CR 路径,不引入通用 trim。不修改时可以稳定复现旧缺陷;另建解析器或配置开关只会增加需要同步的规则。

正向路径是安装器记录 → 记录分支解码 → 实际解释器版本验证 → 原参数 exec → 结果回读。失败路径仍由已有启动器负责,显式无效配置停止,失效记录允许回退,修正记录后的下一次调用恢复原环境。本次没有增加人工确认轮次、手动复制已知配置或后台同步状态。

具体改动 / Changes

评审基于完整 base-to-head 差异,head 为 e472ecc3d22ae16ae23be6ceef8ef10ae44f5f06,基线为 ec91c4dbbb9aecf0abd0395455fc52466506f2b2。共 2 个文件,+64/-0:生产脚本仅增加 2 行,其余 62 行为回归测试。

已接受规格:docs/development/frontend-delivery.md,固定 revision ec91c4dbbb9aecf0abd0395455fc52466506f2b2(原文)。验收映射:python-selection-precedence:implemented,LOOPX_PYTHON, then the installer-recorded .loopx-python, the repository .venv;python-minimum:implemented,Python 3.11+ interpreter。现有 Windows 写入方见 loopx/windows_install.py:503;CRLF 原因来自文件换行转换,格式修复的依据还包括未变的解释器选择合同,并非用新增测试充当规格。

关键代码讲解

  1. select_loopx_python 只在读取 .loopx-python 的分支删除末尾一个 CR;显式 LOOPX_PYTHON 分支保持原始值和优先级。它不清理全部空白,所以真实路径中的尾随空格仍保留。

  2. python_version_ok 继续运行所选解释器检查 Python 3.11+,而非只凭文件名或可执行位接受。记录失效仍由现有分支诊断并回退;显式配置失效则停止,不能借有效记录悄悄换环境。

  3. --exec 入口 保留原参数交接和失败退出。独立验证通过真实 Python 写入并回读结果文件,区分了“记录的解释器执行成功”和“另一个环境碰巧执行成功”;另行通过现有 scripts/loopx --version 验证主启动器可用。

检查 结果
新记录测试 + 现有 Python 发现测试 11 PASS,0 SKIP
同一独立 Bash/Python 入口验证 基线 6/10 → 当前提交 10/10 PASS
严格单文件类型 + 仓库类型项目、Bash 语法 PASS
标准 premerge 4 项直接检查 PASS;语义检查 PASS,既有结构债务保持红色

对主干的风险 / Risks

未发现阻塞问题。

最强反例是测试只看退出成功,而实际已回退到错误的解释器。独立验证给真实执行包装器设置不同标识,并让 Python 写入值为 42 的结果文件后回读:覆盖 CRLF、无末尾换行、尾随空格路径、路径本身带 CR、另一个 CWD 的记录、显式无效配置、失效记录及修正后的再次调用。当前提交 10 项全部通过;基线 4 项与 CRLF 身份有关的断言失败,其余行为保留。

验证平台为 macOS、Bash、Python 3.12.15 与 Node 24.21;输入包含 Windows 风格 CRLF,并检查了现有 Windows 写入方,但没有把它表述为原生 Windows 安装验收。共享选择器对 scripts/loopx 与 Dashboard 的调用有效;旧快照在缺少 companion helper 时的兼容回退、JS 构建器的平台适配都未改动。相关 #7798 修改后面的等 minor PATH 发现分支,和本次记录分支不同;本轮只核对其相关范围,未追加第三项完整评审。

run_host_process 结构检查仍红:独立同命令基线/当前提交的完整失败文本、扫描输入及环境摘要一致,保留为既有未变债务。初次 TypeScript 调用缺少项目/Node types 的诊断也保留;明确仓库项目与 --types node 后通过,源码与断言未变。本轮没有抓取、轮询或等待 CI。

语义与 CI 对齐

这是既有记录格式的兼容修复,不是默认关闭功能。显式配置仍有最高优先级和失败停止语义;没有新增权限、持久状态或通用文本分类规则。差异级词汇 advisory 没有检测到支持范围内的新产品载体,完整语义检查通过,其分析范围不等于所有动态语义。

我的整体评价 / Verdict

goal_achieved 只指本 PR 的启动缺陷修复。长程工作连续性判断为 preserved:既有启动、失败停止与修正后重试路径保留,没有引入调度饥饿、重复工作或新的状态维护成本;未声称测得长程收益。用户体验判断为 improved:同一启动意图沿用已有运行时配置,减少迟发错误或静默换环境,普通路径不增加确认轮次。

已检查 scripts/loopx-python.sh 及现有调用者;没有渲染页面或布局改动,因此视觉评审不适用。未运行安装后的 App 视觉验收;本次没有渲染改动。换行属于安装记录的输入格式,应在现有读取分支归一化,避免对显式路径或所有空白做宽泛清理。本 PR 仅移除记录末尾一个 CR,保留既有解释器优先级、失效记录回退和显式配置失败停止。范围和成本相称,局部解码并保留格式兼容是已完成的简化;无证据要求在本 PR 再引入抽象或扩大迁移。已有红色诊断和跨平台/安装后的未测范围继续保留,评审通过不代表合并、安装或发布授权。

English verdict: APPROVE at e472ecc3d22ae16ae23be6ceef8ef10ae44f5f06. The bounded startup repair is independently validated; residual platform/build diagnostics remain disclosed.

@loopx-agent
loopx-agent merged commit a0c3ea2 into main Nov 1, 2026
29 of 35 checks passed
@loopx-agent
loopx-agent deleted the codex/python-runtime-record-crlf-20261101 branch November 1, 2026 10:17
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