Skip to content

feat(desktop,installer): switch LoopX.app default surface to Workbench and auto-install macOS App - #10254

Merged
loopx-agent merged 1 commit into
mainfrom
codex/desktop-workbench-default-and-auto-install-20261206
Dec 6, 2026
Merged

loopx-agent merged 1 commit into
mainfrom
codex/desktop-workbench-default-and-auto-install-20261206

Conversation

@loopx-agent

Copy link
Copy Markdown
Collaborator

Summary

Switches LoopX.app (apps/desktop/loopx-control-plane) to LoopX Workbench (apps/workbench) by default right now (instead of waiting until F1–F6 retirement completes) and adds automatic fingerprinted macOS LoopX.app installation to scripts/install-local.sh under the "switch first, absorb incrementally, move legacy dashboard to deprecated/ and delete progressively" strategy (aligned with Issue #9852 P0-1 / C4):

  1. LoopX.app defaults to apps/workbench (apps/desktop/loopx-control-plane/src-tauri/)
    • Introduces WorkspaceSurface::{Workbench, LegacyDashboard} in service_endpoints.rs, defaulting to Workbench (http://127.0.0.1:8796/, requiring only single-Core :8767 ServiceKind::Chat, no retired :8766 serve-status) while keeping an explicit reversible escape hatch (LOOPX_DESKTOP_SURFACE=legacy or dashboard → http://127.0.0.1:8767/chat/).
    • Starts/reuses Workbench via <loopx> --format json workbench start in services.rs, validates the loopback origin of access_url, and hands the authenticated launch URL to WorkspaceHandoff::services_ready_at(...) (in memory only; never persisted to workspace-location.json or logs) so the Tauri WebView opens directly into authenticated Workbench (index.html ingests #token=... into localStorage and scrubs the URL).
    • Updates maintenance.rs::resume_runtime so thin local macOS LoopX.app bundles built by install-local.sh (without a 95MB embedded runtime-source.tar.gz) cleanly reuse the verified locally installed loopx CLI, while preserving all signed-release bundled-runtime guarantees.
    • Updates tauri.conf.json CSP to include http://127.0.0.1:8796 ws://127.0.0.1:8796.
  2. Dual-registry resilience for loopx workbench start (loopx/cli_commands/workbench.py)
    • Avoids crashing with an unhandled ValueError when a machine has both default global registries (~/.loopx and legacy ~/.codex/loopx) and workbench start is invoked without --runtime-root/--registry, letting workbench.ts reuse any configured LOOCHAT_LOOPX_REGISTRY in STATE/.env (while keeping explicit --registry @host-global strict).
  3. Automatic macOS LoopX.app installation in scripts/install-local.sh (scripts/desktop_app_install.py)
    • Adds scripts/desktop_app_install.py with SHA-256 source-fingerprint caching (Contents/Resources/.loopx-desktop-app-build.json), persistent CARGO_TARGET_DIR incremental builds, macOS LoopX.icns generation from the orbital infinity icons, ad-hoc signing, and atomic backup-and-swap into /Applications/LoopX.app (or ~/Applications/LoopX.app if /Applications is not writable).
    • Integrates LOOPX_INSTALL_DESKTOP_APP=auto|1|0 and LOOPX_DESKTOP_APP_DIR into scripts/install-local.sh: auto installs/updates LoopX.app automatically on real macOS local installs (bin_dir == $HOME/.local/bin and cargo present) while safely skipping isolated temp-dir smokes and non-macOS hosts unless LOOPX_INSTALL_DESKTOP_APP=1 is requested.
  4. Bilingual roadmap alignment (docs/architecture/rfcs/loopx-overall-roadmap-v0*.md, docs/product/roadmaps/digital-worker-workbench-feishu-paths*.md)
    • Records the accelerated LoopX.app -> apps/workbench cutover + install-local.sh auto-install and the "switch first, absorb capabilities incrementally, deprecate and progressively delete apps/presentation/dashboard" execution policy across both English and Chinese documents.

Verification

  • Rust desktop crate unit tests (TAURI_CONFIG='{"bundle":{"resources":[]}}' cargo test --lib -- --test-threads=4): 212 passed; 0 failed (including new tests for WorkspaceSurface default/legacy/invalid parsing, 3-port isolated allocation, parse_workbench_launch_url loopback validation, and WorkspaceHandoff::services_ready_at same-origin enforcement).
  • Real macOS release bundle build (python3 scripts/desktop_app_install.py apps/desktop/loopx-control-plane --app-dir <tmp> --json): built 17.3 MB release binary + 528 KB LoopX.icns + Info.plist + .loopx-desktop-app-build.json (default_surface: "workbench") + _CodeSignature; incremental rebuild took 12.47s, and unchanged-source reuse is verified in unit tests.
  • Python unit tests (uv run --extra test python -m pytest -q tests/test_desktop_app_install.py tests/test_workbench_cli.py -k "not packaged_cli"): 11 passed, 9 skipped.
  • Lint & bilingual RFC gate: ruff check clean; scripts/check_rfc_bilingual.py --base origin/main --head HEAD passed.
  • Public boundary scan (loopx check --scan-path ... on all 17 changed files): ok: True, errors=0.
  • Pre-merge validation gate (loopx canary premerge --from-git-diff --git-diff-base origin/main): ok: true, merge_gate_passed: true, 10/10 catalog canaries passed.
  • Bounded future-facing refactoring: applied cleanly within the same domain (ServiceEndpoints::required_services() decouples Workbench single-Core :8767 startup from legacy :8766 without duplicating service supervisor logic; scripts/desktop_app_install.py mirrors scripts/workbench_bundle.py's fingerprinted receipt pattern).

…h and auto-install macOS App

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.

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

动机

此前 apps/workbench 已完成单 Core 迁移与大部分治理能力收口,但 LoopX.app(apps/desktop/loopx-control-plane)仍硬编码打开旧版 http://127.0.0.1:8767/chat/(apps/presentation/dashboard),且 scripts/install-local.sh 安装完 CLI 后不会自动安装或更新 macOS 桌面端 LoopX.app,导致用户在「应用程序」中看不到 Workbench 桌面入口。按照「先切默认 App 到 Workbench、安装 LoopX 时自动装 App,再逐步分析融合剩余能力并将旧 dashboard 迁入 deprecated/ 渐进删文件」的明确方向,需要立刻完成桌面壳切主、安装器自动化与双语路线图同步。

改动思路

本 PR 按四层边界完成最小、可回退、端到端可验证的切主闭环:

  1. 在 apps/desktop/loopx-control-plane/src-tauri/ 引入显式类型化的 WorkspaceSurface::{Workbench, LegacyDashboard}(默认 Workbench,通过 LOOPX_DESKTOP_SURFACE=legacy|dashboard 保留可逆应急回退);Workbench 模式仅依赖单一 Core :8767(不再要求已退役的 :8766 serve-status),启动后调用 loopx --format json workbench start 获取经回环校验的认证访问 URL,通过 WorkspaceHandoff::services_ready_at(...) 在内存中直达已认证 Workbench(绝不落盘或打印凭证)。
  2. 在 maintenance.rs::resume_runtime 允许由 install-local.sh 构建的轻量本地 LoopX.app(不含 95MB runtime-source.tar.gz)安全复用本机已验证的 ~/.local/bin/loopx CLI,同时完整保留签名发行版内置运行时的所有校验与恢复逻辑。
  3. 在 loopx/cli_commands/workbench.py 优雅处理双全局注册表冲突(未显式传 --runtime-root/--registry 时降级为 defaultRegistry: None,交由 workbench.ts 读取 STATE/.env 中的 LOOCHAT_LOOPX_REGISTRY),避免 LoopX.app 或用户直接执行 loopx workbench start 抛出未捕获的 ValueError。
  4. 新增 scripts/desktop_app_install.py 并接入 scripts/install-local.sh(LOOPX_INSTALL_DESKTOP_APP=auto|1|0、LOOPX_DESKTOP_APP_DIR),基于源码 SHA-256 指纹缓存与持久化 CARGO_TARGET_DIR 自动构建/复用并原子替换 /Applications/LoopX.app,同时对临时 HOME / CI / 冒烟隔离环境自动跳过,不破坏现有安装器冒烟。

具体改动

  • Tauri 桌面壳切主至 Workbench:修改 service_endpoints.rs、services.rs、workspace_handoff.rs、lib.rs、maintenance.rs、tauri.conf.json,新增 WorkspaceSurface、required_services()、start_workbench()、parse_workbench_launch_url()、services_ready_at(),并更新 services_tests.rs 与 services_real_runtime_tests.rs 补齐默认/回退/非法配置/回环起源校验单测(212 passed; 0 failed)。
  • Workbench CLI 双注册表容错:修改 loopx/cli_commands/workbench.py 并在 tests/test_workbench_cli.py 新增双注册表冲突容错单测。
  • macOS LoopX.app 自动安装与指纹复用:新增 scripts/desktop_app_install.py(SHA-256 指纹回执 .loopx-desktop-app-build.json、sips + iconutil 生成 LoopX.icns、ad-hoc codesign 与备份原子替换)与 tests/test_desktop_app_install.py,并接入 scripts/install-local.sh(实测产出 17.3 MB release 二进制与 528 KB 图标,增量重建 12.47s,无源码变化秒级复用;claude-install-optin-smoke.py 与 codex-cli-packaged-install-smoke.py 全绿通过)。
  • 双语路线图同步:成对更新 docs/architecture/rfcs/loopx-overall-roadmap-v0.md + .zh-CN.md 与 docs/product/roadmaps/digital-worker-workbench-feishu-paths.md + .zh-CN.md,记录桌面切主前置与后续旧 dashboard 移入 deprecated/ 渐进删减路径(check_rfc_bilingual.py 通过)。

对主干的风险

  • 旧版 Dashboard 可随时无损回退:保留 LOOPX_DESKTOP_SURFACE=legacy 显式开关与全部既有 /chat/ 代码路径,未删除任何 apps/presentation/dashboard 文件,遇未迁完能力可零成本回退。
  • 安装器与冒烟边界安全隔离:scripts/install-local.sh 在 auto 模式下仅对真实 macOS 家目录(排除 /tmp/、/var/folders/、$CI、$PYTEST_CURRENT_TEST 及非默认 bin_dir)自动装 App,resolve_app_dir 在临时 HOME 下绝不写入 /Applications,且已通过 claude-install-optin-smoke.py 与 codex-cli-packaged-install-smoke.py 实测验证。
  • 签名发行版与安全边界保持不变:仅当 runtime_bundle_missing 且本机 CLI 已通过身份校验时才复用本地 CLI,签名发行版仍强制走原内置快照校验;access_url 校验严格限定 http://127.0.0.1:<port> 且绝不写入 workspace-location.json;全部 17 个改动文件通过 loopx check(errors=0)。

我的整体评价

这是一笔方向清晰、边界克制且工程完成度很高的桌面端切主交付:既把 LoopX.app 的默认体验立刻统一到 apps/workbench 并通过 install-local.sh 实现了带指纹复用的 macOS 自动安装,又通过 LOOPX_DESKTOP_SURFACE=legacy、回环 URL 校验与临时目录安全护栏守住了回退与安全底线。Rust 212 项单测、真实 release .app 构建、Python 单测、双语 RFC 门禁及打包安装冒烟全部通过,建议合入主干。

English verdict: APPROVE on ff71aa7.

@loopx-agent
loopx-agent merged commit e202b8a into main Dec 6, 2026
39 of 40 checks passed
@loopx-agent
loopx-agent deleted the codex/desktop-workbench-default-and-auto-install-20261206 branch December 6, 2026 10:04
songoow pushed a commit that referenced this pull request Dec 6, 2026
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.

1 participant