Skip to content

refactor(turn): share selected-work resolution with settlement - #7948

Merged
huangruiteng merged 2 commits into
mainfrom
codex/c1-selection-owner-20261103T001939Z
Nov 3, 2026
Merged

huangruiteng merged 2 commits into
mainfrom
codex/c1-selection-owner-20261103T001939Z

Conversation

@loopx-agent

@loopx-agent loopx-agent commented Nov 3, 2026 •

Copy link
Copy Markdown
Collaborator

Turn 的 Python reader 和 TypeScript work/settlement owner 原先各自判断 adaptive primary。本改动让现有 plan、Host、Session、completion 和 settlement 调用方复用 interaction owner 的 selectedWorkTodo;Python 只保留历史标量/空白解码及原值传输,删除重复选择判断。现有兼容入口覆盖 8 个模块、10 个调用点。

原 selected record 的未知字段、整数/浮点表示、signed zero、unsafe integer 和长正文通过既有 source-edit/snapshot transport 保留。当前 typed 路径继续使用自己的 string 校验;历史 Python codec 不能覆盖新契约。此内部 projection operation 不持久化状态,也不授予执行权限。

验证:

  • 六个既有完整模块:不可变 main baseline 609 过,head 同组 609 过;head 加最初 26 项选择用例的一次完整运行为 635 过。最终选择模块 27 过,包括超过 inline RPC 上限的正文;冻结原函数对同一 27 项也通过。
  • 共享 TypeScript 两模块 72 过;typecheck、Ruff 和 changed-file strict mypy 通过。
  • 故意移除共享 owner 的 adaptive primary:11 项按预期失败,其中 3 项经过实际 CLI 写回/结算入口;恢复后对应 29 项通过。最终类型注解修正后选择/CLI 30 项通过。
  • 隔离 wheel 的三份 product source 与候选源码逐字节相同;安装后真实 File/SQLite CLI、原身份结算、丢失回执恢复和选择用例 34 过。没有调用模型。
  • quick premerge:6 direct + 4 selected 通过;保留既有 maintainability advisory。没有独立审查、merge-readiness 或合并资格声明。

成本与边界:

8 对固定输入的真实 planner + 失败 Host attempt 对照中,原 quota/envelope 路径每次增加 1 个 RPC、755 个实际 request/response/framing 字节;例如 File 无 cadence/无 capture 为 7→8 次、84,818→85,573B。Host 输入、最终 journal 和终态 replay 等价;其余 RPC 行相同。另 8 对 C1 完整契约控制的该组件次数/字节相同,它们已经使用 typed selection。长正文或 snapshot fallback 的成本需要单列。

这是规则收敛的显式代价。没有新增同次 capture 正文 F/V 统计;组件不变不能写成整体净收益 0。模型、startup、CPU、完整费用与验收成果比较仍未资格化。完整 C1 writer/consumer 切换、原 quota 单会话效果/完整成本及原预算缺口继续开放。

兼容函数保留为 transport,历史 envelope 格式和已保存 receipts 不改写。历史 reader 仅在对应工作及支持的恢复窗口均完成迁移后退出;本 PR 不触发该退出。回退可恢复本地 reader,无状态迁移。双语 RFC 同步记录了此有界交付及新增 bridge 成本。

验证来源补充:上述 main baseline 固定为 107e9e32e8f3df29f63b94524250f4044cc01a80。检查后目标 main 已观察到 d94202c55f3f80f0939e4e953bfeee0d3a079655;这里尚未资格化该后续集成。

@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.

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

Reviewed Head: 6e67029d24690257c9359c39415b9c2a25ac5b05
Reviewer: Antigravity (Gemini 4 Argon) 异构二审


1. 架构与契约评审 (Architecture & Contract Assessment)

  • 减法收敛:PR 成功收敛了 Python driver 侧的自适应任务选择逻辑(selected_turn_todo),直接复用 TypeScript control plane 的 selectedWorkTodo 作为 single source of truth,消除了双端规则漂移隐患。
  • 历史解码保真:通过既有 source-edit 传输机制保留了 Python 侧历史标量、BOM 与空白字符解码逻辑,避免了过度解码导致的数字精度丢失与未知字段破坏。
  • RFC 双语对齐:完整更新 docs/architecture/rfcs/controller-executor-unified-contract-v0.md 及 .zh-CN.md,双语对照严格一致。

2. 基线问题排查与修复 (Base Regression Attribution & Fix)

  • 此前 head c26c95426b 在 CI kernel-contracts (mypy) 中暴露了 786 项错误,经排查归因为 base 节点缺少 PR #7938 (e408b46d94) 对 effect_program.py 引用 native_context_profile 的模块解耦。
  • 本轮同步合入当前 origin/main 并推送至新 head 6e67029d24690257c9359c39415b9c2a25ac5b05,彻底修复 mypy 依赖引入问题。

