Skip to content

Skip inactive Anti-Entropy validation in turn context - #8286

Open
huangruiteng wants to merge 1 commit into
mainfrom
codex/skip-inactive-turn-context-hook-20261107
Open

huangruiteng wants to merge 1 commit into
mainfrom
codex/skip-inactive-turn-context-hook-20261107

Conversation

@huangruiteng

@huangruiteng huangruiteng commented Nov 7, 2026 •

Copy link
Copy Markdown
Collaborator

Change

Skip the Anti-Entropy turn-context registration and result validation when the provider declares no readback slots. Enabled tasks still publish their validated result, including when no retirement targets apply. Reward Memory keeps its existing registration and validation path.

Evidence

  • Fixed CLI replay with an isolated File and SQLite provider, progressive reads enabled and delta set to auto. The SQLite admission goes from 137 to 135 RPCs and from 616,362 to 553,548 RPC bytes (−10.2%). Including startup, three saved-context reads, a wrong-digest refusal and a retry of the same capture, total RPC bytes go from 1,022,128 to 959,271 (−6.1%). Guard stdout is 339 bytes in both arms.
  • Source checkout: 91 Python cases and 19 TypeScript cases passed. Isolated wheel: 16 cases passed for inactive, enabled, active and recovering Anti-Entropy and real CLI Reward Memory coverage.
  • Standard local premerge passed all 6 direct and 18 selected checks on the same head. The first run hit the semantic-vocabulary timeout, and both the standalone check and a full retry passed.
  • The replay measures internal transport on a fixed synthetic task. Model usage and whole-task outcomes require separate validation.

Base tested 32167518b3c2646fd9b6a3a6e0aaf74b258a7b70.

Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>

@loopx-agent loopx-agent left a comment

Copy link
Copy Markdown
Collaborator

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

动机 / Motivation

通过 heartbeat 或托管 Turn 继续工作的 Agent 需要在每轮收到当前 Todo 的指引。原实现即使在普通 Todo 停用 Anti-Entropy 时,也会解析工作区并验证一个空 hook。改动后的普通轮次保持任务选择和输入含义,并少走两次 Effect 调用。显式声明退役目标的 Todo 仍能完成检查、修正和交付验收。本次范围限于现有上下文组装及退役检查路由。真实模型是否采用指引,以及长程运行的端到端成本,仍需独立观测。

以 32167518b3c2646fd9b6a3a6e0aaf74b258a7b70 的 loopx/capabilities/anti_entropy/README.md 为准。Single-Task Feedback Loop (Default-Off) 要求显式、任务级启用,且失败应推动下一次修正。Source Binding And Evidence Rules 要求用声明的工作区验证符号确实退出。Boundaries 将只读 inspect、verify 和最终 change-quality 验收分开。以上三项均在当前提交有对应运行证据。

改动思路 / Approach

这个 PR 在两个现有入口共用的组装点跳过停用的 Anti-Entropy hook。保留提供者对任务启用的判断,并复用现有 readback slot 和 Effect 校验,足以消除空调用。直接在两个入口分别检查启用条件会重复解析任务范围。仅在 hook 内跳过 workspace 查找则仍会传输和校验空的结果。这里保留 Reward Memory 和已启用的 Anti-Entropy 对同一 dispatch owner 的使用,停用分支复用已存在的空 slot 表达。

具体改动 / Changes

  • anti_entropy_context_registration 先解析已有的任务级 basis 与 typed enable。停用时省略 workspace 查找。已启用而没有目标时保留 enabled=true, applicable=false 的 readback,供调用者区分停用和当前任务不适用。含退役目标时,仍产生源绑定、只读 inspect 描述和 delete-first 指令。
  • attach_turn_context 始终组合 Reward Memory,Anti-Entropy 有 readback slot 才进入 dispatch_turn_context_hooks。quota should-run 和 turn run-once --execute 继续复用这个入口。README 与 capability catalog 更新分派描述。描述符仍作为上下文数据投影,调用者通过既有 CLI 执行只读检查,最终验收由 change-quality 处理。
  • 同一组真实 File/SQLite guard 样例分别走停用、Goal 仅声明可用、启用但无目标、普通 note 含 target_symbols、当前 Todo 声明 namespaced basis,以及关闭原测试轮次后在同一个 Goal 新建普通 Todo。两版本的选择、readback、指引和扣额结果逐项一致。SQLite 普通停用样例中,Effect 调用由 85 次降至 83 次,观测到的参数与响应 JSON 合计由 402,916 B 降至 349,407 B。启用路径的调用数和 JSON 体积相同。装入隔离环境的 wheel 也通过了 SQLite guard。
  • 显式审计保留旧符号时,inspect 以退出码 0 返回 AE001 和进展事实,verify 以退出码 1 拒绝。把同一失败事实送回上下文后能读到 recovering 与先修正再交付的指令。删除定义后,inspect 报告可继续交付,verify 退出 0。源码与 wheel 的真实确定性 host 请求分别核对停用、启用无目标、显式启用三种情况,重入沿用既有结算且没有第二次扣额。

对主干的风险 / Risks

风险集中在共享分派点把「启用但没有目标」误判为停用,或让 Goal 级可用性、普通字段和其他任务的退役意图越过任务范围。配对 guard 和实际 host 请求同时检查这些输出,Recovery 探针以真实审计返回值触发纠正路径。workspace 缺失和只读检查失败仍由原有检查路径给出诊断。Review 期间对实际主干的合并树保留同样六个文件的改动,直接验证了 Python、TypeScript 和 CLI 入口。仓库工作流指定范围的 Ruff、改动文件 Ruff、TypeScript 类型检查、132 项定向 Python、30 项真实 Turn CLI 以及 17 项定向 TypeScript 检查通过。标准 premerge 为 6 项直接检查及 18 项所选检查通过。额外全仓 Ruff 在同一命令下报告相同的 133 条完整归一化诊断,均落在六个改动文件之外。托管 CI 仍是独立的合并信号。

语义与 CI 对齐

这是既有上下文、任务范围和验证契约的复用。变动是分派条件和相应说明,typed enable、公开字段、审计结果与下游 gate 沿用原有定义。

我的整体评价 / Verdict

批准这个 head。从长程执行看,已验证的收益是每次停用时少两次校验,且在首个任务启用后,新普通任务仍按原路径可执行。对用户和 Agent 的交付体验,普通入口无需追加配置或确认,显式审计继续提供可操作的修正反馈。实现只在共享组装点使用已有字段,当前变更规模与重复开销相称。JSON 体积是上述固定工作负载的观测,真实模型采用、整轮时延与完整长期成本仍未验证。合并状态由 GitHub 和既有门禁独立决定。

English verdict: APPROVE for efce6cb9ce370df721e49ea98918e61edb14396c. Paired source and installed-wheel checks preserve task-scoped opt-in, read-only audit recovery, and host settlement behavior. Inactive turns skip two Effect calls. Hosted CI and merge authorization remain separate.

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.

2 participants