Repository navigation
fix(quota): separate pending retry identity from the earliest wakeup - #6265
Conversation
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>
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=xhigh
Approval conclusion (author-owned PR; GitHub blocks formal self-approval)
English verdict: APPROVE
Exact reviewed head: d0274a3d306cb800d7b9132ec300288e845fe9ab. Verdict: APPROVE for the bounded source increment. No blocking finding in this changed scope. The existing earlier/equal-monitor notice explanation gap is explicitly retained below; this is not global quota/host or long-term cost acceptance. Runtime attribution does not prove model-weight identity or active-turn liveness.
动机
使用现有 quota/heartbeat 入口、同时有待重试工作、未来监控和普通提醒的 Agent。
这里的重试是原执行记录指定的下一次检查时间。同一输入中,工作五分钟后可重新检查,独立监控二十五分钟后才到期,另有普通提醒;旧实现提示等待本人,新实现保留工作重试时间并明确提醒不阻塞。 误提示本人解锁,会增加不必要的介入;如果宿主照较长的等待执行,还可能推迟合法重检,实际累计延迟尚未测量。
实际 File/SQLite CLI 重放保持不扣业务额度、原 Todo OPEN、监控时钟/hash/generation 不变;组合输入显示 blocked_wait 和原到期时间。 本 PR 交付源码中的等待解释与时钟组合修复,不执行新业务、不授予权限、不自动安装或改宿主 timer。
更早或同刻独立监控拥有下一时钟时,普通提醒仍可能被解释成人工门禁;该旧缺口由现有 quota 恢复工作继续处理。本机安装、自然消费者下一窗口及长期净延迟/成本收益仍待采用后的证据。
改动思路
从现有 quota should-run 出发,canonical Todo 与已提交的 Run 提供事实,receipt overlay 只派生原 Agent/Todo 的暂时等待,TypeScript planner 负责比较到期时钟;既有 obligation adapter 再将工作等待、普通通知和实际 gate 分开,最终 interaction/scheduler 输出给宿主。实际 File/SQLite CLI 通过重放与独立冷读验证结果,原存储、claim、lease 和费用规则未迁移。
已有类型化 deadline owner 已承担完整来源时钟比较,既有 obligation adapter 已承担提醒与执行的分离;复用它们比丢缓存、增加并行决策源或额外配置更小且可验证。 本 PR 在既有 quota 入口修复更早 receipt retry 被较晚缓存遮住的等待旅程;更早/同刻监控的旧提醒解释缺口、安装和长期运行仍分别验收。
不修会保留已复现的较晚缓存遮挡;直接丢缓存会丢掉隐藏的更早时钟;只看显示八行会漏第九个更早 retry。先让独立第九时钟 oracle 击穿第一版,再复用已有完整来源 successor waits。缓存与 full-source union 都是已有数据的投影,无新配置/IO/权限。scope 和实际 gate 是不变量;调度下限是已有 policy;宿主更新是独立 effect,本 PR 不执行。
具体改动
七个现有文件,+153/-28:两个 production owner、三个 regression test、两个既有文档/checkpoint;无新增模块、CLI、protocol field 或 capability。独立规范为 docs/quota-allocation.md,固定 pre-change revision df826263926651ab9c50acee182ef96e2a60ff4b;本次新增解释不充当自己的验收依据。
bounded-retry:implemented,同 Goal/Agent/Todo/claim 的 retry 有界,独立工作保持可执行;due/newer run 重新走当前 guard。monitor-integrity:implemented,未来 unchanged monitor quiet,guard/重放不改变 due、hash、generation。notice-not-gate:deferred(局部已实现)。receipt retry 拥有下一时钟时通知不阻塞;独立 monitor 更早或同刻时仍有旧解释缺口。现有 quota recovery 工作继续处理多时钟的等待投影,不能以本 PR 宣称全局完成。no-spend-blocked:implemented,真实 File/SQLite blocked/replay 路径无业务 debit;这不表示所有后续工作免费。
关键代码讲解
projectTodoFrontierDeadline:原先有效缓存直接返回,现在把它保留为候选,仅让匹配 OPEN advancement、原 receipt、due/resume、Agent/Todo/claim 的更早 retry 竞争。非法或较晚 retry 保留原缓存及 extension;同 identity/time 去重,更新同 identity 不夸大 candidate count。返回的是重检时钟,不是执行权。projectTodoQuotaPlanning:在内部 deadline 计算前合并已有blocked_successor_items与显示 wait lane。第九个更早时钟可参与,而 wire/display 保持八行边界;没有新存储时钟。生产 caller 是现有todo.quota_planning.projecthandler 与 Python quota bridge。build_execution_obligation:已有 repair/独立工作优先分支之后,quiet monitor route 也可保留 pending retry;输出must_attempt_work=false、delivery_allowed=false,并要求到原 due 后重新检查全部当前 gate。完整 notice-only user lane 决定普通提醒不阻塞,实际 user gate 仍保留。
对主干的风险
重点反例是隐藏更早缓存、第九 retry、伪造/不匹配 scope、真实 gate、独立工作和到期后陈旧等待。最终四个相关 Python 文件46通过;相同两个测试 oracle 在固定 baseline 5失败/4通过,candidate 9通过。真实 File/SQLite CLI blocked refresh→guard→同 Turn 重放→cold readback 保持原 Todo OPEN、无 canonical resume、monitor due/hash/generation 不变、0spend。TypeScript 全集4444通过/37 optional skipped,typecheck、mypy19文件、Ruff、output budget、public/private scan 通过。
完整 Python 正确环境结果:20981 passed, 343 skipped, 9 warnings, 517 subtests passed in 5041.53s (1:24:01)。该运行始于 b824,期间只有 d027 的文档资格说明变化;两个 production 与三个测试文件 byte/hash 均相同,最终文档再走当前 head 的原生 premerge/scan,并未继承旧 verdict。两个较早全集均被中断,不能算通过;其中23个 Gitless fixture 失败在 unchanged baseline 逐个复现,三个对应文件在 repo 外临时根37通过。首次 size/Gitless smoke 的失败也保留:相同正确短临时根 base/head 均14929/15500,未放宽预算或删 assertion。19个 risk-selected premerge smokes 与直接检查通过,最终 exact-scope quality receipt/merge readiness 另有原生记录。
额外六个同输入公共 quota composition 反例覆盖无缓存注解、显示顺序、25个额外较晚监控、完成/superseded reference;原五分钟时钟与权限边界保持。再对更早3m/同刻5m monitor 做 paired probe,base/head normalized observation 完全相同:仍误解释 human_gate,但重检 interval 已分别有界为1/3m。这是明确剩余缺口;本修复不扩大它,也没有宣称解决。此前 consumer 能在实际 due 后恢复,故不能把潜在九分钟减少写成已观测线上收益。
语义与 CI 对齐
沿用既有 vocabulary、typed retry helper 和 EffectiveAction,无 prose/substring 分类、新 shared protocol 或 feature-off 宣称。旧“等待本人”改成“原执行记录的有界重检,普通通知不阻塞”,是 accepted contract 支持并在真实 caller 验证的语义修正;到期、scope、gate、独立工作、no-spend 和停止执行条件保留。默认行为改变已在双语 quota docs 及命名 regression cases 披露。development advisory 未见支持范围内的新 carrier,并非动态语义证明;semantic smoke 通过。按配置不查询/等待 GitHub CI。
我的整体评价
justified_increment;long_horizon=improved、user_experience=improved 限于较晚缓存/retry 拥有下一时钟的源码旅程:合法重检更准确,普通提醒减少错误介入,同 Turn 重放、due/newer run 和独立工作均保留。无需额外参数或确认步骤。真实宿主采纳、packaged installation、多个 Goal 的长期公平性、memory causal utility 与净延迟/费用仍未验收,不能由测试数推出。
维护成本是对已经投影的完整来源 waits 多一次 union/scan;没有新增 provider IO/持久字段或迁移。已做 bounded future-facing pass:撤掉丢缓存的平行 Python 判断,复用 typed owner;现有 transient request variants 与 persisted receipt 路径保留,不为这次修复另起大迁移。已有类型化 deadline owner 已承担完整来源时钟比较,既有 obligation adapter 已承担提醒与执行的分离;复用它们比丢缓存、增加并行决策源或额外配置更小且可验证。 本 PR 在既有 quota 入口修复更早 receipt retry 被较晚缓存遮住的等待旅程;更早/同刻监控的旧提醒解释缺口、安装和长期运行仍分别验收。 更早/同刻 notice gap 的下一 owner 是既有 quota recovery;需要区分“下一 clock”与“所有 pending waits”,保持单一 typed authority。源码审批不授予合并、自动安装或宿主 timer 修改权。
Motivation
An agent using the existing quota/heartbeat entrypoint may have receipt-owned retrying work, a future monitor and an ordinary reminder at the same time. In the concrete case, work can be rechecked after five minutes while the independent monitor is due after twenty-five. Previously the later cache hid the earlier retry, and the reminder produced a false owner-unlock explanation with a fifteen-minute suggestion. The repaired composition retains the work retry and makes the reminder non-gating when that retry owns the next deadline. Unnecessary intervention and delayed rechecking are plausible costs; accumulated live delay was not measured.
Real File/SQLite CLI replay preserves zero work debit, the original OPEN Todo and unchanged monitor due/hash/generation. This PR delivers a source wait/clock correction; it performs no new business operation, grants no permission, installs nothing and changes no host timer. Earlier/equal independent-monitor notice explanation remains defective at both revisions and belongs to existing quota recovery work. Installation, a natural subsequent consumer window and sustained net latency/cost still require separate evidence.
Approach
Canonical Todo and committed Run facts enter the existing receipt overlay. The TypeScript quota planner owns deadline comparison; the existing obligation adapter distinguishes work waiting, ordinary notices and actual gates before the interaction/scheduler packet. File and SQLite CLI replay plus independent cold reads test the real consumer boundary.
The established typed owner and obligation adapter fit this responsibility more closely than dropping caches, adding a second decision owner or introducing configuration. Doing nothing keeps the reproduced defect; cache invalidation loses hidden earlier clocks; scanning eight display rows misses a ninth earlier retry. A failing independent ninth-clock oracle prompted reuse of the existing full-source successor waits. This reversible increment repairs the later-cache source journey. The unchanged earlier/equal-monitor explanation requires a distinct multi-clock projection judgment, while installation/host effects have their own authority and readback boundaries. Scope and gates remain invariants, cadence floors remain existing policy and no provider IO/effect is added.
Changes
Seven existing files, +153/-28: two production owners, three regression files and two existing contract/checkpoint documents. No new module, CLI, capability, protocol field or persisted state. The independent accepted specification is docs/quota-allocation.md at pre-change df826263926651ab9c50acee182ef96e2a60ff4b.
bounded-retry: implemented; exact receipt scope only, independent work remains eligible and due/newer work uses the current guard.monitor-integrity: implemented; quiet unchanged monitors retain their due/hash/generation through guard/replay.notice-not-gate: deferred globally, implemented where receipt retry owns the next deadline. Earlier/equal monitor explanation stays with existing quota recovery and must not be called complete.no-spend-blocked: implemented in actual File/SQLite blocked/replay paths; later work is not declared free.
Key code walkthrough
projectTodoFrontierDeadline at line328 retains the full-source cache as a candidate and compares only earlier legitimate OPEN advancement receipt retries with matching due/resume/Agent/Todo/claim. Invalid or later inputs preserve the cached clock/extensions; duplicates and same-identity replacement do not inflate candidate population. Its result is a recheck deadline, not execution authority.
projectTodoQuotaPlanning at line376 unions the existing full-source blocked_successor_items before internal deadline selection. This includes the ninth earlier retry without widening the display or wire schema. Existing typed handler and Python quota bridge are active production callers.
build_execution_obligation at line11 preserves pending retry on the quiet monitor route after repair and independent-work precedence. It forbids delivery, requires a current recheck at original due and all current gates, and treats the complete ordinary notice lane as non-gating. Actual user gates remain in force.
Mainline risk
The decisive negatives are hidden earlier caches, the ninth retry, forged/mismatched scope, actual gates, independent work and obsolete waits after due/newer runs. Four focused Python files pass46 cases; the identical two regression oracles give base5 failures/4 passes and candidate9 passes. Disposable File/SQLite CLI refresh→guard→same-Turn replay→cold readback preserves OPEN/no canonical resume, monitor facts and zero spend. Full TypeScript passes4444 with37 optional skips; typecheck, mypy19 files, Ruff, output budget and public/private scans pass. Full Python under the proper environment: 20981 passed, 343 skipped, 9 warnings, 517 subtests passed in 5041.53s (1:24:01). The run started at b824; only the d027 documentation qualification changed while it ran. The two production and three test files remain byte/hash identical, with final documentation checked again through current-head native premerge and scan. No prior verdict is inherited.
Two previous full runs were interrupted and remain incomplete. The same23 inside-Git Gitless-fixture failures reproduce individually on unchanged base; the three affected files pass37 cases outside the repository. The earlier size/Gitless smoke failures were recovered without changing assertions, workload or budgets: identical proper temporary roots produce14929/15500 characters on base/head. All19 selected premerge smokes and direct checks pass; final native quality/readiness receipts are separate records. No CI rollup, polling or waiting was used.
Six paired public quota-composition counterfactuals also cover absent redundant cache, reversed display,25 extra later monitors, completed and superseded references. Earlier/equal3m/5m independent-monitor probes produce exactly the same normalized base/head observations: the old human-gate explanation persists but intervals remain bounded at1/3m. That limitation is disclosed rather than relabeled fixed. A consumer's eventual due-time recovery does not prove measured live latency savings.
Semantic and validation alignment
Existing typed vocabulary/helpers and EffectiveAction are reused. No substring classifier, new shared protocol, feature-off assertion or wider authority model is introduced. The decision text intentionally changes a false owner unlock into a scoped receipt recheck with a non-gating notice. Accepted-contract validation preserves actor/scope, ordering, due/gate, independent work, no-spend and stop conditions; model comprehension remains unmeasured. Bilingual docs and named regressions disclose the default correction. The advisory found no supported new vocabulary carriers, which is not dynamic semantic proof; the semantic smoke passes.
Overall assessment
APPROVE, justified_increment, with long_horizon=improved and user_experience=improved only for the later-cache/receipt-owning-next-deadline source journey. Legitimate rechecking becomes truthful, mistaken owner intervention is reduced and replay/lifecycle/independent work are retained without new setup or confirmation. Installed host adoption, packaged readback, sustained multi-Goal fairness, memory causal utility and net latency/cost are not established by these test counts.
Cost is one union/scan of already-projected full-source waits, with no new provider IO, persisted contract or migration. The bounded simplification pass removed the proposed parallel Python cache-invalidating rule and reused the current typed owner; existing evidenced request/receipt compatibility remains. The existing quota recovery owner must separately distinguish the next deadline from all scoped pending waits for the earlier/equal notice gap. No blocking finding remains in this bounded changed scope; that gap and unmeasured installed/host/long-term behavior are the strongest remaining evidence limits. This approval grants no merge, installation or timer authority.
…notice-scheduler 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
left a comment
There was a problem hiding this comment.
Reviewer: model_agent | gpt-6.1-sol | OpenAI | runtime_reported | reasoning_effort=xhigh
Approval conclusion (author-owned PR; GitHub blocks formal self-approval)
Exact reviewed head: 3d4f24543b64aa416f0124f95cc34dc41676c188. Current whole main-to-head review; no prior verdict inherited.
动机
使用现有 quota/heartbeat 入口、同时处理重试工作、独立监控和普通提醒的 Agent。
重试工作五分钟后可重检,独立监控更早或同刻到期,另有普通提醒;旧版本把等待说成需要本人解锁,新版本保留原重试身份并明确提醒不阻塞,同时仍按最早时钟唤醒。 重试指原执行记录给出的下一次检查时间,并非新的执行授权。误提示本人解锁会制造不必要的介入,也会丢掉后续重检依据;线上累计延迟及费用尚未测量。
真实 File/SQLite 的 refresh→guard→同 Turn 重放→冷读回保持原 Todo OPEN、monitor 时钟/hash/generation 和零业务扣额;真实 gate 与独立工作各自保留。 本 PR 交付既有入口的源码修复;不授予权限、不改变活动宿主 timer、不合并或安装。
安装采用、自然 Host 后续窗口、多个 Goal 的长期公平性与净延迟/费用仍需独立证据。
改动思路
单一 typed batch 同时派生等待身份和最早时钟,既有 Python adapter 只投影结果与调度;无需新增状态、配置或第二个决策源。 本 PR 在既有 quota 路径交付完整的多时钟提醒解释、重放和读回;安装、维护者合并及长期 Host 效果分别验收。
canonical Todo 和已提交 Turn 提供事实,既有 overlay 校验 scope/claim/due/newer run;todo.quota_planning.project 从完整来源同时读出“哪个工作仍等重试”和“最早什么时候唤醒”。两者可以属于不同 Todo。既有 obligation/interaction adapter 再区分普通通知、工作等待、真实 gate 与独立工作,scheduler 复用已有 frontier recheck plan 后应用 owner floor。
最强反对理由是只改文案却延迟早到监控,或者新增需要手工同步的状态。直接把重试当作所有 next deadline 会延迟监控,丢缓存会漏隐藏时钟;本实现保留两种事实并用独立时间 oracle 验证。一次共享循环与一个 optional derived projection 已足够,无新参数、权限或 provider IO。
具体改动
完整 PR 十个现有文件,+221/-36:五个 production 路径、三个 regression 文件、双语 quota 文档和原 S7 checkpoint;无新增模块。对照规范 docs/quota-allocation.md,固定 pre-change revision b760c1eb35613ac84a03cb17246eaba9030db062,本次文档改动只披露语义修正,不作为自己的验收依据。
bounded-retry:implemented;同 Goal/Agent/Todo/claim 的有界等待,到期/newer run 重新走当前准入。notice-not-gate:implemented;更早、同刻、较晚 monitor 都不把普通 user_action 变成 gate,真实 gate 保留。monitor-integrity:implemented;独立工作可继续,最早时钟以及 monitor due/hash/generation 保持。no-spend-blocked:implemented;真实 File/SQLite blocked 与 replay 路径0spend、原 Todo OPEN,无新增 canonical resume。
关键代码讲解
projectTodoFrontier(quota_selection.ts:328)在既有完整来源循环中,只认合格的 receipt retry。frontier_deadline仍保留更早/同刻监控及 cache extension,optionalblocked_retry_wait单独保留最早的合格 pending retry。非法 scope/claim/resume/due 不产生该投影。projectTodoQuotaPlanning(quota_selection.ts:385)复用已有blocked_successor_items,先完成内部判断再限制显示八行;第九个更早 retry 不会被显示 cap 遮住。原 v0–v3 request 与 receipt 格式保留。_build_active_quota_payload(should_run_packet.py:1280)只有明确完整的 ordinary-notice-only lane 才把等待解释改成 blocked_wait。已有 repair/独立工作/真实 gate 优先级保持,summary 是 TS 结果的 transport。_receipt_retry_wait_profile(scheduler_hint.py:642)保留原 retry 的身份/due 与 execution_authority_granted=false,再以既有最早 frontier 截短 recheck,并最终服从 owner floor。第一版只保留 retry 会把早到1m变成3m;独立 oracle 先失败,当前修复保留1m。
对主干的风险
同一公开 oracle:固定 main 的 context6失败/13通过,当前 context 与真实 CLI 合计39通过。最初在已集成 pre-change source 的真实 File/SQLite 更早/同刻提醒四例失败、四个 gate/独立工作控制通过;当前相同隔离 clock harness 八例通过。refresh→guard→同 Turn replay→独立 cold readback 保留 OPEN、原 canonical resume、monitor due/hash/generation 和0spend。
另对固定 main 与当前 head 执行相同六个公开 quota API counterfactual:无冗余 cache、反向 display、25个额外 monitor、完成/newer reference。当前四个等待变体均 quiet_wait3m、原 due 保持;后两个恢复 active work。直接 typed owner 还覆盖第九隐藏 retry、坏 claim/due/resume、缓存 extension 和不同请求版本。TypeScript 全集4448通过/37 optional skipped,直接 owner19通过,邻接 retry/settlement 单元77通过。tsc、mypy19文件、changed-scope Ruff、语义 advisory→full-tree、291-site IO census 与 public/private scan 通过。风险 premerge:4个 direct、10 catalog、8 risk、1 boundary 均通过,无 manual hold。
更广 settlement CLI 98通过/3失败:现有 scheduler ACK 在结算后仍拒绝空 host observation 对比应用的3m,固定 base/head 三个相同 nodeid 的完整独立失败记录对照;该原问题未修复。whole Ruff 两个失败也在固定 main/current 完全相同(content_ops lambda、codex_auth unused import),changed-scope Ruff 通过。原失败保留,不选择性报全绿、不缩 scan 或断言。私有旧 clock probe 的首次 true-gate setup 在“原工作先准入”阶段错误保留 blocks_agent,base/head 同样拒绝;纠正 fixture 后才重新验证真正 gate update,失败过程保留。当前源码不改变其 gate 规则。
语义与 CI 对齐
blocked_retry_wait 是现有 typed quota read model 的 optional derived field,复用 quota_blocked_retry_v0,不是新持久 state、生命周期或并行权威。无合格 retry 时字段缺席;普通提醒从错误 owner gate 改为原 Turn 重检说明,身份、原 due/gate、独立工作、no-spend、停止条件与 cadence floor 保留。此自动默认解释修正已在双语 docs 和命名回归披露。没有 opt-in/default-off 功能承诺;未把安装或 profile 视为激活或权限。语义 inventory 的45个未证明 producer 仍有分析边界,绿检查不等于全局语义或模型理解证明。按当前配置不查询、轮询或等待 GitHub CI。
我的整体评价
APPROVE for the bounded source proposal / justified_increment。长期效果和体验在已验证 caller 中正向:重放不丢原等待依据、独立工作不被提醒拦住,避免错误地要求本人介入,保留更早监控重检。源码证据不等于自然 Host 的实际采用或长期净收益。
单一 typed batch 同时派生等待身份和最早时钟,既有 Python adapter 只投影结果与调度;无需新增状态、配置或第二个决策源。 本 PR 在既有 quota 路径交付完整的多时钟提醒解释、重放和读回;安装、维护者合并及长期 Host 效果分别验收。 已做 future-facing bounded pass:同一个 typed reducer 保留两个事实,复用既有 recheck plan,保留真实旧 cached summary/receipt 兼容;未增加手工字段、重复扫描/provider call、单独配置页或无用框架。新增 packet 字节和内部比较仍有成本,未实测净 CPU/token/费用;没有宣称省了多少分钟。安装采用、自然 Host 后续窗口、多个 Goal 的长期公平性与净延迟/费用仍需独立证据。 现有 quota/runtime owner 继续承担这些验收及独立 ACK 问题;本评价不授予合并、升级、timer 修改或 provider write 权限。
English verdict: APPROVE - 3d4f24543b64aa416f0124f95cc34dc41676c188; independently retain receipt retry identity and earliest wakeup. Real File/SQLite replay/gate/independent-work cases and risk validation pass. Unchanged ACK3/Ruff2 failures, installed adoption and sustained net cost remain separate limitations.
A pending work retry and the next independent monitor wakeup can belong to different Todos. Preserve both through the existing typed full-source quota batch, so an ordinary reminder stays non-gating at earlier, equal or later monitor clocks while the earliest wakeup, real gates and other runnable work retain their rules. Cached hidden deadlines and the ninth retry remain visible to the decision owner; no new configuration, persistent state, permission or host timer effect.
待重试工作与下一次独立监控唤醒可以属于不同 Todo。复用原 typed quota owner 同时保留两种事实,修复更早/同刻/较晚监控下普通提醒误变成人工门禁的问题;最早时钟、真实 gate、独立工作、原 receipt 与费用边界保持。这是完整有界源码提案,安装及自然 Host 长期净效果另验。
Validation / 验证: