Skip to content

fix(scheduler): require current App host readback before ACK - #6259

Merged
huangruiteng merged 4 commits into
mainfrom
codex/scheduler-current-host-ack-20261012
Oct 11, 2026
Merged

huangruiteng merged 4 commits into
mainfrom
codex/scheduler-current-host-ack-20261012

Conversation

@loopx-agent

Copy link
Copy Markdown
Collaborator

A Codex App scheduler ACK could record the requested cadence even while the matched heartbeat still had its old cadence. That left the scheduler ledger claiming an update the host had not applied. The existing typed scheduler now requires a fresh matching host observation before migration, identity reset, replay or persistence; native receipt-bound commands and the Python compatibility adapter re-read the matched App heartbeat.

The repair belongs to the existing scheduler owner and reuses rrule_mismatch. Python only adapts the existing host metadata reader. Failure-command receipt binding and ordinary non-host-match ACK behavior remain intact. The RFC records the host qualification boundary; existing CLI smokes now isolate a synthetic matching manifest instead of asserting an unobserved update. No new capability, setting or frontend interaction is introduced.

Validation:

  • 72 focused Python cases and 43 TypeScript cases passed, including mismatch/missing observation, stale receipt, identity reset, replay/CAS, failure binding and legacy ACK coverage. The new negative Python cases failed against the baseline before the fix.
  • With the actual Codex App API and disposable canonical File and SQLite Goals, an ACK before the host update was rejected; applying a 30-minute wait and then a 3-minute recovery produced matching readback and ACK. Synthetic quota stayed at zero, and the disposable automation was deleted.
  • Risk-selected premerge passed all 19 selected checks, including full semantic vocabulary and public boundary scans. Initial old ACK smokes were repaired; a concurrent fixture edit was detected by the first run's tracked-file guard, so the final run uses a stable tree.

This qualifies source behavior and the host apply/readback boundary. Installed-runtime adoption, elapsed timer wakes/backoff progression and pre-model admission remain separate acceptance. This runtime change is proposed for maintainer merge.

Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.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>

@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=xhigh

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

评审 head:eca707a1240673b6e2f1640fb9289d74a9e177e6。未发现阻塞合并的代码问题;安装采用和实际计时唤醒仍是明确的独立验收缺口。

动机

通过 Codex App 管理 heartbeat 等待与恢复周期的调用者。宿主定时任务仍为 60 分钟,调用者声明已应用 30 分钟,旧 ACK 却记录成功。现在读回真实周期并拒绝这种虚假成功;真正更新后仍能提交,并在等待解除后恢复 3 分钟。已通过真实 App API、可丢弃 File/SQLite Goal 验证:不匹配时无状态写入,更新后的匹配 ACK 成功,恢复后再次读回不再要求重复应用。本 PR 不激活新能力、不改前端交互、不声称防止模型启动扣费。本机安装采用、经过等待周期的实际 timer 唤醒/退避递增以及 pre-model admission 仍需独立验收。

改动思路

复用现有 Host metadata reader 和 typed commit,在两条可达调用路径上修复同一不变量,不新增 scheduler 状态或平行 Python 决策。本批交付已有 scheduler 的真实 Host ACK 不变量;保留安装采用、计时唤醒与 pre-model admission 的验收边界。 Console 的 receipt-bound fastpath 和显式 Python CLI 是两个真实入口,都先取得当前宿主事实,再交给同一个 TypeScript commit owner。调用者声明的目标 RRULE 只是目标;旧 hint 记录的是更新前的观测,不能证明更新已经发生。新检查放在原 Turn receipt freshness 之后、legacy migration、reset、replay 和写入之前,失败返回明确冲突。Host IO 失败不变成工作许可;原 quota 和任务权限边界保持独立。

具体改动

规范依据:docs/architecture/rfcs/automatic-execution-admission-v0.md,不可变 revision c51ec1a60671edb8ef536ef0651836b9d7642878。按原 accepted 文本审查:App honesty 已实现,缺失/不匹配事实必须拒绝;M2 的计时器唤醒、hook 与安装采用资格继续 deferred。新增 RFC 段落解释现有义务,不能作为独立验收 oracle。

