Skip to content

fix(browser): pin Python backend import provenance - #6291

Merged
huangruiteng merged 1 commit into
mainfrom
codex/browser-source-provenance-20261012
Oct 12, 2026
Merged

huangruiteng merged 1 commit into
mainfrom
codex/browser-source-provenance-20261012

Conversation

@loopx-agent

Copy link
Copy Markdown
Collaborator

Goal And Delivered Outcome

The Python-backed goal-workspace-selection browser scenario launches its backend by script path, so a clean interpreter cannot import the checked-out loopx package. The baseline browser job failed with ModuleNotFoundError. Both browser backends now use the existing interpreter resolver plus one isolated import launcher: source mode selects this checkout; explicit LOOPX_PYTHON_BIN mode uses its installed package and rejects borrowing the checkout. The scenario uses runpy to retain its script arguments and fixture location.

Related #6287 installs the checkout in CI. This complementary fix makes the source launch reproducible without that installation and enforces the installed-profile boundary in the action backend. It changes no workflow, assertion, timeout, user-facing UI or production runtime rule.

Author Declaration

Written by: model_agent, OpenAI GPT-6 / OpenAI.

Specification: the reproduced import defect and the existing installed-interpreter isolation contract in examples/personal-workspace-browser/fixture.mjs, baseline 36a2f71064b74cb14db9701bf33fb834c9878f04.

Criterion Disposition Implementation / evidence
Keep selected interpreter and existing discovery precedence implemented resolveTestPython unchanged; five resolver tests pass
Clean source backend must import its checkout without installation or extra PYTHONPATH implemented testPythonCommand; bare Python 3.11 backend HTTP and packaged creation journey
Installed profile must reject missing package and checkout fallback implemented isolated Python plus origin check; missing/editable negative tests; fresh wheel journey
Preserve preview, failure recovery, confirmation and durable readback implemented original packaged scenario passes in both profiles

Scope And Continuation

Complete within the browser-launcher scope. The shared command builder is a bounded companion refactor that gives both current callers one import-provenance owner. No new capability, protocol vocabulary, provider or Python control-plane decision owner. The broader CI capacity trial in #6274 and source-install workflow repair in #6287 retain their separate acceptance; this PR supplies no organization-wide release priority or full-suite qualification.

Validation

Tested revision: aa252c1. Run state: finished. Inputs: synthetic, public_fixture.

Check kind Result Evidence / limitation
regression_parity passed Immutable prior main reproduces direct-script import failure with bare Python 3.11 and no PYTHONPATH; fixed launcher imports this checkout
integration passed pytest tests/test_browser_workspace_backend_provenance.py tests/presentation/test_chat_bundle_launcher.py: 11 passed; actual Node→Python→HTTP backend plus source/installed missing/editable/foreign-PYTHONPATH cases
real_entrypoint / real_backend passed Packaged goal-workspace-selection with bare source interpreter and independently built/installed wheel: both pass directory selection, desktop/mobile/keyboard, retained input after 503, unavailable-directory refusal, recovery, confirmation and registry/state readback. Model dispatch and status are synthetic. Data and Effect processes are isolated
unit passed node --experimental-strip-types --test tests/control_plane_ts/test_python_runtime.test.ts: 5 passed
static / build passed Chat build/verify, control-plane TypeScript check, focused Ruff/mypy, JavaScript syntax and diff checks
static passed Semantic advisory, full vocabulary/maintainability canaries, five-file public-boundary scan and exact-scope quality receipt
manual not_run Full remote Linux/Windows CI and live-model acceptance; no claim that unrelated suite failures or release scheduling are solved

The native premerge initially held a stale quality receipt after main advanced; that failure is retained. The final receipt and premerge bind the integrated head and frozen base above.

Frontend / Visual Evidence

UI impact: none. Frontend behavior is exercised through the existing packaged scene, including its unchanged error/recovery states and desktop/mobile assertions. CLI interpreter discovery is reused; Lark is unaffected.

Boundary Checklist

  • Public code and synthetic fixtures only; no private state, raw logs, credentials or local paths.
  • One bounded repair; no benchmark work or workflow changes.
  • DCO sign-off included.
  • Merge remains a maintainer decision.

Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>

@loopx-agent loopx-agent left a comment

Copy link
Copy Markdown
Collaborator 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.1-sol; OpenAI; runtime_reported; reasoning_effort=xhigh

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

动机

