Skip to content

fix(quota): generate narrow deferred Todo reopen command - #5813

Merged
huangruiteng merged 1 commit into
mainfrom
codex/deferred-resume-command-20261007
Oct 6, 2026
Merged

huangruiteng merged 1 commit into
mainfrom
codex/deferred-resume-command-20261007

Conversation

@loopx-agent

Copy link
Copy Markdown
Collaborator

When quota should-run selects a ready deferred successor, its generated reopen command includes --note. Canonical hard leases intentionally accept only the narrow status/clear-resume/reason transition without an execution lease, so following the generated command fails with handoff_mode_requires_lease; acquiring a lease first also fails because the Todo is still deferred.

Generate --reason instead. The existing lifecycle can reopen unchanged work without execution authority, then the worker acquires a fresh lease. No lease admission, actor rule, state representation or settlement behavior changes.

quota提示的延期重开命令混入note,因此被既有hard-lease门禁拒绝。改为合法的reason说明后,调用者可直接按提示重开原任务、再取得fresh lease;保留窄转换和角色/旧proof拒绝边界。

Validation:

  • Four real CLI scenarios across canonical File/SQLite and both no-open-work and priority-preemption routes fail on the previous generated command and pass after the fix.
  • Each consumes the actual generated command, verifies no execution authority on reopen, acquires a fresh lease, reenters the original Turn identity and spends zero slots. Mixed note, foreign actor and retained-proof requests remain rejected.
  • 42 existing scheduler/interaction, scoped successor and lease-recovery Python regressions pass (46 Python tests total), plus 12 typed deferred hard-lease File/SQLite lifecycle tests (58 total).
  • Ruff, git diff --check, loopx check and the advisory semantic inventory pass.

This Core command-rendering change is left for maintainer review/merge. Default installation and App/channel adoption remain unqualified. Native-child admission after replan-to-delivery reentry is an independent qualification case and is not changed here. No store implementation/schema changes; local PostgreSQL integration was not run.

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 (author-owned PR; GitHub blocks formal self-approval)

完整独立评审精确 head 42d9325d4bf33fc7273ea0022785f845c17b86f6,不可变 merge-base b185aa5ff016f5cb65d6c0c67d3c7d591a2586aa,全差异而非单个测试。

动机

使用 quota 恢复延期任务的 Agent 或维护者。 以前复制提示命令得到 handoff_mode_requires_lease;当前同一命令能先重开原 Todo,再取得新 lease 继续原 Turn,且重开本身不授执行权。 四种真实 File/SQLite 场景完成生成命令→原任务重开→新租约→原 Turn 再入;越权与夹带旧 proof 仍拒绝。 不认证默认安装、App/channel 采用、native-child 再入、PostgreSQL 或整个持续运行目标。 默认安装与 App/channel/native-child adoption 不在此批证明;既有 registry I/O manifest 红测保持单独本地合并阻塞。

依据基础版本 docs/quota-allocation.md 的延期恢复/新租约边界。

Spec criterion: Deferred Todo recovery; disposition=implemented; Existing typed narrow transition verified.

改动思路

复用已有 TypeScript deferred lifecycle 和 lease admission owner;Python仅渲染合法窄转换命令,不新增权威或 schema。 本批交付到期任务的 CLI 恢复命令修复,保留状态、角色、租约及记账 owner;不把更宽宿主采用当已完成。

具体改动

全部 3 路径,+234/-1。

  • interaction_next_cli_actions(loopx/control_plane/work_items/interaction_contract.py:723):render successor-replan command;Only --reason replaces --note; no lifecycle decision copied.,实际调用路径为 quota should-run → interaction_next_cli_actions → todo update → TS deferred lifecycle → fresh task-lease acquire → same-Turn quota reentry。
  • isDeferredReopen(loopx/control_plane/coordination/todo_deferred_lifecycle.ts:12):existing narrow authority classifier;status open + clear_resume_when + reason only; no note/patch/oldproof.,实际调用路径为 quota should-run → interaction_next_cli_actions → todo update → TS deferred lifecycle → fresh task-lease acquire → same-Turn quota reentry。

同一独立冻结探针在不可变 B 的四种 File/SQLite × no-open/strict-priority 场景均实际执行生成 --note 命令并被拒绝;H 改 --reason 后 narrow reopen 不授 execution authority,随后 fresh lease 成功、same-Turn normal delivery恢复。额外 note、foreign actor、retained execution proof 均拒绝,fixture spend_runs=0。

同五个已有 Python 文件 B74/H74通过,H加四项生成命令回归共78通过;同一冻结新增回归 B4fail/H4pass,真实独立 File/SQLite 四场景 B拒绝/H恢复;typed lifecycle B12/H12通过。Ruff、配置mypy19、TS typecheck、advisory通过。风险premerge五直接检查、18/19选择项通过,semantic manifest 一项仍失败。 同 immutable B/H identical command及错误身份、详情、七个因果文件SHA归因 pre_existing_unrelated;本地merge hold仍红,未放限。

对主干的风险

最强风险是放宽租约门禁来接受任意编辑或保留旧 proof,或只有重开 ACK 而后续仍无法执行;已用真实 CLI 到 fresh lease/same-Turn 再入及三类拒绝验证。 不认证默认安装、App/channel 采用、native-child 再入、PostgreSQL 或整个持续运行目标。 默认安装与 App/channel/native-child adoption 不在此批证明;既有 registry I/O manifest 红测保持单独本地合并阻塞。

semantic smoke/premerge 的红项完整保留:B/H 同命令均是 project_lifecycle_refresh_state.py 两个 codec_read:load_registry#1/#2 metadata drift;实际 source/manifest/parser/check/package 七SHA相同,该改动不涉及其因果路径。独立变更不变量通过支持 pre_existing_unrelated,仅非阻断本次评审,不把本地 merge gate 红测变绿。初外置冻结测试因缺 fixture import 路径无法 collection,按同 B/H 显式来源纠正后 B4fail/H4pass;基础 npm依赖路径初缺失,使用与H相同依赖后确认同一 semantic failure。初准备失败未隐去。

我的整体评价

APPROVE;problem_context=justified_increment。复用已有 TypeScript deferred lifecycle 和 lease admission owner;Python仅渲染合法窄转换命令,不新增权威或 schema。 本批交付到期任务的 CLI 恢复命令修复,保留状态、角色、租约及记账 owner;不把更宽宿主采用当已完成。 Future-facing pass:Existing TS owner sufficient; no adjacent refactor needed. 无需修改已存在的 typed lease/lifecycle owner;独立 semantic manifest 红测由原 registry-I/O owner 修复,不能放宽 guard。 未查询、轮询或等待 CI;评审不授合并或部署权限。

Reviewer: model_agent; model=gpt-6.1-sol; provider=OpenAI; declaration_source=runtime_reported; reasoning_effort=xhigh.
English verdict: APPROVE - The actual generated deferred-reopen command now fits the existing typed narrow lifecycle, followed by a separately admitted fresh lease and same-Turn delivery. Independent File/SQLite counterfactuals retain owner/proof rejection. The identical unrelated registry-I/O manifest failure remains red and a separate local merge hold.

@huangruiteng
huangruiteng merged commit 332f6de into main Oct 6, 2026
7 checks passed
@huangruiteng
huangruiteng deleted the codex/deferred-resume-command-20261007 branch October 6, 2026 21:08
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