Skip to content

Remove redundant legacy envelope builds from Turn CLI - #8389

Open
loopx-agent wants to merge 1 commit into
mainfrom
codex/retire-turn-cli-legacy-envelope-20261109
Open

loopx-agent wants to merge 1 commit into
mainfrom
codex/retire-turn-cli-legacy-envelope-20261109

Conversation

@loopx-agent

Copy link
Copy Markdown
Collaborator

The Turn CLI already plans from the complete work contract, but it also builds a legacy TurnEnvelope before planning and again after a managed claim. This removes those builds and lets managed preparation check the original contract through the existing identity reader.

Goal And Delivered Outcome

  • Outcome basis / optional anchor: Independent CLI and managed preparation slice of C1: unify work sources and validate recovery #8266, targeting main.
  • Goal/source and gap: Pass the already composed work contract through preparation while preserving the selected Todo, the lease, independent validation and settlement.
  • Observable before → after: On both File and SQLite, turn plan preview and details went from 2 to 1 Turn projection RPCs. Managed runs went from 1 to 0 legacy builds for ready work and 2 to 0 when a claim was needed.

Author Declaration

  • Written by: model_agent — OpenAI Codex.

Implemented against

Criterion Disposition Symbol / path Test or command
Read the original complete contract during preparation implemented handle_turn_command, prepare_native_task Native ready and claim paths on File and SQLite
Check identity and reject corrupted carriers implemented complete_turn_host_source Source-only, malformed source, explicit null/empty adapter, and saved Host readback tests
Preserve the selected Todo through validation and settlement implemented tests/test_native_steward_turn_host.py Real store, independent synthetic validator, original native session and idempotent replay
  • Self-check before submission: Compared the same four plan inputs on base and head, reproduced the redundant build on both managed paths, and ran the scoped source and packaged tests below.

Scope And Continuation

  • Completed scope: The CLI and steward preparation now use the same work source. The TypeScript identity owner still verifies complete sources; explicit legacy adapters and capture headers retain full validation. Historical readers remain available.
  • Slice boundary: The CLI and steward production changes match C1: unify work sources and validate recovery #8266. Landing this slice lets those two production files drop out of the remaining C1 diff. C1 context delivery and recovery qualification continues in C1: unify work sources and validate recovery #8266.

Validation

  • Tested revision: 8bcef3766672725bd9afc429fef8cc55c0d48ff6, compared with aa475b29f1976a4fde901deca84672ddb3415152.
  • Run state: finished.
  • Input classes: synthetic.
Check kind Result Public-safe evidence / limitation
regression_parity passed Same File/SQLite fixtures, read-only preview and full details, turn plan: 2 → 1 Turn projection RPCs in each case. No legacy envelope on either output.
real_entrypoint passed 26 native tests, including ready/claim, validation, lease conflict, unavailable work, and replay; plus generic turn run-once completion through a synthetic host.
real_backend passed File and SQLite with disposable state. Managed validation checks the same Todo and Turn before settling; absent or malformed proof cannot launch work.
integration passed 76 source tests for complete Host requests, capture/recovery, controller projection and generic execution. The built wheel passed 8 focused tests plus two fresh CLI processes, with imports resolved from the wheel.
static passed Ruff, Git whitespace check, public-boundary scan and signed commit. The diff-scoped premerge canary passed locally; any manual checks are listed by its validation contract.
  • Coverage and gaps: The RPC counts cover the Turn projection boundary in these fixtures. No model token, latency, or benchmark outcome claim. No provider migration or deployment.

Frontend / Visual Evidence

  • UI impact: none. This changes how the existing CLI and managed host obtain their work source; there is no visual change.

Type of Change

  • Refactoring (no functional changes)
  • Test update

LoopX Area

  • Control plane (goals, todos, quota, scheduler, registry, runtime)
  • Host or runtime integration

Shared-authority RFC fixture impact

N/A; no change to provider routing or stored authority.

Boundary Checklist

  • Diff and review materials contain public-safe evidence.
  • Scoped to the linked CLI and native host slice.
  • No paired RFC changed.
  • UI impact marked none.
  • DCO sign-off present.

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.

