Repository navigation
refactor(oar): unload OAR patch shell and sunset dual-track legacy code - #10251
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>
…licts Signed-off-by: song <xinxinsong66@gmail.com>
…hase0-1 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 连续执行多个 Turn 的操作者会遇到这个变化。过去探测失败时会尝试旧执行器,现在只走 OAR;若后台服务启动失败,操作者看到的是升级 Codex 的提示。这次统一了会话生命周期,探测阶段的错误分类却让任务提前停止。真实账号的在线模型效果、桌面全平台发布以及其他 PR 的交付不在本次验证范围。
改动思路 / Approach
托管 Turn 由 Python 核对请求、可执行文件和 Goal 准入,再由 Node 会话宿主打开会话、发送提示并关闭。Claude 与 DSH Chat 共用这条主机链路,普通 Codex Chat 继续显式启用 OAR。涉及原生历史、特定账户或高隔离权限的会话仍交给直接的 app-server。这样的拆分有具体消费者,例如原生适配器要读线程工作状态,而当前 OAR 没有提供对应的 RPC。修复此次故障只需要保留探测错误的类型。
具体改动 / Changes
关键代码讲解
select_codex_chat_backend先判断隔离和协议要求,再检查普通会话是否启用 OAR。原生适配器会根据选定后端决定是否可读工作状态、是否允许重建历史。DSH 自定义 Cordis 配置移到显式操作模块,托管 Codex 删除旧 exec 路径。依赖、wheel 测试和 CLI 样例也随 Core 升级。Chat 路由_run_codex_via_oar在启动许可内探测二进制并打开会话,执行完成后检查原生会话身份。新流选项能在有界请求执行期间客户端断连时关闭该会话。沙箱构造区分普通权限与限制写入单个目录的配置,避免把这两种约束混在同一条路径。Turn 入口- 父分支的规范
docs/reference/protocols/loopx-turn-v0.md(433dc527919178d7c9b82ed408d0692409fa4058)要求transport_lost返回带有界重试信息的宿主失败。本次在守护进程的探测阶段观测到该条件未满足。Turn v0 规范
对主干的风险 / Risks
语义与 CI 对齐
P2 · OAR 宿主启动失败被报成 Codex 需要升级。 使用相同的测试二进制和合法 Turn 请求,在探测 RPC 注入守护进程启动时会实际产生的 oar_host_startup_failed / transport_lost。父分支通过原有 exec 完成了这次测试 Turn。当前提交在探测异常处分支返回 false,公开入口报出 codex_cli_oar_upgrade_required / contract_rejected,连二进制都未启动。调用真实宿主恢复策略后,传输失败本应允许使用相同配置最多尝试三次,当前分类却给出不可重试。升级客户端对这个错误无效。异常转换 · 升级判断
把探测通道故障保留为可重试的传输错误,只有明确发现版本不受支持才提示升级。保留现有的旧版本二进制拒绝测试,在同一公开入口增加探测 RPC 失败用例,同时断言错误类型与下一次尝试的许可。检验该分支可运行 python -m pytest -q tests/test_codex_cli_host.py;现有该文件仅用布尔值模拟不支持的二进制。
我的整体评价 / Verdict
建议修复后复审。第一次启动恰逢宿主中断就会让连续执行中的工作停下来,操作者还会被引向错误的修复动作。本次修改的是宿主的执行和错误回读,未改动渲染页面。PASS:Core TypeScript 类型检查、52 项 OAR TypeScript 测试与 85 项 Python 宿主测试。三回合 CLI 样例首次在 Effect runtime 的 TCP 连接失败,切换 stdio 后三个回合均通过验证并提交。FAIL:上述传输故障下的恢复分类。UNVERIFIED:真实账号与多平台发布。此结论针对已同步父分支的提交 1732e3f。
English verdict: REQUEST_CHANGES — at 1732e3f, the passing host suites do not cover a reproduced probe transport failure that disables bounded retry.
…ence failures Signed-off-by: song <liusongstep@gmail.com>
Signed-off-by: Codex <codex@openai.com> Signed-off-by: song <liusongstep@gmail.com>
…fields 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>
…oke, and benchmark classifier - Install locked Node/OAR dependencies (npm ci --ignore-scripts) in ark-turn.yml and memt-turn.yml so single-track OAR codex-cli turns in test_loopx_turn_driver.py have @botiverse/oar available. - Update test_installed_core_starts_and_replays_a_checked_codex_goal read-only branch in tests/test_core_distribution.py to verify OAR's -c sandbox_mode="read-only", -c approval_policy="never", OAR_CODEX_SANDBOX="read-only", and absence of legacy --sandbox flag. - Retain pure stateless CodexFailureObservation error-envelope classifier in loopx/control_plane/turn_driver/codex_cli.py (with zero legacy exec code) required by benchmark/microbench/models.py and benchmark/runtime/worker.py (fixing stage2c e2e 1 & 2 ImportError), with unit coverage in tests/test_codex_cli_host.py. - Migrate _capturing_fake_codex in tests/control_plane/test_turn_prompt_prefix_stability.py (merged from main) from legacy codex exec flags to Codex app-server JSON-RPC capturing exact wire prompt and outputSchema bytes. 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 |
Reapply the cleanup delta from the shared OAR stack ancestor onto the squash-merged main tree, preserving the subsequent release-qualification changes. Signed-off-by: Codex <codex@openai.com> Signed-off-by: song <liusongstep@gmail.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>
|
Fast-forward follow-up commit
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
使用托管 Codex Turn、Claude 或 DSH 的用户此前会遇到两套执行路径。主干在 OAR 探测失败后会启动旧执行器;当前版本保留原始传输错误并允许按原配置重试。三轮公开 CLI 操作按预期提交,重放没有重复扣费或写状态。此次验收覆盖 Core 运行时和聊天路由,线上模型质量与操作系统服务不在范围内。
改动思路 / Approach
会话生命周期、取消和沙箱由共享 OAR 宿主管理,重试由现有 Turn 规则决定。本 PR 收敛 Core 的 Turn 和聊天适配器,需使用原生能力的 Codex Chat 仍由直接连接负责。 普通聊天只有显式启用且二进制受支持时才走 OAR,权限配置、原生历史或强隔离优先走直接连接。
具体改动 / Changes
关键代码讲解
相对上一个提交,生产变更只涉及 Codex 二进制探测缓存。按(路径、mtime_ns)存储已确认的 True,超时、传输断开、明确不支持均不写入。 前一提交的操作宿主测试在预置成功探测时抛出 AttributeError(set 没有 get);同一测试在新提交通过。 探测缓存
用另一条线程 ID 响应原生 resume 时,Hub 返回 oar_session_not_found,托管宿主映射为 session_missing;真实适配器用例同时断言子任务启动数为零、没有写入子任务决策。 拒绝串线测试
同一未缓存请求在新 main 会转入旧执行器,在当前 PR 会保留 transport_lost。第一次可按原配置重试,达到尝试上限后停止;传输故障最多 3 次,执行器超时最多 2 次,明确不支持的版本直接拒绝。规范 docs/reference/protocols/loopx-turn-v0.md(dd4f32c4a8911d9db181d1eae4c96d835446887b)的验收项 transport_lost 已通过。 重试分支和上限
对主干的风险 / Risks
精确提交的六套 Python 测试共 248 项通过、4 项按条件跳过,OAR TypeScript 测试 53/53 通过。与当前 main dd4f32c 的合并树无冲突,195 项 Python 测试与 24 项 Hub 测试通过,4 项按条件跳过。控制平面类型检查和公开 CLI 三轮走通,重放没有再次调用宿主、写入状态或扣费。未运行要求 Linux setuid 启动器的两个用例、两个需要真实供应商的显式发布验收用例,以及打包桌面端验收。新提交的 GitHub 检查采样为 3 项成功,6 项运行中,5 项排队,无失败项。
我的整体评价 / Verdict
历史 P2 的正向、反向与耗尽分支均已验证,恢复不匹配时不会记录其他线程的子任务。建议合入当前提交。本 PR 收敛 Core 的 Turn 和聊天适配器,需使用原生能力的 Codex Chat 仍由直接连接负责。 PASS。
English verdict: APPROVE — cb6d0a6, approve. Only verified probe results are cached, retry allowance and exhaustion are tested, and a mismatched resumed session cannot publish child receipts. The current-main merge passed its bounded CLI and replay tests.
Signed-off-by: song <xinxinsong66@gmail.com>
|
Follow-up adversarial invariant-hardening and CI flake-fix PR opened at #10277 ( |
Summary
This PR targets
mainafter the OAR foundation landed in #9854 (93be88db8). Upgrades@botiverse/oarto published npm0.144.0, cleanly quarantines LoopX's remaining upstream-pending OAR shims, sunsets dual-track legacy execution paths across LoopX's four core hosts, and explicitly separates ordinary OAR Codex Chat from LoopX's high-isolation directcodex app-serversecurity shell.Diff & Deleted-Line Summary
+3444 / -2657loopx/: 16 files changed,+1074 / -1436(-362 net lines, including deleting the entire 607-lineloopx/control_plane/turn_driver/_codex_legacy_exec.py)67de8f533—chore(oar): upgrade @botiverse/oar to 0.144.0 and quarantine patch shella1924354e—refactor(oar): sunset dual-track legacy code across core hosts and isolate Codex Chata8930eef0—test(oar): migrate remaining downstream codex-cli shims and test closeOnDisconnectPart A — Unload OAR Patch Shell
@botiverse/oar0.142.0 -> 0.144.0(package.json,package-lock.jsonviahttps://registry.npmjs.org/only, zero mirror URLs). Maintains 100%0.144.0compatibility while upstream PRs (botiverse/oar#1337,#1341,#1342,#1343) await npm release.loopx/control_plane/oar/session_policy.ts:botiverse/oar#1337(OAR_CODEX_SANDBOX): unconditionally pins per-sessionenv.OAR_CODEX_SANDBOX("read-only"/"workspace-write") for ordinary Codex policies while scrubbing case-insensitive caller overrides.writeDirectorynetwork-disabled Codex profile (applyCodexWriteDirectoryProfile, setsenv.OAR_CODEX_SANDBOX = null,enforcementMechanism: "codex_write_directory_profile").OAR_CODEX_SANDBOXininheritmode and quarantines the pre-#1337-c sandbox_mode/approval_policycompatibility shim inapplyPre1337CodexSandboxCompatwith an explicit removal trigger.loopx/control_plane/oar/session_hub.ts&session_host_server.ts:prepareDshMaxTokensOverlay, extractedverifyDshMaxTokensOverlayApplied, and quarantined the three upstream-pending shims behind minimal helper boundaries with explicit removal triggers:maxTokensCordis overlay ->botiverse/oar#1341botiverse/oar#1337final_answerphase extraction (completedCodexChatAnswer) ->botiverse/oar#1342closeOnDisconnectonoar.prompt_streamso SIGKILLed bounded Turn drivers abort and reap orphaned native host processes cleanly without affecting unrelated live sessions.Part B — Sunset Dual-Track Legacy Code Across Core Paths
loopx/chat/providers.py): Deleted_start_turn_legacy,current_processsubprocess fallback, and legacy branching — Claude Chat runs single-track on OAR (OarSessionHost).loopx/chat/dsh.py,endpoint_catalog.py,hosts/dsh/turn_host_adapter.py,cli_commands/turn_dsh_host.py,host_binding.py):DshChatAdapter.runner,_run_custom_runner,_run_legacy_dsh_turn) so production DSH Chat and ordinary DSH Turns run single-track on OAR (streaming: True,interrupt: True).build_sdk_configanddsh_operation_host.pyintact for DSH Operation Host / Cordis modules (dsh_cordis_requires_operation_module)._codex_legacy_exec.pydeleted,codex_cli.py):loopx/control_plane/turn_driver/_codex_legacy_exec.py(607 lines),_run_codex_cli_exec_session,_looks_like_python_shim, and dual-track fallback (git grep _codex_legacy_exec: 0 matches).BuiltInHostError("codex_cli_oar_upgrade_required", failure_kind="contract_rejected").launch_guardbefore probing the Codex binary; forwards private decision-capture stdio transport andcloseOnDisconnect; enforces non-empty/consistentnative_session_idon open and completion.LOOPX_EXECUTION_ENGINE=legacy(loopx/hosts/oar_client.py,doctor.py,docs/reference/local-delegation.md):LOOPX_EXECUTION_ENGINE=legacyfails fast withOarHostError(code="oar_legacy_engine_removed")across all core host entrypoints and fails the requiredoar_runtimecheck inloopx doctorwith clear migration guidance.launch_guard()+check_running()file-lock self-deadlock inrun_guarded_oar_turn(on legacy registries) exposed once legacy Codex fallback was retired.loopx/chat/oar_codex_chat.py,chat_agent.py,capabilities/native_chat/codex_adapter.py):CodexChatSecurityShellRequirements(grouped across Process & filesystem isolation, Auth & model routing, and Direct app-server protocol hooks),CodexChatBackendRoute,select_codex_chat_backend, and cohesiveOarCodexChatBackend.CodexAppServerAdapter(completed_work_observation,answer_review_replaceable,steering_delivery_readback,_restore_native_history,healthcheck).LOOPX_OAR_CODEX_CHAT=1): audited both upstream contract gaps and confirmed they cannot be cleanly papered over inside LoopX without breaking parity:@botiverse/oardeclines generic session readback and does not yet expose Codex app-server readback RPCs (thread/turns/list,thread/items/list,thread/backgroundTerminals/list; driver-native readback tracked inbotiverse/oar#631) needed bycodex_adapter.py(steering_delivery_readback,completed_work_observation,answer_review_replaceable).implicit_codex_homecold-resumemodelProviderpinning:@botiverse/oar'scodexThreadOpendoes not expose pre-resumeconfig/readdiscovery orthread/resume { modelProvider }pinning required bycodex_adapter.pyandtest_chat_codex_home.py.Verification Ledger
npm run typecheck:control-plane: PASS (0 errors)node --no-warnings --experimental-sqlite --experimental-strip-types --test tests/control_plane_ts/oar_*.test.ts: 51/51 PASS (includingOAR_CODEX_SANDBOXpinning/scrubbing,writeDirectoryisolation, andoar.prompt_streamcloseOnDisconnect)ruff(external-request-lint.toml,external-transport-lint.toml, andE9,F63,F7,F82,F401,F841on all modified.pyfiles): PASSnode scripts/ci/lint-external-transports.mjs: PASSpython -m loopx.cli check: PASS (ok: True, 0 errors)python examples/loopx-turn-codex-cli-e2e-smoke.py --turn-count 3: PASStests/architecture/test_control_plane_import_boundaries.py: 32/32 PASSpytestsuites (OAR, DSH, Claude, Codex CLI turn & chat,test_chat_codex_history.pyincl. strict mypy zero-Any contract, doctor, bindings, launch authority, interruption recovery, and all 10 migrated downstreamcodex-clitest files): 100% PASS (0 regressions; also verified all 34 context-strategy / semantic-unit-fold / epoch-prefetch tests with an in-memorytiktokenstub).