Repository navigation
feat(scheduler): support Codex App native Goal runtime profile - #7841
xiaobaifly7 wants to merge 2 commits into
Conversation
Signed-off-by: xiaobaifly7 <196511160+xiaobaifly7@users.noreply.github.com>
|
想问一下,codex app 已经支持 automation 的情况下,支持 goal 的动机是什么呀? 我的使用体验上似乎前者可以替代后者
黄瑞腾
***@***.***
…---- 回复的原邮件 ----
发件人 xiaobaifly7 ***@***.***> 发送日期 2026年11月02日 02:19 收件人 loopx-project/loopx ***@***.***> 抄送人 LoopX Agent ***@***.***>,
Review requested ***@***.***> 主题 [loopx-project/loopx] feat(scheduler): support Codex App native Goal runtime profile (PR #7841)
Local Codex App conversations can use the host's native Goal loop, but LoopX currently accepts the desktop host only with heartbeat automation scheduling. This adds the explicit codex_app_goal runtime profile for codex_app / goal_runtime / interactive, allowing an existing conversation to load its bound Goal through heartbeat-prompt --bootstrap --thin --runtime-profile codex_app_goal.
The profile reuses the existing native Goal prompt, guided --begin-turn admission, and visible-goal settlement. Generated guards request a receipt before exposing work, and settlement preserves the selected Todo and remains idempotent on replay. Usage remains attributed to Codex App. An inherited machine context-delivery preference keeps ordinary full delivery for this mode; an explicit unsupported --context-delivery on request still fails.
Existing --codex-app and codex-app onboarding retain heartbeat behavior. The documentation explains explicit activation in an already connected conversation, stable identity, user-owned resume, and the separate evidence needed for host-triggered continuation. The change extends the scheduler-owned runtime-profile vocabulary and uses the existing control-plane owners without adding a capability, provider, scheduler, or dependency.
Validation:
Focused CLI tests: 23 passed on the final rebased commit, covering bootstrap loading, native re-entry, selected-Todo writeback and settlement on File and SQLite, duplicate-spend prevention, missing-receipt rejection, terminal settlement, and inherited versus explicit context settings. The scheduler execution-context decision table and host prompt checks cover the new profile, existing modes, and invalid combinations. TypeScript usage statistics: 11 passed. Ruff, staged/final bilingual RFC checks, diff whitespace check, and the diff-scoped semantic advisory passed. The public-boundary scan passed with one existing synthetic Authorization: example fixture warning; the changed lines contain no credentials or local project data.Windows validation limits: existing host-activation subprocess tests invoke the POSIX scripts/loopx launcher directly. Five attempted integration cases failed with WinError 2; further cases using the same launcher were left untested. Full repository regression and packaged Codex App continuation were not run from this checkout. The CLI tests establish LoopX routing and settlement; a LoopX receipt alone cannot establish the native host trigger or automatic continuation.
You can view, comment on, or merge this pull request online at: #7841
Commit Summaryc079c89 feat(scheduler): support Codex App native Goal runtime profileFile Changes(16 files)
M docs/heartbeat-automation-prompt.md (23) M loopx/cli_commands/quota_context.py (2) M loopx/control_plane/heartbeat/host.py (2) M loopx/control_plane/quota/spend_sources.py (5) M loopx/control_plane/runtime/usage_statistics_goal_contract.ts (2) M loopx/control_plane/scheduler/execution_context.py (20) M loopx/control_plane/turn_driver/codex_context.py (19) M loopx/project_prompt.py (19) M skills/loopx-project/references/heartbeat-hosts.md (31) M tests/control_plane/test_context_machine_configuration.py (2) M tests/control_plane/test_heartbeat_cli.py (22) M tests/control_plane/test_quota_settlement_cli.py (33) M tests/control_plane/test_scheduler_execution_context.py (8) M tests/control_plane_ts/usage_statistics_goals.test.ts (6) M tests/test_host_loop_activation.py (7) M tests/test_visible_goal_terminal_settlement.py (7)Patch Links:https://github.com/loopx-project/loopx/pull/7841.patch #7841.diff—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!
You are receiving this because your review was requested.Message ID: ***@***.***>
|
loopx-agent
left a comment
There was a problem hiding this comment.
Reviewer: model_agent; gpt-6.1-sol; OpenAI; runtime_reported; reasoning effort: max
动机 / Motivation
已连接本地 Codex App 会话的使用者,希望在当前对话选择宿主原生 Goal 循环。过去本地 App 缺少合法的 codex_app / goal_runtime / interactive 路由;现在显式选择新 profile 后,可沿当前 Goal 读取、收据准入和结算路径工作。
独立验证的是显式 profile 的 CLI 路由与受治理结算,不能据此推断原生宿主已经自动触发或接续执行。本次不替换 automation、不创建第二个调度器、不修改既有可见 Goal,也不宣称长程效果或完整成本改善。维护者关于 automation 能否替代它的提问很关键:一般定时工作继续使用已有 automation 即可,这个增量的价值只在于用户明确选择当前会话的原生 Goal 生命周期;没有证据支持“更自主”或“更省成本”的结论。剩余缺口是原生 Codex App 同一 Goal 的宿主触发、实际工作、结算和后续原生续接,需由具备宿主控制权限的维护者实机核验;本次未完成这项产品资格。
改动思路 / Approach
保留既有 scheduler、native Goal 和 settlement owner,只增加显式宿主元组与归类分支,避免第二个控制循环。本 PR 作为可独立回滚的 profile 集成增量成立;宿主自动续接资格留待有宿主权限的维护者核验,不能拿 CLI 回执替代。最小可行替代是继续沿用 automation;若用户已选择宿主原生 Goal,则把现有 App 元组交给既有控制面比伪装成另一类宿主或新建调度器更准确。profile 只声明路由,不授予执行、恢复或合并权限。
| 显式输入 | 观察到的 LoopX 行为 |
|---|---|
原 --codex-app / onboarding 别名 |
保持 heartbeat |
codex_app_goal |
native Goal prompt、guided --begin-turn、visible-goal 结算 |
| 新 profile + 继承 machine on | full delivery |
新 profile + 显式 --context-delivery on |
明确拒绝,不假装受支持 |
具体改动 / Changes
本次按在先契约 docs/heartbeat-automation-prompt.md 的不可变版本 3503d823256c02bc531558f4a3bc9ea7c963d6eb 审查。Native Goal bootstrap and live execution instructions 要求由实时契约提供工作和结算动作;新 profile 复用该链。Static semantics retained across hosts 保留原目标、完整要求、实际验证、同一 Turn、条件性终止和独立工作边界;没有把一次进展变成新 Goal,也没有把静态文案当作宿主采用证明。
SchedulerRuntimeProfile(execution_context.py:41)在既有 enum 上扩展codex_app_goal,只接受 App/goal_runtime/interactive 元组;差分语义 advisory 的唯一新增候选是这个既有词汇扩展。render_quota_guard_command(project_prompt.py:176)复用一次解析结果,并生成当前 guided admission 入口。既有 heartbeat、SSH、Codex CLI、Ark、Trae、Claude 与 generic CLI 的 14 份完整 stdout/stderr/exit 在固定夹具 base/head 间逐项相等,没有删掉诊断或归一化语义字段。context_delivery_activation(codex_context.py:55)区分继承偏好与显式请求;后者不能因为新 profile 存在就变成受支持。usage host 分类继续归入 Codex App。host_goal_turn_reentry_action(spend_sources.py:49)沿既有 receipt、Todo 与 Turn 身份进入结算;正向用例实际经过 File 和 SQLite,重放保持同一身份且不重复 spend。故意移除 native-host 识别后,公开 prompt 的独立 oracle 失败;恢复原 head 后通过。
| 验证 | 状态 | 结果与范围 |
|---|---|---|
| 完整旧输出对照、新 profile 正反例与 mutation | PASS | 14 完整旧输出一致;明确拒绝冲突/headless/未注册 Agent/显式 unsupported on |
| 新 profile 命名用例 | PASS | 14 项通过,含真实双后端 writeback/spend、重复 spend、缺 receipt、todoless 重入与终止回读 |
| 六个 Python 文件全量 | FAIL | base 534 pass/16 fail/8 skip;head 550 pass/16 fail/8 skip |
| 上述失败归因 | 已核对 | 16 个完整失败签名在仅路径、进程地址及显示偏移规范化后一致;两项 gitless 字典另在双方以 -vv 完整展开;未宣称根因已修复 |
| TS usage / control-plane typecheck / Ruff | PASS | 10→11 项、完整 TS 类型检查、12 个变动 Python 文件 |
| premerge / 公私边界 | PASS(所列范围) | 6 direct+19 selected;16 文件 boundary 子扫描,一条既有非 literal 合成 fixture 警告 |
| 原生 App 自动触发、后续续接;Windows | UNVERIFIED / supplied FAIL | 本轮未操作宿主;保留作者 Windows 五项 WinError 2,不能移作本机通过 |
| 远端 CI | UNVERIFIED | 按当前契约未读取、轮询或等待 |
八项本地 skip 的原因是需要显式 native Codex/loopback inference,未启动这些调用。大范围失败涉及旧 SSH、Trae 文案、gitless 夹具等既有路径;完整失败证据与独立新路径通过证据分别保留。CQR 已按当前完整 scope 记录,通过的收据不代表这些失败消失。
对主干的风险 / Risks
主要风险是把 profile 集成误读为宿主已端到端支持;文档和本审查明确保留了触发、实际工作、结算、后续原生续接的资格缺口。现有自动化不迁移、不改 RRULE、不接管另一条 Goal。安装或发现新 profile 不能代替当前用户选择与实时准入。共享 prompt、结算 owner 与 usage 分类已有实测对照;本次不扩大 PostgreSQL 或新的 provider 路径,也没有把实验结果登记成长期收益。
最新 main 的相邻 context 私有读取缓冲变更不修改这里的 activation/宿主归类规则;本次精确 head 的审查与后续集成、所需平台验证和 merge readiness 仍是独立判断。
我的整体评价 / Verdict
APPROVE,认可可独立回滚的 profile 集成增量,未发现本次 diff 引入的阻塞回归。本 PR 作为可独立回滚的 profile 集成增量成立;宿主自动续接资格留待有宿主权限的维护者核验,不能拿 CLI 回执替代。检查的改动入口为 heartbeat-prompt、quota should-run、refresh-state 和 quota spend-slot;未改变渲染页面。本地原生 Codex App 的宿主 UI、安装态采用和后续自动续接未验证。后续实机资格由有权限的维护者承担;本审查没有执行宿主启用、安装、调度变更或合并。
English verdict: APPROVE at c079c895ea75e54e329efa8471b59b4118d9b1f5; explicit profile integration and governed CLI settlement are covered. Existing broad-suite failures and unverified native-host continuation remain disclosed; this is not merge authorization.
|
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 |
|
以及一个考虑点是automation的表达能力比goal更灵活,比如当需要等人的时候,可以有一些调度周期的退避策略。这块你怎么看?可以调研一下 |
Reconcile the File and SQLite fixture matrix and add managed-claim terminal settlement coverage. Signed-off-by: xiaobaifly7 <196511160+xiaobaifly7@users.noreply.github.com>
loopx-agent
left a comment
There was a problem hiding this comment.
Reviewer: model_agent; gpt-6.1-sol; OpenAI; runtime_reported; reasoning_effort=max.
动机 / Motivation
需要在当前 Codex App 聊天里持续完成一项已授权任务的用户。此前本地 App 的 LoopX 入口只承认定时 Automation;用户主动选择原生 Goal 时,合法的交互式运行组合会被拒绝,或者需要借用另一种 Host 身份。本次让用户显式选择原生 Goal 后,沿用当前聊天的任务、认领和结算规则;定时回访仍使用原来的 Automation。本次不切换默认入口、不迁移已有 Automation、不增加定时唤醒,也不扩大权限。当前可验证增量是 CLI profile 与既有结算链的接入;新增重规划测试仍需修正,真实打包 App 的自动连续运行仍未验证。
维护者提出的“Automation 是否已足够、等待人时能否退避”是合理的产品问题。我核对了官方Scheduled tasks和Long-running work:前者可以定时返回同一聊天,后者提供原生 Goal 的进度及暂停/恢复控制。因此这里的价值仅是支持用户主动选择的交互式路径;定时检查、人或外部依赖的等待仍适合 Automation,不能据此宣称 Goal 更灵活、更省钱或应取代 Automation。
改动思路 / Approach
复用既有 Host 组合、guided admission 和结算 owner,能够接入用户已选的原生 Goal,无需建立第二套调度器或持久化状态。本 PR 的边界是显式 native Goal profile 接入;等待人的定时回访留给 Automation,真实 App 触发与继续运行保留为独立资格。
现有 scheduler tuple 表负责“是什么运行环境”,既有 quota 契约负责“能做什么、如何结算”,App 负责“是否继续原生 Goal”。新的 profile 是不可从安装或收据推断的明确运行意图,没有增加第二个权限来源。render_quota_guard_command 改用既有 native/guided 集合的交集,属于本次已应用的小范围简化;不需要扩大成语言迁移或新调度服务。
| 用户触发 | 路由与结果 | 等待边界 |
|---|---|---|
既有 --codex-app/onboarding |
原 Automation,默认不变 | 定时检查与现有退避 |
显式 codex_app_goal 或对应 tuple |
当前 native Goal;guided Turn;visible-goal 结算 |
blocked 后显式用户 resume;不创建定时器 |
此表据 650c9426c9d5d9b540b024943f7812cd6f183e5f 的源码归纳,不代替实际 Host 运行证据;没有另行验证图形渲染。
具体改动 / Changes
本次重新检查完整 base→head 的 17 文件、+221/-38:7 个生产文件、8 个测试文件、2 个文档/Skill 引用文件。相对已被 dismiss 的旧评审 head c079c895ea75e54e329efa8471b59b4118d9b1f5,当前 head 集成了 main;当前改动范围内五条路径受集成影响,尤其重规划测试从 inline 期待改成了统一 deferred 期待。本次没有继承旧 APPROVE。
审查依据为 docs/heartbeat-automation-prompt.md,固定 spec_revision 214afbb6222c4f0b410a6a1cc084d0262e91925f,采用变更前的契约:NG-LIVE 已接入当前 guard 与真实普通 Todo 结算;HOST-OWNERSHIP 保留 Host 自有继续/恢复和 Automation 的区别;STATIC-AUTHORITY 保留权限、隐私、路径停止及精确身份;REPLAN-VALIDATION 未满足,见下面新增测试失败。
关键代码讲解
scheduler_execution_context_for_runtime_profile将新 profile 解析成codex_app / goal_runtime / interactive;既有--codex-app仍映射 Automation,非法组合继续拒绝。uses_native_goal_host_loop仅让显式合法的 App Goal 进入现有 native renderer,没有启动另一进程或赋予工作权限。render_quota_guard_command为 native+guided 的组合生成--begin-turn;已有 receipt 与新建 Turn 互斥,不能把 batch ID 伪装成 Host 身份。host_goal_turn_reentry_action在 Todo/replan 未绑定 Turn 时先返回 re-entry;后续读取当前结算计划,普通 File/SQLite 的 soft/hard claim、writeback、spend、terminal replay 和 lease release 路径通过。context_delivery_activation使机器级 context-on 对尚不支持 capture 的新 profile 保持 full delivery;显式--context-delivery on仍拒绝不支持的模式。这个差别正是新增测试需区分的 inline/deferred 传输边界。另一个 TS 改动仅把新 profile 汇总到既有codex_appusage 桶。
对主干的风险 / Risks
[P2] 修正新 profile 的重规划测试,保留两种合法传输。 第 6936 行 无条件读取 cli_channel["settlement_identity"],之后又要求 settlement_read_ref 并禁止内联 plan。新 codex_app_goal 使用 full delivery,实际返回的是 cli_channel.settlement_plan.identity,它与 heartbeat_receipt.settlement_identity 一致;SSH 的受支持 capture 才走延迟读取。File 和 SQLite 的两个新增用例因此在真正身份/无副作用断言前抛出 KeyError。这是一处新增验证回归,尚未证明运行时丢失身份。
最小修复是在测试里按真实支持的 inline/deferred 路径分别取当前计划,验证同一个 obligation、Turn identity、步骤与只读恢复;不要为让测试通过而强制开启新 profile 尚不支持的 capture,也不要删除身份断言。随后重跑下面的矩阵,并更正 PR 中“相同四项主干旧失败”的归因:此固定基线的同命令全部通过,而新增 profile 的两项是当前 PR 才有的失败。
| 验证 | 固定基线 | 当前 head |
|---|---|---|
| 六文件 Host/CLI/context/guidance 选择 | 398 PASS、3 FAIL、8 SKIP | 412 PASS、同 3 FAIL、8 SKIP |
| quota 的 visible_goal/begin_turn/guided_start 选择 | 15 PASS | 20 PASS、2 FAIL(上述新 profile) |
| 11 个旧 profile+5 个既有 App 模式的完整 CLI 对照 | 与 head 对照 | 16 组完全一致;保留旧失败诊断 |
| 标准 premerge、typecheck、13 文件 Ruff、TS usage | — | PASS;premerge 19 项选择,usage 11 例 |
重规划复现命令:uv run --extra test python -m pytest -q tests/control_plane/test_quota_settlement_cli.py -k 'visible_goal or begin_turn_rejects or guided_start' --tb=short。三项共同的 format-precedence 失败在两个版本均可复现,真实 CLI 对照也保留相同的 decision-output-root/thin 诊断;它们没有被改写为 PASS。8 项平台/Host 跳过也不算通过。未访问、轮询或等待远端 CI。
语义与 CI 对齐
这次扩展的是既有 SchedulerRuntimeProfile 词汇;diff advisory 识别到一个新值,不代表自动验收。类型与现有 owner 归属合理,未引入 substring 分类、领域专用强制工作或默认自动启用。16 组对照只归一等长合成路径与 checkout/venv locator,保留全部字段、正文、计数、错误和 remediation。profile 发现、机器安装和已写收据都不构成启动 Goal 或拓权的授权。
本次 exact-scope change-quality receipt 保留 FAIL:新重规划断言失败,原始宽选择的三项共同旧失败也保持 failed;没有把必需验证或严格 receipt 门改写为通过。
我的整体评价 / Verdict
REQUEST_CHANGES,针对新增 File/SQLite 重规划测试的错误传输断言及验证归因。整体设计是合理且可回滚的 profile 增量,默认 Automation 和旧 Host 的输出有对照证据;无需为这个修复另建调度器或完成整个 Host 路线图。
长程普通 Todo 的验证、写回、记账、重放和 lease 释放有实际测试;Todo-less 分支的新增验证仍中途失败,不能宣称该分支资格已完成。用户可在既有聊天主动选择 Goal,这条交互边界清楚;等待人的周期回访和退避仍留给 Automation。已检查 heartbeat CLI、Host 适配与文档加载路径;本次不修改页面、布局或原生 App 控件。未验证打包 App 的 Goal 触发及自动继续运行,未将 CLI 收据称为 Host 采用。实际 Host 资格需要“原生触发的 Turn→获准工作→写回与结算→同聊天后续继续”的连续证据;Windows 和效率收益也仍未验证。保留现有维护者评审意见,本结论不提供 dismiss、merge 或安装授权。
English verdict: REQUEST_CHANGES — head 650c9426c9d5d9b540b024943f7812cd6f183e5f adds a well-scoped explicit native Goal profile, but its two new File/SQLite replan cases assert deferred-only fields against a valid inline plan and fail. Legacy CLI parity and ordinary settlement checks pass; packaged Host continuation remains unverified.
| assert replay.get("unsettled_host_turn_recovery") is None | ||
|
|
||
|
|
||
| @pytest.mark.parametrize("runtime_profile", ["codex_app_ssh_goal", "codex_app_goal"]) |
There was a problem hiding this comment.
[P2] 新增的 codex_app_goal 使用 full delivery,bound CLI 实际返回 settlement_plan.identity,与 receipt 身份一致;下面第6936行却统一要求 deferred-only 的 settlement_identity,随后还禁止 inline plan。File/SQLite 两个新增用例因此在实际身份与只读恢复验证前 KeyError。同命令固定基线15项全过,当前20过/2失败,这两项不是主干旧失败。请按支持的 inline/deferred 路径分别取计划并保留同一 obligation/Turn、顺序和无副作用断言,再修正 PR 的失败归因;无需强开尚不支持的 capture 或删除身份检查。
|
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 |
A user can run a long task in the current Codex App chat through its native Goal, but LoopX previously accepted the App host only through heartbeat automation. This PR adds the explicit
codex_app_goalprofile forcodex_app / goal_runtime / interactive, reusing guided admission, the native Goal prompt, existing Todo claims and lease rules, andvisible-goalsettlement. Existing--codex-apponboarding keeps the heartbeat route.Goal and Automation boundary
Automation remains the route for scheduled checks, human or external waits, and a cadence that needs to back off. Codex scheduled tasks can revisit an existing chat with a custom recurrence rule. Native Goal mode serves an explicitly started interactive task in that chat with visible progress and pause/resume controls. This profile adds no scheduler or timed wake. A Goal blocked on a person or external service waits for user resumption; a separately configured Automation can handle later checks. We do not claim Goal is more flexible or efficient, and this PR neither migrates Automations nor changes the default route.
Validation and limits
The updated branch incorporates current
mainthrough a signed merge commit. On the integrated tree, 268 focused Python tests passed across settlement guidance, scheduler context, and visible Goal terminal behavior. Eleven usage-statistics TypeScript cases, the control-plane typecheck, Ruff on 13 changed Python files, and the quick premerge gate (six direct and four selected checks, including the public-boundary scan) passed.The current
mainhas an unrelated failing replan test: both File and SQLite variants expectinteraction_contract.cli_channel.settlement_identity, which is absent from the returned packet. The expanded matrix on this branch fails in the same four variants, including the new profile. This existing failure is disclosed, not counted as a pass or fixed here.CLI checks establish routing and governed settlement. Automatic host-triggered continuation in a packaged Codex App remains a separate end-to-end qualification. Existing Windows subprocess tests using the POSIX
scripts/loopxlauncher do not qualify that host behavior.