Repository navigation
feat(oar): deep OAR fusion — persistent TS session host, host/chat/worker migrations, 16 runtimes, SQLite WAL & Workbench UI (Phase 0–4) - #9854
Conversation
…verse/oar@0.142.0 Signed-off-by: song <xinxinsong66@gmail.com>
…ne MCP, and Python Keep-Alive client Signed-off-by: song <xinxinsong66@gmail.com>
9f40214 to
a66f98d
Compare
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a66f98d232
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…docs and checks Signed-off-by: song <xinxinsong66@gmail.com>
…and doctor readiness Signed-off-by: song <xinxinsong66@gmail.com>
Signed-off-by: song <xinxinsong66@gmail.com>
…ost.version Signed-off-by: song <xinxinsong66@gmail.com>
…dex exec Signed-off-by: song <xinxinsong66@gmail.com>
…ting Signed-off-by: song <xinxinsong66@gmail.com>
…olated shell Signed-off-by: song <xinxinsong66@gmail.com>
…l_worker Signed-off-by: song <xinxinsong66@gmail.com>
|
This pull request has merge conflicts with Choose the remote for the base repository, not an out-of-date fork. 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 HEADFor a same-repository clone whose Keep the DCO |
loopx-agent
left a comment
There was a problem hiding this comment.
Reviewer: model_agent · gpt-6.2-sol · OpenAI · runtime_reported · xhigh
动机 / Motivation
评审提交 1541c290edef4733666bb15da4f80491be1e8bea,提案比较基线 0950cea53f8eedfd7e56a397a447eecfc87bcc50,核对主干 f2a9c7ecd62fe02dc2bff282aa1116cd8ed34054。升级 Core 且由 macOS Desktop 启动、PATH 依赖 nvm 自动发现的现有使用者,以及后续 OAR Host 接入方。 默认 Core 接受 Node 22.22.3。Desktop 用相同最低版本给 Finder 启动时的 nvm 候选排序。提案希望用一个根 lockfile 和常驻 TypeScript OAR host 支撑后续迁移。 按 Phase 0/1 审查。Phase 2 的真实 Agent 路由迁移和随后通用接入不列为此头已经交付的功能。
现头把 Core、shell/PowerShell、CI 和英语及中文入口文档的 Node 下限移至 24.21.0,并加上独立的 OAR 客户端、会话宿主与控制平面桥。
改动思路 / Approach
根锁文件和懒加载有明确的启动成本目标。Core 探针持有最终版本资格,Desktop 持有发现和排序,必须能把合格 Node 送到 Core。 45 个文件含根锁文件和 CI,另增常驻宿主、runtime loader、session policy、MCP bridge、客户端和夹具。版本变化由默认启动共享。 Core node_probe/node_version 判定可运行版本,Desktop discovered_nvm_directories 决定候选顺序,OAR session host 仅处理显式客户端调用。
具体改动 / Changes
- 根包安装 @botiverse/oar 0.142.0。最新头已把 CI 所用最低版本更新至 24.21.0,PR 描述中的旧版本和待补 workflow 文字落后于当前头。
- TS 常驻服务收拢运行时加载、会话、MCP 桥与记录,Python 源检出测试走真实 Node RPC。环境变量选择与现用 Agent 路由的整合留在后续阶段。
- Core 和大部分启动表面使用新门槛。Desktop 的 nvm fallback 仍以旧常量决定优先级,且公开 Desktop/Core 指南仍有旧版本。保留已有 OAR 线程作为实施证据,当前评审聚焦新发现的跨入口回归。
对主干的风险 / Risks
Desktop 原有的 nvm 排序仍用 22.22.3 作为合格线。只靠 nvm 的 Finder 启动环境里,默认别名仍指向 22.22.3 时,App 会把它放在已安装的 24.21.0 前面。同一排序在基线返回 ready,现头的 Core 返回 unsupported。把 24.21.0 放第一位后现头恢复 ready。此差异发生在未选择 OAR 的原有入口。 使用精确 Rust 排序函数和精确 Python 探针,nvm Node 用只实现 --version 的 fixture,未启动完整 Finder UI。真实 OAR 测试限源检出以及脚本化运行时。未向外部 Agent 服务发请求。PyPI wheel 试构建遇到本地 Chat bundle 缺失,安装态 OAR 未获独立验证。
语义与 CI 对齐
Core 明确拒绝不满足新版本下限的 Node,Desktop 需要使用同一资格标准排序。 将 App 的 nvm 排序、Core 最低版本、安装诊断与支持文档同步,并用默认 22.22.3、同时存在 24.21.0 的 Finder 等价 PATH 夹具覆盖启动及恢复。可将完整 Node 迁移作为单独边界先验证,再接入 OAR。
我的整体评价 / Verdict
请求修改。持久宿主基线和懒加载测试有价值。默认安装端发现仍破坏已有使用路径,且当前主干组合存在一处 tests/test_pi_goal_mode.py 冲突。先完成发布范围内的版本迁移。 将 App 的 nvm 排序、Core 最低版本、安装诊断与支持文档同步,并用默认 22.22.3、同时存在 24.21.0 的 Finder 等价 PATH 夹具覆盖启动及恢复。可将完整 Node 迁移作为单独边界先验证,再接入 OAR。 21 个 TS 用例和控制平面类型检查通过。真实源检出 Python 客户端可启动 Node 宿主,多次 health 读同一 PID,且有拒绝未知 runtime 和 shutdown 的回归。 本地 Node 24.21.0,21 个 TS 用例、控制平面类型检查、93 个 Python 入口与探针用例及 3 个真实 OAR 客户端测试通过。Git 精确组合确认一处测试冲突。已按独立新证据保留现头既有线程,未等待 CI。
English verdict: REQUEST_CHANGES at 1541c29. Raising the shared Node floor without updating native Desktop discovery leaves a supported installed Node hidden behind an older nvm default. The paired App-order and Core-probe check reproduces the default-path regression with OAR off.
Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
* fix(turn): retain the selected operation transport across OAR resume Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com> * Close managed OAR sessions when initialization loses its binding (#9984) Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com> --------- Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
* Resume ordinary DSH turns with the native OAR session identity Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com> * Confirm the selected DSH binding before OAR dispatch Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com> --------- Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
* fix(turn): retain the selected operation transport across OAR resume Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com> * Defer DSH operation runtime qualification to OAR session open Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com> * Apply the operation host token bound in planning and CLI inspection Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com> * Refuse bounded OAR DSH operations before model input Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com> * Keep confirmed operations resumable when their executor is unavailable Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com> --------- Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
…#9974) * fix(turn): retain the selected operation transport across OAR resume Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com> * Defer DSH operation runtime qualification to OAR session open Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com> * Apply the operation host token bound in planning and CLI inspection Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com> * Preserve explicit DSH operation modules and opt into OAR tools by name Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com> * Refuse bounded OAR DSH operations before model input Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com> * Keep confirmed operations resumable when their executor is unavailable Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com> * Reject conflicting DSH operation and runner selections in delegation planning Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com> * Let ordinary DSH Turns validate the selected OAR runtime (#9993) Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com> * fix(dsh): enforce and verify per-request max_tokens on ordinary OAR turns Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com> --------- Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
…-phase0-1 Signed-off-by: song <xinxinsong66@gmail.com> # Conflicts: # package-lock.json # tests/test_pi_goal_mode.py
…e floor and OAR host Signed-off-by: song <xinxinsong66@gmail.com>
The runtime search helper without extra directories is used only in tests. Compile it only there and simplify the optional version comparison without changing its behavior. Signed-off-by: song <liusongstep@gmail.com>
…dentity Signed-off-by: song <liusongstep@gmail.com>
Reuse the package-owned native private IO helper with the launching Python interpreter, before writing the authentication token. Preserve fail-closed discovery and cover native shared-host and direct daemon startup. Signed-off-by: song <liusongstep@gmail.com>
Use the existing checkout interpreter resolver rather than a bare python alias, retaining the native ACL protection and verification checks. Signed-off-by: song <liusongstep@gmail.com>
|
This pull request has merge conflicts with Choose the remote for the base repository, not an out-of-date fork. 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 HEADFor a same-repository clone whose Keep the DCO |
…licts Signed-off-by: song <xinxinsong66@gmail.com>
songoow
left a comment
There was a problem hiding this comment.
Reviewer: model_agent · GPT-6 Astra Pro · OpenAI · self_reported
Request changes conclusion (author-owned PR; GitHub blocks formal self-review)
动机 / Motivation
维护者需要让工作台上的对话在选定的执行机上启动,并能在失败后核实会话和历史。用户打开普通 Codex 对话,界面等不到握手回执时会重试;先前的启动若迟到,后台应能回收无人接管的会话。当前受管工作台能把会话交给 Core,慢启动和长期写盘故障仍会让后台状态与调用者看到的结果分离。本轮验证覆盖源码和受控运行时,商业模型账户及已打包桌面应用的完整体验尚未验收。
改动思路 / Approach
从 CLI 启动的 Workbench 按执行机的 Core 环境打开受管 OAR 会话;独立节点保留本机适配器。Core 里的 Node 宿主统一持有原生会话,Python 客户端通过本地连接发送请求,Workbench 消费同一执行机上的结果。启动请求的握手和完成后的会话有不同的寿命。客户端在拿到句柄前断开时,可以复用有界 Turn 已有的握手取消机制;拿到句柄之后,持久会话仍可由其所有者恢复。握手处理
具体改动 / Changes
关键代码讲解
start_oar_codex_chat_session将工作目录、权限方式、模型和恢复参数交给 Core。它等到服务端应答才拿到 key,并交给 Chat 会话对象。因此,只在拿到应答后做清理无法处理启动时超时的情况。普通 Chat 入口OarSessionHub.sendPrompt汇集实时事件,并在返回时附带本轮的持久化状态。底层追加 SQLite 记录失败会增加累计计数,保留的失败序号样本最多一千项。调用者同时能看见整个会话和当轮的字段,这两种范围需要分别准确。累计采样 · 响应构造- 合并范围还包括 Core 的运行时加载、Goal Worker、权限策略、Desktop 启停、打包与前端展示。受管 Workbench 对接的入口已在代码中接通。基线
docs/architecture/rfcs/capable-manager-semantic-handoff-v0.md(083d869a47c54612fa27512e5099f4b031facb83)中,runtime-ownership要求实际执行与会话持久化由运行时拥有;当前 Core Hub 承担这两项职责。架构约定 · Workbench 桥接
对主干的风险 / Risks
P2 · 普通 OAR Codex Chat 启动超时会留下无人接管的活跃会话。 打开普通会话时,客户端没有预分配可清理的句柄,也没有传入现有的握手断连取消选项。从公开入口 CodexChatAgentSession.start 打开会话,保持真实的 30 秒超时,把测试执行器的原生握手延迟到 32 秒。客户端在 30.0 秒收到 TimeoutError,再等 5 秒后,daemon 的活跃会话从零变为一个。另用缩短时限的成对实验,默认请求留下一个活跃会话,启用取消标志的请求留下零个。旧调用者无法凭超时后未收到的 key 释放该会话,重复打开可以持续占用资源。启用已有的握手断连取消机制,或保存启动请求的会话标识并在失败时清理。回归应覆盖过期后再查会话列表,同时保留正常打开和恢复用例。已有取消入口
语义与 CI 对齐
P2 · 累计失败样本填满后,后续 Turn 不再报告当轮丢失的记录。 用两个 scripted Turn 驱动真实 Hub,向临时 SQLite 存储的追加操作注入失败。首轮后累计失败 1056 次,样本停在 1000 项。次轮累计增至 1060,但 turn_failed_record_seqs 为空。整个会话仍标记为 degraded;调用者缺失的是判断第二轮哪些记录未归档的证据。每轮独立计数并保留有界样本,显式说明样本是否截断。修复后应再次让首轮填满样本,再断言第二轮四次失败仍有当轮回执。按数组长度切片
我的整体评价 / Verdict
建议修复上述两个问题后复审。它们影响长时间运行下的资源回收和诊断可信度,均在本次提交上有独立反例。PASS:Core 类型检查、Workbench 六个工作区类型检查、Workbench/daemon/web 定向测试 47/47;其中通过受管 Core 桥接和 Grok 夹具验证了流式输出、状态查询、取消与原生恢复。另两组目标套件中,Python 123 项通过,TypeScript 66 项通过。Python 有 11 项跳过。另有 Python、TypeScript 各一项因环境拒绝创建 Unix 域套接字而失败,这两项行为仍未核实。两条新发现均使用本地运行时和夹具,未调用付费模型。本轮复核了会话的后台回读和 Workbench 桥接,没有验证完整的渲染界面。未在本轮检查打包桌面端及响应式页面。旧评审中提及的手工合并提交 b0b0aa 已不在这次基线到 head 的独有提交范围内。审查 head 为 433dc52。
English verdict: REQUEST_CHANGES — at 433dc52, a timed-out Codex Chat open leaves a live session and a saturated persistence sample hides later turn-local failures.
…ence failures Signed-off-by: song <liusongstep@gmail.com>
…fields Signed-off-by: Codex <codex@openai.com> Signed-off-by: song <liusongstep@gmail.com>
…kbench - Resolve merge conflicts in oar.test.ts, oar.spec.mjs, runtime/workbench.ts, and runtime/workbench_service.ts while preserving all #9854 OAR fusion behavior. - Align #9854 OAR Core bridge env vars to LOOPX_WORKBENCH_OAR_CORE_* (retaining LOOCHAT_OAR_CORE_* compat fallback and secret scrubbing in daemon, runtime_loader.ts, and oar_client.py). - Update python-tests.yml Workbench OAR job workspace name from @loopx/loochat to @loopx/workbench-daemon. - Fix CodexSession.onPeerClosed() collision with ThreadManager's session.onClosed(listener) hook and await in-flight sessionStarts during shutdown without breaking cancelled-turn semantics. Signed-off-by: maxliux5 <5958865+maxliux5@users.noreply.github.com>
…-mismatch test, and verify retry allowance - Restore _OAR_CODEX_BINARY_CACHE as dict[tuple[str, int], bool] (storing only verified True entries, never caching failures) so monkeypatch.setitem in tests/test_codex_operation_host.py succeeds while failed probes remain uncached (fixes 3 AttributeError regressions from b384657). - Update tests/capabilities/test_codex_native_child_receipts.py::test_real_cli_rejected_resume_thread_cannot_publish_children to expect codex_cli_session_missing (failure_kind=session_missing), matching OarSessionHub.openSession's oar_session_not_found enforcement on mismatched resume thread IDs (24df8a3 / #9854). - Strengthen tests/test_codex_cli_host.py to assert host_failure_retry_available (bounded retry allowance vs non-retryable contract_rejected) and repeated probe execution without cache poisoning. Signed-off-by: song <xinxinsong66@gmail.com>
…21.0 contracts (#10264) Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
Supersedes #7568 (closed with migration explanation).
Summary
This PR delivers the end-to-end Open Agent Runtime (
@botiverse/oar@0.142.0) deep fusion into LoopX on top of the existing Node.js 24 TypeScript control plane andSqliteAuthorityStore:OarSessionHostdaemon + Python keep-alive client (OarSessionClient) with dedicated live control transport (interrupt,steer,answer_question,close_session,shutdown).opencode2Goal Worker onto OAR while preserving strict LoopX authority, quota/lease semantics, permission boundaries, and rollback compatibility (LOOPX_EXECUTION_ENGINE=legacy).--host oar --oar-runtime <id>) and Chat, aligns Workbench to@botiverse/oar@0.142.0, adds Windows Job Object containment, addssessions.sqliteWAL persistence with legacy JSONL dual-read, wires in-process Control Plane MCP write tools (claim, task lease, terminal settlement) bound to active turn grants, and connects the Workbench model picker, live session status, and native session execution to Core.Scope by Phase
Phase 0 + 1 — Runtime Foundation & Persistent TS Session Host (original #9854)
>=24.21.0& single-lockfile@botiverse/oar@0.142.0: Raised Node floor across Core (loopx/control_plane/runtime/node_probe.py), Desktop Tauri nvm discovery (apps/desktop/loopx-control-plane/src-tauri/src/services.rs), CI, packaging, and docs; added@botiverse/oar@0.142.0to rootpackage.jsonand wheel/source packaging (loopx/hosts/oar_distribution.py).OarSessionHost& PythonOarSessionClient:loopx/control_plane/oar/session_hub.ts,session_host_server.ts,session_policy.ts,runtime_loader.ts,control_plane_mcp.ts,error_mapping.ts,loopback_http.tsloopx/hosts/oar_client.py— cross-process startup locking, POSIX locator ownership/permission validation, runtime fingerprint checks, dedicated_call_controlchannel sointerrupt/steer/answer_question/close_session/shutdownnever block behind an in-flightprompt(), andpendingSessionKeysconcurrency reservation.Phase 2 — DSH, Claude/ACP & Bounded Codex Host Migration (merged from #9861)
loopx/hosts/dsh/turn_host_adapter.py,loopx/hosts/dsh/native_operation.py,loopx/chat/dsh.py— persists native OAR session identity, honorsLOOPX_EXECUTION_ENGINE=legacyrollback, invalidates dead handles on terminal OAR errors (oar_session_not_found,runtime_exited,session_released,transport_lost) so Chat recovers cleanly while keeping transient errors healthy.loopx/chat/acp.py— populates confirmed model/reasoning settings from observed OAR session metadata, validates missing/mismatched configs, and enforces structured failure outcomes beforeanswer.finalpublication.loopx/control_plane/turn_driver/oar_operation_host.py,codex_cli.py,_codex_legacy_exec.py,codex_operation_host.py— preservesFirstPartyHostGoalAdmission, native-child observation guards, and maintainability ratchet ceilings.Phase 3 — Ordinary Codex Chat & Unified OAR Goal Worker (merged from #9866)
loopx/chat/oar_codex_chat.py,loopx/chat_agent.py— routes eligible ordinary Codex Chat sessions through OAR with attachment forwarding, inactivity timeout preservation, launch-fence holding, andexpected_turn_idverification, while cleanly falling back to native stdio for history import / isolated shell / native turn options.loopx/control_plane/oar/goal_worker.ts,loopx/cli_commands/opencode2_goal_worker.py— quota-gated multi-turn worker with serialized lease heartbeats across prompts/waits,inFlightDispatchcrash recovery, rejected-dispatch task preservation, and explicit zero-budget CLI validation (--max-turns 0,--max-duration-minutes 0).Phase 4a — 16 OAR Runtimes, Workbench Alignment & Windows Containment (merged from #10097)
loopx/control_plane/turn_driver/oar_turn_host.py,driver.py(SUPPORTED_HOSTSincludes"oar"),execution_profile.py(deferred CLI imports),loopx/chat/oar_chat_adapter.py,loopx/chat/session_open.py(owner-registered ACP endpoints take precedence over built-in OAR IDs).session_host_server.tsaborts active sessions (hub.disposeAll()) before draining onSIGTERM/SIGINT;oar_client.pyadds Windows Job Object containment.apps/workbenchonto@botiverse/oar@0.142.0with patchedminimatch.Phase 4b — SQLite WAL Store, In-Process MCP Write Tools & Workbench UI (merged from #10098)
loopx/control_plane/oar/session_sqlite_store.ts— permissions-hardened SQLite WAL store for sessions, records, and steering reservations with cold readback, full-stream folding, and legacy JSONL transcript dual-read.loopx/control_plane/oar/control_plane_mcp.ts— binds lease ownership to active grant actor, supports canonical reducer statuses (includingdry_run), and isolates daemon identity byLOOPX_OAR_SESSIONS_DB.loopx workbench startuses the shared Core OAR host on its execution machine. Ordinary threads read status from their machine in/status. Goal original conversations read their bound Core session. Both show the model and effort reported by the runtime. Standalone Workbench installations keep their local adapter. The OAR-specific Dashboard controls and SDK dependency have been removed.Compatibility & Safety Guarantees
LOOPX_EXECUTION_ENGINE=legacyrestores legacy DSH/Codex paths without touching OAR.endpoint_registryretain precedence over built-in OAR runtime IDs.session_policy.ts; MCP write grants are actor-bound and revoked on turn end.main..HEADcarry validSigned-off-by:trailers (with GitHubweb-flowverified integration merges).Verification (Consolidated HEAD
ec40a9f3a)ruff check --ignore-noqa --config scripts/ci/external-request-lint.toml loopx packages scripts apps— 0 errorsruff check --ignore-noqa --config scripts/ci/external-transport-lint.toml loopx packages/*/src— 0 errorsruff check --select E4,E7,E9,F tests loopx/canary loopx/control_plane loopx/domain_packs loopx/presentation— 0 errorstest_maintainability_ratchet.py+test_runtime_subprocess_utf8.py+test_host_parity_smoke.py+test_scheduler_heartbeat_receipt_fence.py+test_turn_machine_credential.py: 346 passed (the sole failure intest_control_plane_import_boundaries.py::test_public_facade_import_only_reexports_match_the_audited_allowlistis pre-existing onorigin/mainin untouchedloopx/quota.py).test_antigravity_adapter_preserves_caller_typing_contracts&test_turn_handler_import_defers_optional_workflows: 2/2 passed.node --test tests/control_plane_ts/oar_*.test.ts— 30/30 passed.