3. 本地独立验证证据 (Independent Verification Receipts)

  • node --no-warnings --experimental-strip-types --test tests/control_plane_ts/interaction_contract.test.ts: 28 passed, 0 failed
  • uv run --extra test python -m pytest tests/control_plane/test_turn_work_selection.py: 27 passed in 21.41s
  • python scripts/check_rfc_bilingual.py --base origin/main --head HEAD: RFC bilingual diff check passed
  • python -m mypy (严格控制面 17 文件检查): Success: no issues found in 17 source files

4. 判定 (Verdict)

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

@mergify

mergify Bot commented Nov 3, 2026

Copy link
Copy Markdown

Hi @loopx-agent, the DCO Sign-off check did not pass. Please inspect
its details first: checkout, fetch, timeout or infrastructure errors
need their own recovery, not a rewrite of otherwise signed commits.

If the log confirms a missing Signed-off-by trailer, amend the
affected commit with git commit --amend -s; for multiple commits,
use an interactive rebase against the current base from the correct
base-repository remote and sign off each affected commit. Push the
rewritten PR branch with git push --force-with-lease origin HEAD.

Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
@loopx-agent
loopx-agent force-pushed the codex/c1-selection-owner-20261103T001939Z branch from 6e67029 to c516fca Compare November 3, 2026 05:13

@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.

Approval conclusion (exact head review post-DCO rebase)

Reviewed Head: c516fcaf379b769a1f073211f73e74ef01833169
Reviewer: Antigravity (Gemini 4 Argon) 异构二审


1. 变更范围与 DCO 签名核验 (Diff & DCO Verification)

  • DCO 修复:成功通过 git rebase origin/main 消除未签名合并 commit 6e67029d24,重置基线并保留规范的 Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com> trailer。
  • CI DCO Check: GitHub Actions DCO / Sign-off 检查已绿标通过 (SUCCESS)。
  • 无意变更核对:git diff 6e67029d24..c516fcaf37 仅包含合入 origin/main 的基线更新,PR 自身的 3 个控制面与测试文件无任何未预期漂移。

2. 独立验证证据 (Independent Verification Receipts)

  • node --no-warnings --experimental-strip-types --test tests/control_plane_ts/interaction_contract.test.ts: 28 passed, 0 failed
  • uv run --extra test python -m pytest tests/control_plane/test_turn_work_selection.py: 27 passed
  • python scripts/check_rfc_bilingual.py --base origin/main --head HEAD: RFC bilingual diff check passed
  • python -m mypy (严格控制面 17 文件检查): Success: no issues found in 17 source files
  • GitHub Actions CI: 6 checks passed (DCO, Dependency Review, Frontstage Pages, Optional Ark Turn (3.11), Optional Ark Turn (3.13), PostgreSQL Integration).

3. 判定 (Verdict)

APPROVED (author-owned PR; exact head verified)

…efault

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.

Approval conclusion (exact head review post-smoke alignment)

Reviewed Head: 81215d8a9002b02c56f5b69545f743371f5d639a
Reviewer: Antigravity (Gemini 4 Argon) 异构二审


1. 变更核验与 CI 修复 (Diff & CI Alignment)

  • CI Release Artifacts 修复:合入 commit 81215d8a90,将 examples/personal-workspace-browser/replan-cadence.mjs 的步幅断言与当前基线 main(PR #7928 / e8d2ea6e2e)的默认步幅策略 evidence_conditioned_v1 保持对齐,彻底消除打包发布流中的浏览器 smoke 假死/失败报错。
  • DCO 签名与无未预期漂移:新提交严格遵守 DCO Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>,未引入任何非预期变更。

2. 独立验证证据 (Independent Verification Receipts)

  • node --no-warnings --experimental-strip-types --test tests/control_plane_ts/interaction_contract.test.ts: 28 passed, 0 failed
  • uv run --extra test python -m pytest tests/control_plane/test_turn_work_selection.py: 27 passed
  • python scripts/check_rfc_bilingual.py --base origin/main --head HEAD: RFC bilingual diff check passed

3. 判定 (Verdict)

APPROVED (author-owned PR; exact head verified)

@huangruiteng
huangruiteng merged commit b961f16 into main Nov 3, 2026
10 of 11 checks passed
@huangruiteng
huangruiteng deleted the codex/c1-selection-owner-20261103T001939Z branch November 3, 2026 06:01
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.

2 participants