Skip to content

fix(quota): retain runnable admission timers on reentry - #7199

Merged
loopx-agent merged 1 commit into
mainfrom
codex/admission-time-wait
Oct 24, 2026
Merged

loopx-agent merged 1 commit into
mainfrom
codex/admission-time-wait

Conversation

@loopx-agent

@loopx-agent loopx-agent commented Oct 24, 2026 •

Copy link
Copy Markdown
Collaborator

An advancement Todo whose timer expired before work admission can pass its first guard, then immediately become writeback-only on reentry before producing a result. The recovery owner previously treated every external timer as a later wait.

Retain two scalar resume/readiness facts at the first positive admission and compare them in the existing TypeScript wait owner, using the shared microsecond timestamp codec. An unchanged timer already satisfied at admission continues under the original binding. Newly authored or changed waits, including already-due ones, retain original-result closeout; missing or malformed historical facts keep conservative recovery. Requalification preserves the first positive facts. Clocks, identities, gates and single-debit settlement stay intact.

Validation at 9eb51c208c19de0d7af23fb582a4a763ac9813bd:

  • The same regression fails on immutable base e3fa61956b6e374b4475162039b7bf9f4282be01 through both real File/SQLite CLI entrypoints and the typed owner. Disposable fixtures are outside Git worktrees.
  • 12 receipt tests pass, including four File/SQLite ordering/settlement cases; 272 typed recovery, native-admission and settlement tests pass. Typecheck, Ruff, bilingual RFC check and the nine-file public boundary scan pass.
  • Complete selected Python modules: 187 passed, 6 failed. All six failures are in unchanged test_receipt_next_action_cli.py: each calls canonical-only todo list before initializing its fixture store. The same six cases fail on the immutable base and this head with identical full canonical_authority_required responses, before reaching a quota guard. These failures remain failures; downstream coverage and whole-repository qualification remain open.
  • Standard premerge passes: four direct checks, Python compilation and 17 selected catalog/risk/public-boundary runs, with no failed checks or manual holds.

The bilingual S3/S7 checkpoint and searchable self-repair pattern describe the boundary. This follows #7117 without closing its outstanding whole-repository/independent qualification. Installed Host adoption, full caller cost and long-horizon benefit remain separate.

Reproduce the selected Python cohort:

uv run --extra test python -m pytest -q \
  tests/control_plane/test_heartbeat_receipt.py \
  tests/control_plane/test_quota_settlement_cli.py \
  tests/control_plane/test_todo_external_wait.py \
  tests/control_plane/test_selected_work_requirements.py \
  tests/control_plane/test_receipt_next_action_cli.py \
  tests/control_plane/test_replan_vision_closeout_receipt.py

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) — APPROVE at 9eb51c208c19de0d7af23fb582a4a763ac9813bd.

动机

等待到期后继续原任务的 Agent,可能第一次获准工作,第二次检查同一轮时却只能收尾,尚未产生结果便失去继续执行的路径。
原逻辑把准入前已经满足的定时等待也当成后来新增的等待;当前保留首次正向准入时的事实,同一未变且已到期的等待可以继续,新设或改变等待仍只能结清原结果。
真实 File/SQLite CLI 对照中,基础版本两条已到期重入路径失败,当前四条场景全部通过;后来改变为另一个已到期等待或新增未来等待,仍保留原身份、完整任务状态和单次结算。
本轮资格限于源码 CLI 的等待识别与原结果结算,不重写历史回执、不清理合法等待,也不赋予额外工作、合并或安装权限。

剩余范围:原六个失败用例的下游、全仓、真实 PostgreSQL 环境、安装态 Host 及真实模型/完整成本/长程收益仍未验证;原整体与独立验收义务继续开放。

改动思路

在原回执保留两个准入事实,由既有 TypeScript 等待 owner 与共享微秒时间解析器判定;Python 只传递规范选中任务的事实,不建立第二个策略 owner。
当前 PR 交付已到期任务的同轮源码 CLI 继续与原结果结算;安装态 Host、完整调用成本及更广 S3/S7 资格继续分开验证。
只看当前截止时间不能判断等待是在获准工作前还是之后设立,因此不能删除原恢复门。首次正向准入时自动记录等待值与就绪状态,原本只获准修复的旧回执在首次获准工作时追加事实;后续重入不替换这些事实。空缺历史继续保守恢复,既有语义重规划、身份和结算优先级继续由原 owner 执行。

实际触发 基础版本 当前提交
准入前已到期、未改变的 open 任务 重入只允许写回 可完成原工作并按原身份结算
准入后改变为另一个已到期等待 原结果收尾 仍只允许原结果收尾
普通任务准入后新增未来等待 原结果收尾 同样保留等待、原结果与单次扣额
旧事实缺失/畸形、deferred、未到期 保守恢复 保守恢复