未发现阻塞问题。审阅精确 head aa252c1f7debe95e1dc5031dff7643289b24b792,基线 36a2f71064b74cb14db9701bf33fb834c9878f04。运行源码浏览器验收的维护者在创建 Goal 场景中遇到导入错误;该错误使验证在业务断言前中止。旧启动按脚本路径执行,裸解释器找不到 LoopX;新启动仍选原解释器,并明确从本工作树导入。打包工作区在未安装 LoopX 的 Python 3.11 下完成目录选择、预览、503 后保留输入、目录失效拒绝、恢复后确认及真实注册表和状态文件读回。本 PR 限于浏览器验证的启动来源,不改变用户界面、生产状态规则或 CI 工作流,也不宣称完整 CI、模型运行或发布优先级合格。

没有独立书面规范;依据已复现的 CI 导入故障和既有 fixture.startServer 的安装环境隔离约束判断,不把 PR 作者声明当作验收证据。

改动思路

复用现有解释器选择器并集中两个真实调用方的导入边界;单独安装源码只修 CI 环境,给后端无条件补路径会污染安装态验证。本批只交付可回读的浏览器验证启动修复;确认、状态写入、模型分派和 UI 所有权保持在既有边界。最小替代方案是只在 CI 安装源码(#6287);它仍不能证明第二个动作后端使用指定安装包。22 行的共享启动构造器有两个实际消费者,维持现有 resolveTestPython 优先级,不新增状态、协议、权限、调度器或产品配置。

具体改动

  • scripts/test-python.mjs:80 的 testPythonCommand 选择原解释器,用 -I -u -c 隔离导入。源码模式仅补本工作树;显式安装模式不补源码,并拒绝同一 checkout 的 editable 来源。test-python.d.mts 给返回命令及参数数组补类型。
  • fixture.mjs 的 startServer 复用该边界,仍分别验证 source/installed Chat 资源。goal-workspace-selection.mjs:16 用 runpy 保留脚本 __file__ 和 argv;原 readiness、预览、确认、注册表读回与终止清理保持。
  • 155 行 focused 回归覆盖裸解释器、真实 Node→Python→HTTP、缺包、editable、外部 PYTHONPATH 与合法安装导入。最小导入夹具只测试 loader;真实独立 wheel 和打包前端另行验证,不以夹具冒充安装产品验收。

精确基线/当前版本用同一打包场景、同一后端 fixture 和 Python 3.11 比较:旧安装态正向通过;注入外部 PYTHONPATH 后,旧动作后端报 foreign package imported,而当前版本通过创建及持久化读回。裸解释器的旧源码启动也真实复现 ModuleNotFoundError,当前版本已通过。丢弃的仅是动态路径/端口/PID,错误及业务断言均保留。

对主干的风险

本地测试默认导入更严格,刻意依赖外部 PYTHONPATH 或 editable checkout 的“安装态”验证会拒绝;这是已披露且有反例的预期纠正。轮子位于 site-packages 的合法安装保留,解释器显式覆盖、版本拒绝和发现顺序由原五项 resolver 测试验证。没有产品 shared-state 分类、prose denylist 或 actor authority 命名变化,也没有把约束称为可忽略指导。

集成后 11 项 Python 回归、5 项 resolver、两种真实打包创建旅程、Chat 构建、TypeScript/Ruff/mypy/语法与差异检查均通过;最终原生 canary 的 4 项直接检查、2 项目录 smoke、1 项公共边界扫描及 CQR 均通过。主干移动导致的旧 CQR 拒绝如实保留;最终凭证绑定本次冻结基线和 head。未读取/等待此 PR 的远端 CI(当前 Goal review policy),原生 Linux/Windows、live-model 与整个 CI suite 仍未验。

我的整体评价

APPROVE。这是有两个真实调用方、正向保持和错误来源反例的有界验证修复,源码创建与安装包创建都已读回,完成本 PR 的目的。本批只交付可回读的浏览器验证启动修复;确认、状态写入、模型分派和 UI 所有权保持在既有边界。后续相邻重构已采用共享导入边界;无需新增抽象或拆成多个 PR。#6287 CI 安装、#6274 容量验证和 Pages 部署仍独立推进。此作者自评记录不等于独立维护者批准或 merge 授权。

English verdict: APPROVE - aa252c1. The shared test launcher fixes clean-source backend imports and keeps the installed action backend isolated. Matched immutable-base/current packaged journeys, missing/editable/foreign-import negatives, real HTTP/registry readback and focused native validation passed; full remote CI and live-model qualification remain separate.

@huangruiteng
huangruiteng merged commit a6886c4 into main Oct 12, 2026
11 of 26 checks passed
@huangruiteng
huangruiteng deleted the codex/browser-source-provenance-20261012 branch October 12, 2026 06:49
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