Repository navigation
fix(quota): require compute allowance for fresh replan admission - #8576
Conversation
Signed-off-by: xiaobaifly7 <196511160+xiaobaifly7@users.noreply.github.com>
loopx-agent
left a comment
There was a problem hiding this comment.
Reviewer: model_agent · gpt-6.1-sol · OpenAI · runtime_reported · reasoning_effort=max
评审提交 0024b2ae5266599727fccd2b6cc0117e5405fa75。结论 REQUEST_CHANGES。
P2 额度耗尽拦截已准入原 Turn 的重规划接续
另一 Agent 用掉最后一槽后,真实 quota CLI 返回原回执 replayed,同时把原 Turn 判为 throttled_skip,省略了结算计划。 同一身份的 turn plan 从 replan_required 变为 wait。 传入由现有回执 owner 校验的正向准入事实,限定原 Goal、Agent、Turn、义务和未结算阶段。只有等待记录的重读仍按新准入处理。
动机 / Motivation
Goal owner 需要控制新重规划的预算,并让已准入的原始 Turn 继续履行结算职责。 共享算力用完后,主干仍会因缺失 Vision checkpoint 选择新重规划。 候选阻止新重规划超出窗口。共享规则也挡住已准入的精确 Turn,原身份的 Turn plan 从可启动重规划变成 wait。 检查覆盖真实准入、已有回执的接续和启动判定,执行范围到 CLI 输出。
改动思路 / Approach
传入已正向准入的原身份,使耗尽规则只作用于新准入,已有接续和结算继续由原回执协调。 额度判断继续由共享 TypeScript reducer 持有,已准入的原身份由现有回执协调校验。 设计问题 #8571
具体改动 / Changes
5 文件,+200/-2。生产 +25/-1,文档 +16,测试 +159/-1。 新默认策略仍需 maintainer 决定。NEW-ADMISSION 的首次决策通过。ORIGINAL-RECEIPT 的同身份接续在下述情形失败。OWNER-STOP 仍走既有前置检查。主干基线 beff0f3e55d1f70eceebbd8e78c11f1cff34643b。docs/quota-allocation.md
applyGoalOverrides。用允许量和已用量判断耗尽,对本次匹配的重规划清空执行权限。 loopx/control_plane/quota/run_decision.ts_receipt_bound_guard_fields。从原始回执取出选中义务与 Turn 身份,可在这里保留正向准入事实。 loopx/control_plane/quota/live_decision.py_build_turn_decision。按原回执生成启动前的决策,当前结果让 host plan 进入 wait。 loopx/cli_commands/turn_decision.py
对主干的风险 / Risks
先以额度 1/0 提交原重规划 guard,再加入另一 Agent 的一条真实格式用量记录,额度变为 1/1。分别读取原 Turn 和新 Turn 的 guard,再用原身份调用 turn plan。 另一 Agent 用掉最后一槽后,真实 quota CLI 返回原回执 replayed,同时把原 Turn 判为 throttled_skip,省略了结算计划。
File、SQLite 在 1/1 时均阻止新重规划,重读被拒绝的新 Turn 仍需等待。额度提高到 2/1 后原身份可继续。普通等待和有额度的重规划对照正常。 TypeScript 40 项、控制面 typecheck、Ruff、quick premerge 6 项直接检查及 4 项选定检查通过。Python 默认运行 121 项通过,两个新增 CLI 用例在渐进式输出上直接读取顶层 should_run,触发 KeyError。以 LOOPX_CONTEXT_DELIVERY=off 重跑这两项均通过。建议用例显式指定原始输出,或沿默认上下文引用读取;实际回执复现使用显式原始输出。
合成数据通过真实 CLI 和 TypeScript Effect runtime,分别用 File 与 SQLite Todo authority 验证。安装后的宿主和远端 CI 尚未复验。
我的整体评价 / Verdict
传入由现有回执 owner 校验的正向准入事实,限定原 Goal、Agent、Turn、义务和未结算阶段。只有等待记录的重读仍按新准入处理。 用同一夹具验证原身份、新 Turn 和重复读取的结果。额度恢复后复验新准入,并保持真实原回执的结算可达。
English verdict: REQUEST_CHANGES for 0024b2ae5266599727fccd2b6cc0117e5405fa75. An exhausted window correctly blocks fresh replans and incorrectly suppresses the still-owed continuation of an already admitted exact replan.
…ota-replan-recovery-8576-20261115 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
left a comment
There was a problem hiding this comment.
Reviewer: model_agent · gpt-6.1-sol · OpenAI · runtime_reported · reasoning_effort=max
评审提交 d7804397de79772c152737c9ee9038d1a4c17042。GitHub 本次记录的 base 是 beff0f3e55d1f70eceebbd8e78c11f1cff34643b。已核主干 08cc6ef5b9a15a5a74d3e56ba4114cb09b2033ee 与候选的 Git 合并基点是 8ade78cddeb6bdcd947c0a81507393c4599c7652,合并树模拟成功。
动机 / Motivation
配置共享算力窗口的 Goal owner 需要限制新重规划开销,并能接续已经准入的工作。 额度用完时,普通交付会停下来,缺少 Vision checkpoint 仍能触发一次新的模型重规划。旧候选又挡住了已准入的原 Turn。 先读窗口剩余额度,再依据原准入回执决定是否恢复已欠的重规划。
原重规划已获准,另一条工作用掉最后一槽。用原身份和新身份各读取一次 guard,再以原身份执行写回和扣额重试。 旧评审的接续故障已修复。当前参与同一回执链路的 guard scope 回归测试有一项在新提交报 AttributeError。 证据覆盖本地源码、合成 Goal、File 与 SQLite。安装宿主和远端 CI 未复验。新准入的零额外额度是 #8571 中提出的政策,维护者仍可决定采用的预算规则。
改动思路 / Approach
正向准入事实从现有回执 owner 读出,Python 传递十进制额度和作用域,现有 TypeScript quota reducer 仍持有最终决策。 在 File 和 SQLite 上,新 Turn 和它的重读均等待。原 Turn 保留结算身份并可继续重规划。窗口满时扣额被拒,恢复一槽后,同一结算完成一次扣额。零算力仍返回明确暂停。 证据覆盖本地源码、合成 Goal、File 与 SQLite。安装宿主和远端 CI 未复验。新准入的零额外额度是 #8571 中提出的政策,维护者仍可决定采用的预算规则。 相关问题或原任务
具体改动 / Changes
按实际合并基点计 14 文件、+340/-16,其中生产 +65/-15、测试 +253/-1、双语说明 +22。GitHub 缓存的 770 文件包含已在主干的提交;以 Git 祖先和 14 文件差异判断变更。 读取端把原回执的开放阶段正向准入转换为 typed fact。新准入采用原窗口计数,原身份的恢复与扣额重试仍由各自的 owner 执行。
关键代码讲解
- 验证原 guard 的正向准入和语义重规划义务。 admitsAutonomousReplan
- 仅在原回执仍开放时派生待执行状态。 readQuotaSettlementFromRequest
- 取回精确 guard scope 与待执行事实。 _receipt_bound_guard_fields
- 额度耗尽时区分新准入与原回执接续。 applyGoalOverrides
依据 docs/quota-allocation.md 在 08cc6ef5b9a15a5a74d3e56ba4114cb09b2033ee 的约束核对。
- 窗口耗尽时的新准入。窗口内额外算力由现有配额 owner 管理,状态明确说明等待。 在 File 和 SQLite 上,新 Turn 和它的重读均等待。原 Turn 保留结算身份并可继续重规划。窗口满时扣额被拒,恢复一槽后,同一结算完成一次扣额。零算力仍返回明确暂停。
- 原回执的接续与结算。已准入工作保留原授权范围、身份和结算职责。 在 File 和 SQLite 上,新 Turn 和它的重读均等待。原 Turn 保留结算身份并可继续重规划。窗口满时扣额被拒,恢复一槽后,同一结算完成一次扣额。零算力仍返回明确暂停。
- 回执作用域回归用例。现有正匹配与不匹配用例均应可执行并核对选择范围。 匹配的参数进入新属性读取后抛出 AttributeError。用当前主干的同一 helper 和相同夹具对照,两个参数均通过。真实 File 和 SQLite 接续用例均通过,故障定位到源码回归覆盖。
对主干的风险 / Risks
[P2] 守住现有回执作用域回归。 运行现有 guard scope 回归用例,匹配已记录的 Turn 和 replan obligation。该夹具构造的回执缺少新增字段。 匹配的参数进入新属性读取后抛出 AttributeError。用当前主干的同一 helper 和相同夹具对照,两个参数均通过。真实 File 和 SQLite 接续用例均通过,故障定位到源码回归覆盖。 把匹配与不匹配用例改用完整 typed readback,或在原夹具显式提供 replan_execution_pending。分别断言匹配正向准入与不匹配义务时的值。 代码位置
扩展 Python 组 141 项通过,1 项失败。主干 helper 使用同一夹具为 2 项通过;精确配额与暂停另组 30 项通过。TypeScript 265 项、控制面 typecheck、Ruff、RFC 双语与差异检查通过。
复验 python -m pytest -q tests/control_plane/test_effect_turn_live_quota_decision.py::test_receipt_guard_fields_use_the_typed_identity_and_guard。
我的整体评价 / Verdict
REQUEST_CHANGES。 同步更新有针对性的回执契约夹具并重跑该用例。原先对额度耗尽后接续的异议已有实测解释。 证据覆盖本地源码、合成 Goal、File 与 SQLite。安装宿主和远端 CI 未复验。新准入的零额外额度是 #8571 中提出的政策,维护者仍可决定采用的预算规则。
English verdict: REQUEST_CHANGES at d780439. The File and SQLite continuation regression is fixed. Update the existing scoped receipt test to cover the new field; its matching case now fails with AttributeError.
…ota-replan-receipt-fixture-20261116 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
left a comment
There was a problem hiding this comment.
Reviewer: model_agent · gpt-6.1-sol · OpenAI · runtime_reported · reasoning_effort=max
评审提交 d36c8b5589bcdf8ea13d9c10869822b47ce795ee。原差异基点 f3bdad2387397e078fbc887e7cb7ed80adaf7510。
动机 / Motivation
共享算力窗口的 Goal owner 需要限制新的重规划开销,同时保住已经准入的工作。 File 和 SQLite 各以一格额度启动重规划,另一条工作用真实 CLI 用掉最后一格。再读取新 Turn、无原回执的通用 CLI 路径和已获准的原 Turn。 主干仍准入新重规划,候选要求等待。原 Turn 继续写回,额度恢复后用原回执扣一格,重试无额外扣额。上一轮作用域测试的三个参数现均通过。 验证覆盖合成 Goal 上的源码 CLI、File 和 SQLite。宿主安装、远端 CI 和长期资源收益尚未核验。
维护者仍需在 #8571 决定采用零额外额度的产品政策。
改动思路 / Approach
重用已有配额与回执 owner。预算耗尽时,新路径返回 throttled_skip 和等待原因。原回执先恢复已经获准的范围,再沿原写回和扣额顺序推进。 已有正向准入解析可供 prior closeout 和当前 quota 决策共享。独立的 full-window 计数比较仍在既有决策函数。 准入政策在原配额入口验证,采用这个政策的决定仍归 #8571。补丁独立、可以撤回。
具体改动 / Changes
15 个文件,+356/-21。既有生产入口 +65/-15,测试 +269/-6,双语说明 +22。 原决策函数比较窗口计数。已获准义务通过原回执与当前义务绑定。作用域测试分别覆盖三种匹配状态。 上轮作用域评审 政策议题 本提交的双语说明 验收约定
关键代码讲解
-
直接核对窗口是否耗尽,决定新重规划。 applyGoalOverrides
-
只从开放阶段的正向准入派生执行待办。 readQuotaSettlementFromRequest
-
核对原 guard 选中的义务并投影执行待办。 _receipt_bound_guard_fields
-
覆盖匹配且待办、匹配已结束、不同义务三种输入。 test_receipt_guard_fields_use_the_typed_identity_and_guard
-
shared-compute-window。选择零额外额度时,耗尽窗口内不准入新重规划。 主干两条入口仍准入。候选的 Codex App 和通用 CLI 均等待,再读也等待。
-
original-admission。正向准入仅恢复原回执的义务和接续范围。 File、SQLite 的原 Turn 经 Codex CLI 导航、发现同义务后继并写回。三种 guard scope 参数均通过。
-
owner-stop-and-retry。保留 owner 暂停以及同一笔扣额的复额重试。 实证覆盖零算力和满窗口扣额被拒。owner 修改预算后扣一格,旧命令重试不再追加。
对主干的风险 / Risks
预算政策的变更会让处于满窗口的 Goal 推迟新的重规划。复验覆盖主干与候选的真实扣额和恢复。具备精确回执的原 Turn 仍可写回,在窗口恢复后用同一身份结算。
本地入口 Python 85 项,另组 64 项有部分重叠,TypeScript 419 项。控制面 typecheck、Ruff、标准 premerge 和合并树通过。安装的应用及远端 CI 未纳入这次验证。
语义与 CI 对齐
额度满时,CLI 提示等待滚动窗口或 owner 提高预算。已有工作的回执仍可写回,扣额责任方在窗口满时拒绝扣额,允许稍后使用同一身份重试。零算力仍明确暂停。
我的整体评价 / Verdict
APPROVE。 作用域测试已修复,真实 CLI 各阶段均符合本 PR 的预算政策。切到通用 CLI 仍执行同一预算限制,原回执可安全重试结算。政策选择仍归维护者。
English verdict: APPROVE at d36c8b5. The scoped receipt fixture now covers all three admission cases. Real File and SQLite CLI runs stop fresh replans at exhaustion, preserve the admitted Turn, and settle its original debit exactly once after allowance returns. The policy decision stays with the maintainer.
Goal And Delivered Outcome
mainbeff0f3e55d1f70eceebbd8e78c11f1cff34643b; the issue had no maintainer policy ruling.should_run=true/run_now.throttled_skipaction with an explicit reason when the window is exhausted. It resumes when allowance returns. The new production-entrypoint tests fail before the change (5 failures, 1 pass in the initial six-case characterization) and pass afterward.main.Author Declaration
Implemented against
docs/quota-allocation.mdat the base revision above, and this PR's explicit conservative policy proposal.quota/run_decision.ts::applyGoalOverridestest_replan_quota_exhaustion.pyEffectiveAction.THROTTLED_SKIPand should-run reasonPOLICY CHOICES
throttledstate fallback.throttled_skipand the existing reason projection rather than adding a new action vocabulary or UI/configuration.Scope And Continuation
Validation
0024b2ae5266599727fccd2b6cc0117e5405fa75.node --no-warnings --experimental-strip-types --test tests/control_plane_ts/quota_run_decision.test.ts: 40 passed, including exhausted/masked windows, malformed counts and exact integer boundaries.python -m pytest -q tests/control_plane/test_replan_quota_exhaustion.py tests/control_plane/test_quota_run_decision.py tests/control_plane/test_effect_turn_live_quota_decision.py tests/control_plane/test_dated_vision_wait_cli.py --tb=short: 123 selected instances passed across the scoped runs. Includes real local Effect runtime, CLI dispatcher with synthetic status IO, exact original Turn recovery and 4 File/SQLite blocked-replan no-debit closeouts.decision_summary.py:78no-any-return; exact-base shadow-file comparison produces the same error. No unrelated typing repair included.PYTHONUTF8=1 loopx canary premerge --from-git-diff --git-diff-base origin/main --tier quick: fixed-head gate passed, 6 direct checks + 4 executed checks, zero failures and manual holds. Validation used only a synthetic registry and disposable local runtime.PYTHONUTF8=1resolves it; the two affected pytest instances passed on focused rerun. A quick run made concurrent with staging detected the new test's index transition as a tracked side effect, while its smoke returned success; final fixed-head quick validation is recorded above. No full Python suite, full TS suite, live model, installed host or sustained automatic-loop qualification was run.Frontend / Visual Evidence
Type of Change
LoopX Area
Technical Direction
Shared-authority RFC fixture impact
N/A: no authority-provider routing, promotion, compatibility projection or RFC implementation claim. Existing real local File/SQLite settlement regressions remain covered.
Boundary Checklist
none.Signed-off-bytrailer (git commit -s).Maintainer follow-up
The original proposal remains under review in #8571. The recovery correction uses the existing positive admission rule from the effective heartbeat receipt. After the window fills, the same Goal, Agent, Turn, and replan obligation can resume against the original settlement plan. A fresh Turn and a replay of a denied Turn still wait under the proposed budget rule. Owner Stop and zero compute still take precedence.
A validated writeback preserves the original owed spend. The current spend owner can still reject a debit while the window is full. Once allowance returns, retrying the original receipt commits one debit and further retries replay it.
The regression failed on the integrated contributor head in both File and SQLite because the original guard returned
throttled_skip. It passes ond7804397de79772c152737c9ee9038d1a4c17042using the productionquota should-run,turn plan,refresh-state, andquota spend-slotCLI paths, including a zero-compute pause and exact settlement replay.Prior review finding
Scoped Receipt Regression Follow-up
The matching guard fixture failed at
d7804397de79772c152737c9ee9038d1a4c17042before it could assert the bound identity. It omitted the readback's pending execution field. The regression now checks a matching pending obligation, a matching obligation without pending execution, and a different obligation with pending execution. All three retain the assertions for the original Turn and guard timestamp. Exact-head review findingValidated
d36c8b5589bcdf8ea13d9c10869822b47ce795eeagainstf3bdad2387397e078fbc887e7cb7ed80adaf7510.native_child_result_inbox.ts:109as current main. #8836The original settlement remains reachable after the window fills. Fresh admission still waits under the proposed allowance policy. Exact-head independent review and hosted checks are pending. The allowance choice remains open in #8571.