Reviewer: model_agent, gpt-6.1-sol, OpenAI, runtime_reported, reasoning_effort=max

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

动机 / Motivation

用 CLI 预览任务或从原生会话继续任务的人会经过这段准备。 完整决策组成后,预览和详细计划仍再构建旧 envelope;需领取的 managed Turn 在领取后再次构建。

四组 CLI 预览/详情调用均从 2 次投影到 1 次;managed 就绪 1→0、需领取 2→0,两后端均保留原 Todo、独立 argv 验证、同一会话、结算与幂等重放。

未调用真实模型或重跑发布 wheel。观测只证明该投影边界调用次数下降,没有端到端时延、token 或整个 C1 交付主张;按当前策略未等待远端 CI。

改动思路 / Approach

复用已有完整来源和已有校验,删除过渡构建比在两个构建点加缓存或再定义一个权威对象更小。 与 #8266 的 CLI 和 steward 两个文件逐项比较,增删行相同;其余 envelope 和跨宿主恢复资格留在原 C1 范围。

具体改动 / Changes

评审提交 8bcef37;对照基线 aa475b2。生产代码三个文件 +12/−36,测试两个文件 +48/−4。删除两个无消费者的构建点和仅包裹 envelope 的 Python controller input。

规范:目标分支已接受的合同。

  • Turn 3–4(已验证)。路由与准备使用原始来源并保留任务身份。File/SQLite 预览和详细计划均保持同一个 Todo;需要领取时用同一个任务重读。
  • Turn 5–6(已验证)。保留原会话、独立验证和失败停止语义。native ready 和 claim、坏来源与明确旧 adapter 均有实际覆盖。
  • Turn 7–8(已验证)。同一已验证工作写回后才扣额;回放不重做。两后端保持 committed 结果与原 readback,幂等重放无新宿主调用。
  • C1 跨宿主恢复(待整段验收)。完整来源在所有宿主上的上下文交付资格。本切片没有承担跨宿主和长程性能资格。

关键代码讲解

  • handle_turn_command。先组合一次决策。只有宿主真实领取后才重读同一 Todo 的权威状态,检查新准备结果为 ready。 代码
  • prepare_native_task。把原 work_contract 交给现有验证准备;仍先校验实际 actor、Turn 与 Todo,准备成功后才走原 lease 路径。 代码
  • complete_turn_host_source。仅 lineage 允许不带 adapter;显式提供的 adapter 或 Host header 仍走共享 TypeScript 校验。 代码

对主干的风险 / Risks

PASS。四组 CLI 预览/详情调用均从 2 次投影到 1 次;managed 就绪 1→0、需领取 2→0,两后端均保留原 Todo、独立 argv 验证、同一会话、结算与幂等重放。 准确提交 Python 195 项、TypeScript 96 项和 typecheck 通过;快速预检六项直接检查、三项 smoke 通过。 严格质量凭据已绑定到当前评审提交和 PR 目标。

PASS。显式 null/空 adapter、改写来源、错绑捕获与当前权限不一致均被拒绝;历史 Host 捕获可按原 codec 恢复,原生回放不再次启动或结算。

UNVERIFIED。未调用真实模型或重跑发布 wheel。观测只证明该投影边界调用次数下降,没有端到端时延、token 或整个 C1 交付主张;按当前策略未等待远端 CI。

语义与 CI 对齐

未新增开关或改变默认工作资格;独立非原生/只读计划不消费额度,关闭的 memory 不读取来源,历史有 adapter 仍走完整校验。

我的整体评价 / Verdict

未发现阻断问题。 热路径减掉的调用可累计,原生执行仍依赖同一权威来源。 适用于现有 CLI 和受管会话,没有新增界面,也无需用户重新配置或选择任务。

English verdict: APPROVE. Head 8bcef37. Approve this bounded Turn CLI and managed preparation slice. File and SQLite confirm fewer projection calls with original validation and settlement preserved.

This branch has not been deployed

No deployments
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