表格描述在该精确 head 的源码路径和已执行对照,不代表真实模型或安装态采用。

具体改动

完整差异为 9 files +234/-7。规格为改动前 docs/quota-allocation.md,固定修订 09e47b0e2ed990681b007c031efae385b73df1a3。按原文条款 An interrupted Todo-bound Turn — implemented,原回执、任务与结算身份保持;Once due — implemented,已满足的 open 等待可继续,deferred 仍须既有显式生命周期流程,原结果债务不会消失。配对 S3/S7 checkpoint 和 quota 文档明确只增加源码资格,不将其改写成安装、全仓或长程收益已完成。

关键代码讲解

  • quota_rollout_details:只在正向工作准入且所选任务与绑定一致时,搬运等待值与就绪事实;空值仍明确保留为未知,不在 Python 另作策略判断。
  • heartbeatWorkRequalification:原本仅获准修复的回执可追加首次正向工作事实,原身份和语义门保持;后续重入不能再把它换成新的等待事实。
  • runnableTimerAtAdmission:要求 open、当前与历史就绪均严格为真、规范等待完全相同,且截止不晚于原记录时间;复用微秒解析,任何缺失或冲突都保守返回。
  • projectReceiptBoundWait:先保留完成、扣额、阻塞及原业务准入的优先级,最后只排除已证明属于原准入的定时等待;局部无恢复结论不等于全局授权。

对主干的风险

最强反例是把“现在已到期”当成获准继续的充分条件,借后来新设的等待重跑业务。实际 File/SQLite 入口分别运行了原有到期与普通无等待两种初始状态;前者在基线两项失败,当前四项全过。当前先完成合成原结果,再改变为另一个已到期等待或新增未来等待,重入均只能结清原结果;完整规范任务状态不变,重复 spend 只有一次扣额,最后仍回到原身份的 settled-skip。独立 typed 对照 27 组在基线三项失败、当前全过,其余 24 组含完整诊断在两版完全一致,覆盖缺失/畸形/真假值、微秒边界、偏移、身份及既有结算优先级。局部投影返回 none 不等于全局授权;原身份/准入 owner 的拒绝仍由现有检查负责。

独立执行 352 项 typed 检查、类型检查、Ruff 和较宽 Python 集,后者 187 过、6 败。六个失败均在未初始化规范夹具时调用 todo list;相同六用例在不可变基础版本和本提交的节点、断言行及完整 canonical_authority_required 响应逐字一致,尚未到 quota。失败仍是 failed,未改变断言或通过数,也不宣称其未执行的下游已验证。当前六项直接与四项选定 premerge 检查通过,包含双语、编译和公共边界;最初的旧回执聚合失败仍保留。 精确范围 cqr_cbac0d438a53f0b9ea06 为 pass;质量记录检查一致性,不能替代上述实际执行证据。没有查询、轮询或等待远端 CI,代码批准也不代替合并准备度与维护者权限。

我的整体评价

这是 justified_increment:源码 CLI 的重入和原结果结算可独立验收,长程控制边界 preserved,免去错误收尾干预的 Agent 路径 improved。两个历史事实有实际自动生产和不可从当前状态重建的时间含义,保留它们比新增时钟、清除等待或放松门禁更小;没有额外数据库、协议版本或人工作业。
在原回执保留两个准入事实,由既有 TypeScript 等待 owner 与共享微秒时间解析器判定;Python 只传递规范选中任务的事实,不建立第二个策略 owner。 当前 PR 交付已到期任务的同轮源码 CLI 继续与原结果结算;安装态 Host、完整调用成本及更广 S3/S7 资格继续分开验证。

视觉审查不适用:已检查完整 diff、现有 Research 汇总/Agent CLI 等待入口及已有 Todo/设置消费者,没有渲染布局、控件或新能力入口变更。未验证范围:原六个失败用例的下游、全仓、真实 PostgreSQL 环境、安装态 Host 及真实模型/完整成本/长程收益仍未验证;原整体与独立验收义务继续开放。 事实与未知分别保留,不以测试、回执或 PR 数关闭更广成果。

English verdict: APPROVE via the author-account COMMENTED fallback. At the exact head, unchanged timers proven due at first positive admission can continue, while later waits retain original-result closeout. All 352 typed tests, 27 paired cases and 4 real File/SQLite scenarios pass. The broader Python cohort remains 187 pass / 6 fail, with complete unchanged pre-initialization failures independently attributed. Installed Host, full cost and long-horizon qualification remain open; no merge is authorized.

@loopx-agent
loopx-agent merged commit 19f3fce into main Oct 24, 2026
30 of 40 checks passed
@loopx-agent
loopx-agent deleted the codex/admission-time-wait branch October 24, 2026 09:03
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