Repository navigation
fix(quota): bound blocked-frontier Vision baseline initialization - #8574
huangruiteng merged 3 commits into
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
评审提交 2938c338851793a4e487bf4381ce7b8b10a4cb0d。结论 REQUEST_CHANGES。
P2 等待回执在重试时绕过一次性初始化限制
等待回执绑定了重规划身份。用同一个等待 Turn ID 重读后,回执升级,返回 should_run=true、must_attempt=true 和结算计划。 从原始正向准入回执派生豁免。安静等待应保留诊断义务,避免写入能在重试时绕过限制的结算身份。
P2 准入回执写失败仍消耗唯一初始化机会
只在真实 CLI 的 rollout 追加点注入 OSError。首次 guard 返回 heartbeat_receipt_write_failed,磁盘上已有准入 sidecar。修复 IO 后,新的 Turn 返回 agent_scope_wait。仍持有失败 Turn ID 的调用方可以原样重试并成功准入。 在现有回执提交边界确认一次性初始化,或把预留与真实回执对账,在明确失败后恢复资格。
动机 / Motivation
处理阻塞 Todo 的 Agent 需要一次有明确结算身份的 Vision 基线初始化,并能在后续唤醒进入安静等待。 自治重规划只剩缺失的 Vision 基线时,主干会为没有可执行 Todo 的 Agent 再次返回 run_now。 候选首次等待是安静的。两个新的 Turn 各自在相同身份下重试后都重新取得执行权,正常重试可以绕过单次初始化上限。 检查覆盖真实 CLI、回执和调度投影,执行范围到启动判定为止。
改动思路 / Approach
复用现有 agent_scope_wait,保留原始初始化身份,让等待和回执协调读取同一个有效准入事实。 新增本地准入记录需要与已有 heartbeat receipt 的真实状态一致,现有回执协调负责解释重试资格。 设计问题 #8572
具体改动 / Changes
10 文件,+299/-3。生产 +110/-2,测试和 fixture +189/-1。 新默认策略仍需 maintainer 决定。NEW-ADMISSION 的首次决策通过。ORIGINAL-RECEIPT 的同身份接续在下述情形失败。OWNER-STOP 仍走既有前置检查。主干基线 beff0f3e55d1f70eceebbd8e78c11f1cff34643b。docs/quota-allocation.md
build_quota_should_run。把结算绑定的存在直接转成 receipt_bound,进入 TypeScript 的豁免分支。 loopx/control_plane/quota/should_run.pyboundVisionBaselineAdmission。持锁写入一次性记录,并对后续新 Turn 投影安静等待。 loopx/control_plane/quota/vision_baseline_admission.tsquota_rollout_settlement_binding。结算计划为空时仍从诊断义务推导绑定,等待记录因此带上重规划身份。 loopx/control_plane/quota/settlement_cli.py
对主干的风险 / Risks
额度 1/0,原 Turn 已获得正向回执。另开两个 Turn,各自第一次查询均安静等待,使用各自同一 ID 再读 guard 后均升级成正向重规划。 只在真实 CLI 的 rollout 追加点注入 OSError。首次 guard 返回 heartbeat_receipt_write_failed,磁盘上已有准入 sidecar。修复 IO 后,新的 Turn 返回 agent_scope_wait。仍持有失败 Turn ID 的调用方可以原样重试并成功准入。
首次真实准入返回 autonomous_replan_required,首次新 Turn 安静等待。独立任务和到期监控的 File、SQLite 对照通过。 Python 109 项、TypeScript 91 项、控制面 typecheck、Ruff、quick premerge 6 项直接检查及 3 项选定检查均通过。
合成数据通过真实 CLI 和 TypeScript Effect runtime,分别用 File 与 SQLite Todo authority 验证。安装后的宿主和远端 CI 尚未复验。
我的整体评价 / Verdict
从原始正向准入回执派生豁免。安静等待应保留诊断义务,避免写入能在重试时绕过限制的结算身份。 用同一夹具验证原身份、新 Turn 和重复读取的结果。另加回执追加故障并验证修复后的重新准入。
English verdict: REQUEST_CHANGES for 2938c338851793a4e487bf4381ce7b8b10a4cb0d. A quiet wait receipt becomes executable on same-Turn replay. A failed guard append also consumes the sole initialization admission.
|
This pull request has merge conflicts with Choose the remote for the base repository, not an out-of-date fork. git fetch upstream
git rebase upstream/main
# Resolve each conflict, git add the resolved files, then git rebase --continue.
git push --force-with-lease origin HEADFor a same-repository clone whose Keep the DCO |
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.2-sol · OpenAI · runtime_reported · xhigh
动机 / Motivation
仅有受阻事项的 Agent 需要保留原 Vision 诊断,同时避免每轮反复创建初始化任务。 主干在 File 与 SQLite 的独立进程对照里,把四次守卫全判为自主重规划,得到四个不同 Turn 绑定。 有可办任务、到期 Monitor、其他 Agent 或其他 Goal 沿用原独立执行规则。被阻塞的同一范围仅限制缺失基线所引起的重复初始化。 候选将唯一一次批准绑定到成功提交的正向回执。竞争失败者保留诊断和安静等待。 改动在缺失基线的阻塞前沿、回执持久化与原 Turn 的重放。
改动思路 / Approach
TypeScript 的 quota owner 给出类型化值,使用原 rollout append lock 串联实际提交。 按当前 Goal lifetime、Agent 和原 Turn 区分,相同身份的未完成结算保持原跟进。 沿用现有 rollout log 的提交条件。等待只携带诊断,正常激活和原 Turn 同一绑定继续走原 owner。
具体改动 / Changes
准确头 e94e81e,merge base c563a47,15 个文件,+584/-10。按实际远端主干逐项检查原 contributor 与后继修复。核验初始化票据、并发、原结算和已有标准等待。 按修订 c563a47 的现有规范核对各项要求。 目标规范
关键代码讲解
-
boundVisionBaselineAdmission基于完整工作计数和已提交的正向 receipt。 规则 -
_check_vision_baseline_admission在追加锁内检查同一范围的回执。 追加 -
quota_rollout_settlement_binding让等待诊断回执保持无绑定。 绑定 -
普通 CLI 回归模拟追加前后错误和竞争者。 回归
-
initialization_receipt核验换行提交和竞争。 -
original_turn核验赢家和等待者重放。 -
ordinary_scope核验独立工作和到期 Monitor。
对主干的风险 / Risks
两种存储各用四个真实并行 CLI 进程,在同一 Goal 与 Agent 上竞争初次初始化。主干每种存储均准入四个独立 Turn。候选均只有一个准入、三个等待。再次调用赢家保持原结算身份,再次调用等待者仍无结算绑定,预检查未产生扣额。 在 File 和 SQLite 上注入追加前失败、缺提交换行以及提交后丢失响应。前两种恢复后重新准入,提交后的重试恢复同一原身份。新可办工作或到期 Monitor 保留正常执行分支。 定向 130 项 Python 和 106 项 TypeScript 通过。独立并发对照每侧各覆盖 File 与 SQLite,TypeScript 类型检查和 Ruff 通过。 另外重验原票据、回放与旧等待场景,保留实测结果 126 passed。 GitHub PR 的 base 快照仍显示旧引用。以经 GitHub compare 与本地 Git 双重确认的当前 main 为评审基准,其净差异为 15 个文件。主干随后合入 #9235,六处更新与本提案路径无交集,已核对三方合并。标准预合并的 CLI output budget 检查触发 120 秒外层时限,原标准结果仍失败。 独立运行同一命令,主干 311 秒与候选 292 秒均完成,通过内容与大小断言。 签名安装、远端 CI 和 PostgreSQL 在本轮未独立验证。
我的整体评价 / Verdict
批准当前提交,未发现阻断项。原两项求改所列故障已在当前提交通过独立回归。代码结论限当前主干上的上述 15 处改动。 CLI guard 和结算语义改变,当前 diff 无首屏渲染变化。
English verdict: APPROVE at e94e81e. Approve the 15-file source delta against the verified current main. Four independent guards converge to one committed admission on both File and SQLite. Failure before commit preserves an opportunity to retry, and waiting receipts cannot bind a replan on replay. The outer premerge CLI budget result and GitHub base comparison discrepancy are recorded separately.
The merge-base changed after approval.
Signed-off-by: huangruiteng <huangrt01@163.com>
huangruiteng
left a comment
There was a problem hiding this comment.
Reviewer: model_agent · GPT-6 · OpenAI · self_reported
No blocking finding.
动机 / Motivation
阻塞型 Agent 如果只剩缺失的 Vision baseline,旧行为会在每个新 Turn 再次返回 autonomous_replan_required。Agent 没有可执行 Todo、没有到期 Monitor,却持续消耗 guard 与诊断回合,实际进展仍为零。当前 head 把允许范围限定为完整且同 Agent 的 blocked-only frontier:第一次可以初始化,成功回执提交后,新的 Turn 进入安静的 agent_scope_wait,但仍保留缺失 baseline 的义务。独立工作、到期 Monitor、原 receipt-bound replan 和其他 Goal/Agent 不受影响。
The affected callers are ordinary Codex App and CLI quota guards, plus the Agents and operators relying on blocked-only lanes to wait without repeated quota turns. Before the change, a blocked-only Agent with only vision_checkpoint_missing gaps is admitted again on each new Turn. At the reviewed head, the first Turn is admitted, the committing receipt records that one initialization, and later fresh Turns return quiet agent_scope_wait while retaining the pending Vision obligation. A blocked-only Agent is admitted once and then waits quietly; independent runnable work, due monitors, receipt-bound replans and original settlement continue through their existing owners. This PR does not add a reset UI, replace receipt recovery, define a general quota exception, or claim installed-host and live-model qualification.
改动思路 / Approach
决策仍由 TypeScript quota.run_decision owner 产生。admitQuotaRunDecision 先执行原有 run decision,再由 boundVisionBaselineAdmission 判断是否属于唯一可收敛的 missing-baseline 场景。允许消费的时间点不是 projection,而是现有 rollout log 的提交换行:只有完整、同 Goal instance、同 Agent 且 admitsAutonomousReplan 的正向 receipt 才算已初始化。CLI append 继续复用原锁和 precondition;等待回执不携带 Todo/replan settlement identity,因此同 Turn 重放不会变成可执行计划。实现复用了现有 scheduler wait、heartbeat receipt 和 settlement owner,没有新增 store、命令或并行决策器。
The policy uses the existing decision and receipt owners, preserves wait semantics and adds no parallel scheduler. Ship the once-only blocked-only admission and its receipt-bound failure handling; defer installed, PostgreSQL and live-model qualification.
具体改动 / Changes
boundVisionBaselineAdmission只在 counts 完整、advancement 为零、无 Monitor 缺口、blocker 全部同 Agent 且 trigger/gap 全为vision_checkpoint_missing时参与。已有 committed initialization 时,新 Turn 投影agent_scope_wait,原 admitted Turn 仍保留原决策。_check_vision_baseline_admission在原 append lock 内读取 committed-only receipt,确保两个并发 guard 只有一个初始化赢家。quota_rollout_settlement_binding对should_run=false的agent_scope_wait返回空 settlement binding,解决原 review 指出的“等待重试后变成可执行”问题。committedGoalRolloutEvents排除没有提交换行的 torn row;Python CLI 同样使用 committed-only 读取,解决 append 失败却消耗唯一机会的问题。
规范依据 issue #8572,revision 8572。single-initialization:每个 runtime root、Goal 和 Agent 只允许一次初始化;committed-receipt:只有提交回执消费机会;quiet-wait:后续 Turn 安静等待且无 settlement identity;independent-continuation:真实工作、到期 Monitor 和原结算继续;installed-qualification:安装态与真实模型明确超出本切片。
对主干的风险 / Risks
最强反例是“旧回执已被误认为提交”或“竞争 guard 各自准入”,这会永久饿死唯一初始化或产生两个初始化 Turn。File/SQLite 测试分别覆盖提交前失败、缺少换行的 torn row、提交后响应丢失和并发赢家;结果均只有一个合法 admitted Turn,等待方无 settlement identity,原赢家 replay 保持原身份。其他 blocker 类型、unknown counts、repair lane、独立工作和到期 Monitor 仍走原 owner。
本地 exact head 验证:130 个定向 Python case、106 个定向 TypeScript case、control-plane typecheck、focused Ruff 和 loopx canary premerge --tier quick 均通过。远端 CI 在新 merge head 刚入队;安装宿主、PostgreSQL、真实模型和长时间生产遥测未验证,保留为独立风险。
我的整体评价 / Verdict
长程上,该改动把“无工作却反复重规划”收敛为一次可观察初始化加安静等待,同时保留真实工作、原结算和更换 owner 后继续运行的能力。用户侧 JSON 更诚实,不需要额外配置或人工重置。改动通过现有 typed decision 与 receipt owner 完成,属于 proportionate、必要的局部修复。
English verdict: APPROVE at 6fa26c1. One committed Vision-baseline initialization now precedes quiet scoped waiting; File/SQLite failure, race, replay, independent-work and due-monitor cases pass, while installed-host, PostgreSQL and live-model qualification remain unverified.
Goal And Delivered Outcome
agent_scope_waitcontract while preserving the missing baseline obligation. The same synthetic input on pinned main returnedautonomous_replan_requiredagain on a fresh Turn.main. This is standalone, not stacked on fix(quota): wait when the only scoped work is blocked #8511.Author Declaration
Implemented against
agent_scope_frontier_v1/agent_scope_waitbehavior is reused.quota/vision_baseline_admission.ts::boundVisionBaselineAdmissionagent_scope_frontier, existing interaction/scheduler projectiontest_missing_vision_baseline_wait.py::assert_waitchecks no attempt/delivery, quiet wait and scheduler backoffScope And Continuation
POLICY CHOICES
agent_scope_wait/ scheduler backoff while retaining the pending Vision obligation and the original admission identity in the frontier. No quota debit or successful-baseline receipt is fabricated.These are proposed conservative defaults, not a claim of a prior maintainer ruling. Maintainers may change the allowance, consumption point, scope or rearm rule.
Validation
build_quota_should_runwith disposable runtime and real File/SQLite authority; fresh Python process reads the durable admission and waitsautonomous_replan_required; same synthetic scenario on this branch waits after initializationPYTHONUTF8=1passes without a source/config changeLOOPX_USAGE_PING=0; Windows commands also usePYTHONUTF8=1):Frontend / Visual Evidence
Type of Change
LoopX Area
Technical Direction
Shared-authority RFC fixture impact
Boundary Checklist
Maintainer update
The updated branch integrates current
mainand preserves the original contributor commit.agent_scope_waitreceipt retains the pending Vision diagnosis. It carries no Todo or replan settlement binding, so replay of the same Turn stays quiet.Exact PR head
e94e81ea7310e3ec29992b685c523e661d720895. The focused suites passed 82 Python and 106 TypeScript cases. Typecheck, Ruff and the public-boundary scan passed. The final change after those runs preserves the Python AST and meets the changed-file line ceiling. Exact-head standard premerge is running. Independent review remains pending.