Repository navigation
feat(oar): multiplex session host, direct Node Workbench bridge, and parent quota channel - #10241
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>
…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>
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>
…ion-phase2 Signed-off-by: song <xinxinsong66@gmail.com> # Conflicts: # loopx/cli_commands/turn.py # loopx/cli_commands/turn_dsh_host.py # loopx/cli_commands/turn_registration.py # loopx/cli_commands/turn_selection.py # loopx/control_plane/oar/session_host_server.ts # loopx/control_plane/oar/session_hub.ts # loopx/control_plane/turn_driver/codex_cli.py # loopx/control_plane/turn_driver/codex_sessions.py # loopx/control_plane/turn_driver/host_binding.py # loopx/control_plane/work_items/operation_agent_handoff.ts # loopx/hosts/dsh/turn_host_adapter.py # loopx/hosts/oar_client.py # tests/control_plane/test_dsh_operation_entry.py # tests/control_plane/test_oar_session_client.py # tests/control_plane/test_operation_transport_readback.py # tests/control_plane_ts/oar_session_hub.test.ts # tests/test_codex_operation_host.py # tests/test_loopx_turn_driver.py # tests/test_loopx_turn_replan_successor.py
…ion host, and runtime loader Signed-off-by: song <xinxinsong66@gmail.com>
…n-phase3 Signed-off-by: song <xinxinsong66@gmail.com> # Conflicts: # loopx/control_plane/turn_driver/codex_cli.py # loopx/control_plane/turn_driver/oar_operation_host.py
…rker Signed-off-by: song <xinxinsong66@gmail.com>
Signed-off-by: song <xinxinsong66@gmail.com>
…ion-phase2 Signed-off-by: song <xinxinsong66@gmail.com>
…n-phase3 Signed-off-by: song <xinxinsong66@gmail.com>
… 0.142.0, and add Windows Job containment Signed-off-by: song <xinxinsong66@gmail.com>
… and Dashboard OAR observe/brands/forms Signed-off-by: song <xinxinsong66@gmail.com>
Signed-off-by: Codex <codex@openai.com>
Signed-off-by: Codex <codex@openai.com>
Signed-off-by: Codex <codex@openai.com>
Signed-off-by: Codex <codex@openai.com> 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 |
Signed-off-by: Codex <codex@openai.com> Signed-off-by: song <liusongstep@gmail.com>
Signed-off-by: Codex <codex@openai.com> 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 |
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
使用 loopx workbench start 的操作者需要 Workbench 与 Core CLI 共用宿主和会话句柄。每会话的 Python 桥接改为共享 Node 连接;基线 #10243 同时将 Workbench 的环境变量归一化。迁移后生命周期应报告 core,流式会话、取消和断线清理都由同一个宿主处理。本次覆盖托管模式、独立模式和 Goal 配额通路。
改动思路 / Approach
启动器向 daemon 传递可执行宿主入口和环境快照。OarHostClient 将带请求 ID 的命令复用到一个 Node Session Host,Goal Worker 继续向父进程申请配额。两条通路分别决定会话归属和是否允许下一轮。
具体改动 / Changes
21 个文件涉及直接连接、请求排队与取消、跨进程启动锁、会话归属和 Goal 配额。已关闭的锁竞争、取消饥饿反馈分别由真实 Python/Node 并发启动和复用套接字用例覆盖。此前旧构建的协议探测也保留在本次提交。
P2 · 托管 Workbench 与主干的环境归一化相遇时会选错会话所有者。 在 e357962 主干的 daemon-main 初始化过程中,将此 PR 启动器发出的 ROOT、HOST_ENTRY、ENV 三个旧前缀字段交给 adoptLegacyEnv。同一个配置对象在规范化前返回 core,规范化后只保留 LOOPX_WORKBENCH_OAR_CORE_*,当前读取器返回 standalone。 Core 启动端、所有者读取端、主干启动时的规范化、主干的键名迁移
对主干的风险 / Risks
git merge-tree 对 e357962 报告 8 个冲突文件。冲突包括启动协议、两端环境过滤及对应测试。直接保留 PR 一侧会让托管用户获得独立会话,生命周期状态和后续控制与其预期不同。GitHub 在该头的三项已完成检查为绿;它们未测试这两个版本的组合。
按提交树运行真实宿主测试 9/9,覆盖并发 Python/Node 启动、共享会话、取消和断线清理。隔离整合候选的启动路径 6/6、真实宿主 9/9。
我的整体评价 / Verdict
请先整合 #10243 并验证两端解析同一组字段。在只用于复核的候选中,双前缀读取、规范前缀写入和保留两条过滤规则使真实共享宿主测试通过。候选没有改动 PR,系统服务注册及 macOS 自启动未在本次复核中执行。 同步启动器、预检、宿主适配器和环境过滤器的规范键名。读取兼容旧前缀,保留配额通道过滤;过时的 Python 桥接配置继续在启动前被拒绝。让真实启动环境经过 daemon-main 使用的 adoptLegacyEnv,再断言已托管工作台返回 core;另测空配置、旧前缀、残缺配置和不兼容旧构建。
English verdict: REQUEST_CHANGES — 7d19f96. The submitted host reader falls back to standalone after current main normalizes the launch environment. The integration requires conflict resolution.
Signed-off-by: song <xinxinsong66@gmail.com>
Signed-off-by: song <xinxinsong66@gmail.com>
|
Synced with latest
Verification (
|
songoow
left a comment
There was a problem hiding this comment.
Reviewer: model_agent · GPT-6 Astra Pro · OpenAI · self_reported
Approval conclusion (author-owned PR; GitHub blocks formal self-approval)
动机 / Motivation
操作者从 LoopX 启动托管 Workbench,同时从 Core CLI 查看或控制同一原生会话。旧版本为每个 Workbench 会话启动 Python 桥,新版本直接向共享 Node 宿主复用请求。配套托管配置在守护进程归一化后仍认定为 core;独立启动保持 standalone,旧构建在创建服务前收到重建提示。本次审查工作台的会话归属、跨语言启动、流式取消和 Goal 配额,未验证签名后的 macOS 自动登录服务。
改动思路 / Approach
Core 启动器以实际传给宿主的环境快照检查安装的守护进程。Workbench 适配器读取规范前缀并兼容旧前缀,用一个 Node 客户端复用连接和请求编号。宿主登记每条连接拥有的会话,Goal 的配额仍由现有父进程决定。
会话传输、启动契约和 Goal 配额通道。同一托管工作台复用一条 Node 连接访问 Core 宿主,Goal 的轮次配额交给原有父进程处理。
具体改动 / Changes
Workbench 使用说明 在主干 dd4f32c 的 apps/workbench/README.md 里区分了托管执行和独立节点。对照文档逐项验证 managed-owner 与 standalone。本次将真实 adoptLegacyEnv 接在配置读取之前,在当前提交实测新旧前缀都得到 core,空环境得到 standalone;只提供 Python 桥接或者字段残缺时,在启动前被拒绝。上次审查记录的规范化回归已解决。
多路宿主还验证了 Python/Node 并发启动只产生一个宿主,多会话 prompt、状态和迟到取消能按编号关联,连接断开仅清理自己的句柄。Goal worker 的配额、恢复和失败路径也已复测。控制面 62/63 通过,唯一失败为当前 main 同样可复现的 lifecycle.sock 绑定 EPERM。Workbench daemon 31/31、Python 会话客户端与 Goal 配额 102/102 通过。
对主干的风险 / Risks
基线和提交头上的单项排空测试都在建立本地 Unix socket 时遇到 EPERM,未进入生产排空逻辑。当前 Linux 的真实 TCP 宿主会话按预期运行,系统服务安装仍需平台 CI 覆盖。与最新 main 的合并可干净完成;它比本 PR 的分叉点多一个发布打包脚本提交,未改变被核查的宿主入口。
我的整体评价 / Verdict
建议通过此次提交。启动协议现在能在升级时明确拒绝不配套的守护进程,独立用户维持本地执行。公开协议、已有的共享宿主和配额归属均通过针对性测试;没有发现需要继续阻塞此 PR 的问题。
English verdict: APPROVE — a1ac646. Real daemon normalization preserves Core ownership, incompatible builds fail before spawn, and shared-host integration passes.
Signed-off-by: song <xinxinsong66@gmail.com>
Summary
The OAR foundation from #9854 is on
mainat93be88db8. This PR targetsmainand provides the direct Node host used by #10242. It eliminates the cross-languageNode ↔ Pythonping-pong hops in the OAR integration while preserving 100% single-owner control-plane authority and backward compatibility:Multiplexed
session_host_server.tsbyrequest_idinFlight+socket.pause()head-of-line blocking inloopx/control_plane/oar/session_host_server.ts, dispatching concurrent frames keyed byrequest_id(bounded byMAX_INFLIGHT_PER_SOCKET = 64backpressure,MAX_STREAM_BACKPRESSURE_BYTES, deferredkeep_alive: falsedrain, and bounded 5s shutdown drain).WeakMap<Socket, AbortController>) to multi-session per keep-alive socket (WeakMap<Socket, { pendingOpens, sessions }>) so a single Workbench Daemon socket multiplexes all active OAR threads and disposes only its owned sessions on disconnect.OarSessionClient.Direct Node-to-Node Workbench Daemon →
session_host_server.ts& unifiedOarSessionBackendapps/workbench/packages/daemon/src/adapters/oar-host-client.ts(OarHostClient), a multiplexed pure-Node TCP/NDJSON client with byte-for-byte SHA-256 source fingerprint parity (computeOarHostFingerprint), private runtime directory/locator ownership & symlink checks, and atomic startup locking matchingloopx/hosts/oar_client.py.CoreOarHostBackendandLocalOarBackendbehindOarSessionBackendinoar-core.ts/oar.ts; all managed Workbench OAR threads now share one persistent multiplexed TCP connection directly tosession_host_server.ts(withonLateResultcleanup on timed-out opens and automaticonClosedeviction on host disconnect).loopx/hosts/workbench_oar.py) and removes the PythonspawnSyncprobe fromloopx/control_plane/runtime/workbench_service.ts, eliminating theNode → Python → Node3-hop path.Eliminate per-cycle
execFile("loopx", ["quota", "should-run"])cold Python forks ingoal_worker.tsloopx/cli_commands/quota.py,quota_should_run.py,live_decision.py,quota.py, andstatus.py(~6,000+ LOC of authoritative Python orchestration including turn-start hooks, Lark inbox, replan obligations, rollout logging, and host-poll receipts). Rather than introducing a split-brain approximate TS re-implementation,loopx/cli_commands/opencode2_goal_worker.pynow hosts a per-run authenticated,goal_id-scoped loopback NDJSON quota bridge (_GoalQuotaLoopbackBridge) that callshandle_quota_commandin-process over a persistent connection.loopx/control_plane/oar/goal_worker.tsconsumes and immediately scrubsLOOPX_OAR_QUOTA_BRIDGE_*credentials fromprocess.env(with defense-in-depth stripping inruntime_loader.ts,oar_client.py,oar-host-client.ts, andadapters/types.ts) and reuses one persistent keep-alive loopback socket across cycles (withAbortSignalcancellation, transparent reconnect on idle EOF, explicitLOOPX_BINoverride compatibility, and standalone CLI fallback).Verification
npm run typecheck:control-plane— passnode --experimental-sqlite --experimental-strip-types ... --test tests/control_plane_ts/oar_*.test.ts tests/control_plane_ts/workbench.test.ts— all pass (including newoar_session_host_multiplex.test.ts+ new loopback quota bridge tests inoar_goal_worker.test.ts)npm --prefix apps/workbench run build -w @loopx/loochat+ Workbench daemon OAR & lifecycle suite (oar-core.test.ts,oar.test.ts,oar-thread-status.test.ts,workbench-lifecycle.test.ts) — 39/39 pass (including byte-for-byte Node↔Python SHA-256 fingerprint parity and shared multiplexed socket verification)pytest -q tests/control_plane/test_oar_*.py tests/control_plane/test_workbench_cli.py— 247/247 pass (including real non-mockedevaluate_goal_quota_in_processand end-to-end Node↔Python quota bridge test with poisonloopxshim onPATH)mypy,ruff(incl.external-request-lint.toml&external-transport-lint.toml),node scripts/ci/lint-external-transports.mjs,python3 -m loopx.cli check,git diff --check— all pass