关键代码讲解

  • entrypoint._native_scheduler_followup_argv(63):仅在现有 bound Codex host-match ACK 上调用已有匹配 reader;通过既有最后值优先参数传入当前周期,覆盖手工声称的观测。缺失时传空,由 typed owner 判断。
  • build_scheduler_followup_payload(82)及 record_quota_scheduler_ack_for_decision(284):兼容入口读实际 Host,移除 Codex 把 applied target 当观测的分支,向共有 native effect 传 observation;Trae 和失败命令保持各自既有语义。
  • requestFromArgs(192):ACK 使用本次观测而非冻结 hint;failure 仍严格校验原 target/observed 配对,不拿新事实伪造旧失败。
  • evaluateSchedulerHeartbeatCommit(822):对 host-match ACK 检查标准化后的实际/声明周期相等,复用 rrule_mismatch,在状态迁移和 reset 前拒绝;receipt freshness、CAS、阶段递增、重放及旧 ACK 规则继续生效。

全部 15 个路径已审查:5 个运行时入口/owner,6 个测试文件,3 个已有 smoke/fixture,1 个 RFC。新增负例覆盖“未更新”和“无匹配 Host”;已有成功/reset/failure fixtures 显式提供实际观测。两个 smoke 用独立临时 manifest,环境退出后恢复;这类 synthetic 读回只证明 transport,不代替真实 App API 证明。

对主干的风险

基线合法路径分别通过 68 Python 和 41 TypeScript 用例,当前通过 72 Python 和 43 TypeScript;新增公共 CLI 负例在基线两项失败,在 head 通过。真实 App API 搭配可丢弃 canonical File/SQLite 后端,验证未应用时拒绝、30 分钟等待的更新/读回/ACK、等待解除后的 3 分钟恢复和随后稳定读回,synthetic quota 保持零,测试 automation 已删除。

最终 canary premerge --from-git-diff 19 项全部通过,包含语义全树、预算、monitor、CLI 和 public boundary。第一次两个旧 smoke 的假观测已修复;初次 runner 检测的三条 tracked side effect 正是当时并发编辑的 fixture,固定树重跑后无副作用。未松动限额或删除断言。按当前 review packet 的 wait_for_ci=false,不查询/等待远端 CI。当前 main 新增 content-ops/periodic-report 输入边界,未改本 PR 的 scheduler 调用族、reader 或 owner;head 仍是上述 revision。

语义与 CI 对齐

复用现有 vocabulary、observation 字段和 typed owner,开发 advisory 没发现新的受支持 vocabulary carrier,完整语义检查通过。错误文本保持目标无关。这里是机器强制的 ACK 不变量,不能称为可忽略 guidance。没有新增 opt-in/default-off 能力;非 host-match、Trae、failure 和原 receipt/CAS 路径的合法覆盖保留。Host metadata 仍是同一 OS 用户的可信输入,不是跨用户认证;不提供新权限、工作 claim、quota spend 或模型启动保障。

我的整体评价

APPROVE:这是 justified_increment,真实 Host 事实到 ledger 的不变量形成了完整可回滚结果。long_horizon 与 user_experience 均 improved:重复 ACK/reset 依旧受 receipt/CAS 约束,调用者仍走已有 update/readback/ACK 操作,新增诊断让虚假成功可见,没有增加手工同步状态或交互确认。复用现有 Host metadata reader 和 typed commit,在两条可达调用路径上修复同一不变量,不新增 scheduler 状态或平行 Python 决策。本批交付已有 scheduler 的真实 Host ACK 不变量;保留安装采用、计时唤醒与 pre-model admission 的验收边界。

已做相关未来重构检查:直接复用现有 reader、字段和单一 typed commit,不新增 Python 规则 owner 或新协议层。当前两个入口有真实调用者,保留兼容是有证据的;更广的 Python 退役与 timer-to-hook 资格不应夹进本修复。本机安装采用、经过等待周期的实际 timer 唤醒/退避递增以及 pre-model admission 仍需独立验收。本运行时 PR 留给维护者合并,本评审不授予 merge/bypass 权限。

English verdict: APPROVE - eca707a; current host readback now gates ACK before mutation; baseline legal-path parity, 72 Python/43 TypeScript/19 premerge checks and real App File/SQLite apply-readback-recovery passed. Installed adoption and elapsed timer/pre-model qualification remain separate.

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