Skip to content

fix(quota): expose writeback inputs in settlement guidance - #7174

Merged
huangruiteng merged 1 commit into
mainfrom
codex/turn-context-merged-qualification-20261024
Oct 24, 2026
Merged

huangruiteng merged 1 commit into
mainfrom
codex/turn-context-merged-qualification-20261024

Conversation

@loopx-agent

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

Copy link
Copy Markdown
Collaborator

Goal And Delivered Outcome

Ordinary quota callers receive a refresh-state command with placeholders but without its accepted scale/outcome values or evidence-ID syntax. Repeated full-help reads in authorized diagnostic trajectories exposed this avoidable discovery step. The returned settlement guidance now includes those inputs beside the command, using the existing vocabulary owners.

  • Basis: maintainer-requested basic input-efficiency improvements supporting the context-cost convergence work in docs(rfc): design subtree context reuse with automatic full fallback #7166.
  • Before → after: the new real CLI test fails on the missing scale hint before the change, then executes the returned command and settles exactly once on File and SQLite, with both Codex App and generic CLI profiles.
  • Intended base: main; implementation baseline bd67d651ac175a0ac36b3258e83f97c20a703578.

Author Declaration

  • Written by: model_agent — OpenAI Codex.
  • Specification: this bounded repair request; related acceptance is “Context cost and projection convergence: next implementation slice” in docs/architecture/rfcs/agent-loop-effect-interpreter-v0.md at the baseline above.
Criterion Disposition Implementation / evidence
Make ordinary generated writeback commands fillable without global help implemented Existing durable_writeback.precondition; real File/SQLite CLI regression
Share quota/Turn execution facts and preserve settlement semantics implemented for this slice Existing TS settlement owner; TurnEnvelope plan equality; commands/order/identity unchanged
Measure total model input and detail reads; qualify both real hosts deferred to existing #7166 program No model-saving or installed-host adoption claim; frozen experiments untouched

Self-check: reviewed the changed command-authoring prose against the CLI validators and existing semantic-closeout/Monitor requirements. The old precondition remains intact. No new question, approval, admission rule, public command/field or default was introduced. The Python adapter supplies CLI-owned scale choices; the TS owner reuses the current outcome, boundary and progress vocabularies.

Scope And Continuation

Complete as a command-discoverability proposal. This adds 968 UTF-8 bytes to the settlement precondition in four same-input Todo/replan and closeout/continuation comparisons. The current full command help is 17,684 bytes. These sizes describe the tradeoff, not measured savings: repeated delivery of this hint also costs input, and only subsequent trajectories can establish reduced help reads and total cost.

The accepted subtree-delta program remains open; no host delivery/epoch seam, benchmark launch, scoring change or installed App qualification is supplied here. The existing experiment owner continues the frozen runs and evaluates adoption through its normal integration boundary. Lease-command discoverability remains outside this narrow fix. No additional framework or parallel projection was introduced.

Validation

  • Tested revision: 23a46a88219cd1c9bb7153edec80bf24b2f036ac.
  • Run state: finished.
  • Input classes: synthetic; authorized_private_read_only for diagnostic motivation only. No raw material is included.
Check kind Result Evidence / limitation
real_entrypoint / real_backend passed File/SQLite × Codex App/generic CLI: generated guard → refresh → spend → replay; malformed evidence and premature spend rejected; Todo remains open
unit / integration passed uv run --extra test pytest tests/control_plane/test_settlement_command_guidance_cli.py tests/control_plane/test_quota_settlement.py tests/control_plane/test_protocol_packet_retirement_cli.py: 80 passed
unit / static passed TS settlement tests: 5 passed; npm run typecheck:control-plane passed
regression_parity passed Removing only the new guidance suffix leaves four same-input plans identical to baseline, including original instructions, commands, identity, order and vision rules
static passed Diff-scoped semantic advisory: no new supported vocabulary carriers; public-boundary scan clean across all five files; bilingual staged check passed, no RFC pair changed
regression_parity passed Standard premerge on the fixed commit: 4 direct checks, changed-file Python compilation, 5 catalog canaries and 8 risk-profile smokes passed
static failed An earlier premerge run observed author staging while it was running and reported tracked side effects; retained as invalidated validation, then rerun on the fixed commit
static blocked Broad loopx check also encountered two unrelated legacy Goal authority lookups in the local registry; its changed-file public-boundary scan passed. No live Goal migration attempted

Coverage: the changed shared CLI projection and actual File/SQLite settlement paths are exercised. This does not prove agent compliance, reduced tokens, material-closeout model authoring, packaged/installed Codex App behavior or benchmark adoption. No authority-store implementation or PostgreSQL routing changed; no PostgreSQL performance qualification is claimed. CI and maintainer review remain separate.

Current CI limitation

The packaged browser shard failed at the Goal hierarchy Back-navigation assertion: it expected the local portfolio row but still displayed Remote B. CI used merge c1c36e15f4e33770efb8edb49c7c24e3f1ee5a59 (this head into the declared baseline). The targeted packaged scenario passed locally after rebuilding the bundle from this exact head. Scenario, frontend and workflow sources are unchanged from the baseline; that fact and a local pass do not establish the cause or clear the CI failure. Other checks and maintainer review remain pending.

同一提交的浏览器 CI 在 Goal 层级的后退导航断言失败。本机按该源码重新构建包后,针对场景通过;相关页面、场景和工作流与基线一致,但尚未证明失败原因,CI 失败仍保留。此结果不代表整体验收、合并资格或 token 收益。

Frontend / Visual Evidence

  • UI impact: none. Existing agent-facing CLI guidance only; no new capability, settings or viewport. Codex App profile coverage is source-checkout CLI coverage.
  • Before/after, first viewport and preview: N/A.
  • Source data: none for visual evidence.

Type of Change

  • Bug fix
  • Test update

LoopX Area

  • Control plane (goals, todos, quota, scheduler, registry, runtime)

Shared-authority RFC fixture impact

N/A: no shared-authority migration, promotion or runtime-routing change.

Boundary Checklist

  • No private state, raw traces, verifier output, credentials, internal links or local machine paths in the diff or PR.
  • Existing benchmark work was coordinated; no duplicate run or experiment mutation.
  • Scope remains the command-discovery repair above.
  • No paired RFC changed; bilingual check passed.
  • UI impact is none.
  • Commit includes DCO sign-off.

Additional CI qualification

At the unchanged head above, test shards 3, 4 and 5 finished with 133 failures / 3 errors, 139 / 3, and 148 / 7, respectively. They include canonical-authority fixture failures, but the complete failure set is not attributed. A bounded independent comparison ran the same three representative cases on base bd67d651ac175a0ac36b3258e83f97c20a703578 and head 23a46a88219cd1c9bb7153edec80bf24b2f036ac: lane selection (test_agent_scoped_derivation_prefers_own_lane_todo), digest shape (test_schema_string_site_is_the_same_question_as_the_owner_bare_shape) and the SQLite native-launcher writer fence (test_launcher_binds_ack_to_current_host_readback[matches-sqlite-unix]). All three failed on both revisions with the same assertions/reasons. This excludes this PR as the introduction of those three failures only; it does not clear the remaining CI failures or the earlier browser failure. The focused passing qualification remains separate from full-suite status.

中文:新增完成的三个 CI 分片仍失败;选取的三项代表性失败在 base/head 均复现同一原因,仅能排除这三项由本 PR 引入。其余失败及既有浏览器失败尚未归因,不宣称完整 CI 通过,也不以此放宽合并或实际采用验收。

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

动机

普通 CLI Agent 在完成一段可验证工作后,需要填写系统返回的回写命令并继续下一段工作。

旧版命令保留占位符,却没有就地列出有效取值和证据 ID 语法;新版在同一位置给出这些输入,调用方可以直接完成回写与结算。

独立 File/SQLite 与两种调用配置的同输入对照确认:新增参数提示可见,正确回写可执行,错误证据和提前扣额仍被拒绝,重放不重复扣额。

本次不交付增量上下文、安装版 App 资格或模型节省结论,也不改变运行中的实验。

完整模型输入成本、后续 Agent 是否减少帮助读取,以及产品化宿主的上下文连续性仍待既有上下文收敛工作验证。

改动思路

复用现有结算投影及输入词表,不增加状态、命令或第二个策略所有者;这是能通过真实调用单独验证和回滚的参数发现修复。

本 PR 只扩展既有结算步骤的输入提示,保持验证、回写、扣额和条件收尾的执行所有者不变。

这里的实际任务是完成工作后的可靠回写,而不是让操作者配置一个新能力。最短合法路径仍是现有的验证、回写和结算,不增加确认、导航或复制状态的步骤。Python 只传递 CLI 已接受的规模选项;TypeScript 从既有词表取得结果、边界与进展类别。没有新决策服务,也没有把帮助文字变成第二份状态。

同一触发 基线 此 head
填写系统返回的回写命令 有占位符,缺少就地取值说明 同一命令旁列出合法值及 ID 规则
错误证据/提前扣额 拒绝;修正后可继续 同样拒绝;修正后可继续
回写后重复结算 幂等,不重复扣额 幂等,不重复扣额

这是源代码与实际 CLI 对照表,没有使用未验证的渲染图作为证据。

具体改动

审查的是完整 bd67d651ac175a0ac36b3258e83f97c20a703578...23a46a88219cd1c9bb7153edec80bf24b2f036ac。五个文件共增加 115 行、删除 2 行,其中运行时只是既有投影的输入与文字扩展,其他为回归验证。实际调用者包括 quota、Todo、turn-decision、未结算回合恢复和 accountable settlement;没有新增无人调用的帮助层。

关键代码讲解

  1. build_turn_scoped_cli_settlement_plan 在 L202 传入 DELIVERY_BATCH_SCALE_INPUT_CHOICES,保留原命令模板、Agent/Goal/Todo 或 replan 绑定与顺序。所有在库生产调用都经过这个共同入口。
  2. turnScopedCliSettlementPlan 在 L23-L36 校验派生的规模列表并构造新增提示,再追加到原 durable_writeback.precondition。它不做 IO、不批准工作、不扣额;实质收尾仍保留完整 vision 义务,进行中的工作仍保持 Todo 开放。
  3. test_returned_writeback_can_record_progress_and_settle_once 走真实 CLI 与 File/SQLite 存储,覆盖错误 ID、提前扣额、正确回写、结算重放和独立 Todo 读回;不是由 mock 直接提供所需结论。

规范依据:docs/architecture/rfcs/agent-loop-effect-interpreter-v0.md,固定版本 bd67d651ac175a0ac36b3258e83f97c20a703578。在该既有收敛章节中逐项对齐,以下标签取自原规范的验收行或小节:

  • Reconcile execution/context requirements across heartbeat and TurnEnvelope:本次结算片段 implemented;V1/V2/V3 证明旧控制字段与原义务保留,未宣称整个验收流完成。
  • One projection owner, two transport consumers:本次提示片段 implemented;共用现有 TS owner 与返回 plan,V1/V2/V5 验证普通 CLI、TurnEnvelope 及 MCP 边界。
  • Qualify the context shape and migration default:deferred 至既有 #7166;当前没有完整模型输入、费用或效果资格。
  • Retain full current authority and cold-start requirements:本次片段 implemented;四组精确 plan 对照仅移除明确新增的后缀,原字段、命令、顺序与全文相等。
  • Automatic full fallback, with no new human gate:deferred 至既有 #7166 的宿主连续性与 full/delta 实现;本 PR 没有增加 delta 或人类 gate,原 full 路径继续。

独立验证:V1 为四个相关 Python 测试模块,102 passed;V2 为同一合成夹具在基线和 head 各执行 File/SQLite × Codex App/generic CLI,八条真实链路的结果和拒绝诊断相等;V3 为 Todo/replan × 收尾/继续的四组完整 plan 对照;V4 将新增真实 CLI 回归原样运行于基线,四例均在缺失 test_only 提示处预期失败,head 对应四例通过;V5 为 TS 五项测试;V6 为 standard premerge、typecheck、双语差异和语义 advisory,均通过。校验环境为 source checkout,未借用活跃 Goal 做故障试验。

对主干的风险

最强反例是模型仍继续读完整帮助,此时新增提示只会增加重复输入。独立测得每份提示增加 968 UTF-8 字节;真实 CLI 这段 precondition 从 904 增至 1,872 字节。不能把它叫作已验证的 token 或费用节省,也不能以当前测试替代后续模型采用证据。作者明确披露这个代价,未把完整上下文项目缩成字节修复。

内部 TS 请求现在要求派生规模列表。在库调用检索表明生产请求统一经过同版本 Python builder;没有发现需要独立升级的旧生产消费者。因此保留一个共同 producer/consumer 比增加缺省值或旧版本分支更合适。旧持久化 receipt 与重放格式没有更改。既有严格证据 ID、收尾条件、Monitor 的不扣额例外与等待规则均保留,正反链路也验证了纠错后能继续有用工作。

这不是 optional feature:TurnEnvelope 关闭时普通 CLI 也会收到新增文字,开启时复用同一 plan;这里不声称关掉 TurnEnvelope 后输出字节不变。新增提示是 authoring guidance;原来的验证、必要读取及结算是强制约束,错误输入仍拒绝。没有新执行权限、默认 outcome、领域专用状态判断或新的确认步骤。

语义与 CI 对齐

采用现有词表,没有引入新的共享闭集。diff-scoped advisory 未检测到新的受支持词表载体,限制仍是动态语义不能靠该扫描证明。逐条检查了 actor、顺序、模态、证据来源、作用域、继续与停止条件:原指引逐字保留,新增 ID 不是文件上传或进展证明。standard premerge 的直接检查、Python 编译、维护性检查、5 个 catalog canary 和 8 个 risk smoke 全部通过,TypeScript 类型检查通过。wait_for_ci=false,本审查未查询或等待 CI。没有更改 authority-store、PostgreSQL 路由、评分或宿主输入组装,所以没有扩张到这些运行资格。

我的整体评价

结论是 justified_increment / APPROVE,仅针对 23a46a88219cd1c9bb7153edec80bf24b2f036ac。long_horizon=preserved:既有后续工作、开放 Todo 与幂等结算行为保留;user_experience=improved:普通命令作者可以在原入口看到必要输入,不新增人类往返。净成本与模型采用仍未知,不能作为效果提升的证明。

只改变既有 CLI JSON 中的指引文字,检查了 quota、Todo、replan、TurnEnvelope 和 MCP 消费路径,没有渲染页面或布局变化。

无适用的视觉范围;安装版 App 与模型行为没有在本审查中资格化。

保留当前小范围设计比新建服务或复制词表更合理,后续完整输入收敛继续沿 #7166 的原宿主和 typed owner 推进。本审查未发现需要当前修复的阻塞项;不授予合并、安装或热更新实验的权限。源代码验证通过与主干合并资格、产品安装及长期收益仍是分别判断的事项。

English verdict: APPROVE 23a46a88219cd1c9bb7153edec80bf24b2f036ac. Independent base/head CLI and plan comparisons preserve settlement semantics while exposing canonical authoring inputs. The 968-byte addition is a discoverability repair; net model savings and installed-host adoption remain unproven. No merge authority is granted.

@loopx-agent

Copy link
Copy Markdown
Collaborator Author

补充读回(同一 head 23a46a88219cd1c9bb7153edec80bf24b2f036ac):PR 正文现已披露 packaged browser 的 Back 导航 CI 失败,并明确保留原因未证实及原失败。本审查遵循 wait_for_ci=false,未查询或重跑该 CI;作者报告的本机单场景通过不能替代其根因证明。上面的 APPROVE 结论限于独立验证的源代码 CLI 参数发现修复,不代表所有 CI 或安装旅程通过。

精确 head 的 approval-closeout 读回为 hold: exact_head_approval_missing,GitHub reviewDecision=REVIEW_REQUIRED。本次同账号 COMMENTED 审查是支持该源码修复的记录,不能冒充 GitHub 正式审批,也不授予合并权限。未执行合并。

English: the source-review conclusion is preserved; the disclosed browser CI failure and separate approval/merge hold remain open. No CI cause or end-to-end qualification is claimed.

@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)

Exact head: 23a46a88219cd1c9bb7153edec80bf24b2f036ac。没有阻塞性发现;评审覆盖全部五个文件。

动机

从普通 quota 守卫领取工作并填写写回命令的 Agent。

过去返回的命令含未解释占位符,填写投递规模和证据 ID 还需额外查帮助;现在原计划旁直接给出合法输入。

同一 File/SQLite 输入能够填写原返回命令、完成一次写回与扣额,并拒绝坏证据和提前扣额。

不改变准入、完成声明、租约、停止或扣额权限,不声称减少模型 tokens、正式宿主采用或长期净收益。

完整上下文增量交付、正式宿主采用与实际总输入成本仍由原 #7166 工作验收。此处批准的是原命令的可发现性修复,不据此关闭父级收敛工作。

改动思路

复用同一个 TS settlement 投影,把已有枚举送到原写回步骤;没有第二套决策、持久配置或执行器。

本 PR 的交付边界是普通 CLI 写回参数可发现性;不把它当作上下文增量协议的完成。

Python 适配器传递真正 CLI 接受的投递规模,TypeScript 从原 owner 读取成果类别、交付边界和进展类别,再把说明附在原写回步骤之后。原身份、命令、顺序、完成与 Vision 条件保持。指引解释如何表达实际结果,验证器仍负责拒绝不合法的表达;填完参数不会自动成为成果或执行许可。

不改会保留真实缺口,单独要求读取全局帮助仍增加一次取数。当前方案没有新增命令、配置或兼容分支。最强反对理由也成立:每次附带的文字有持续输入成本,不能仅凭避免一次帮助阅读就宣称总体更省。这个代价在 PR 中已披露,后续净收益由原集成工作验证。

具体改动

修改前验收依据:spec_ref docs/architecture/rfcs/agent-loop-effect-interpreter-v0.md,spec_revision bd67d651ac175a0ac36b3258e83f97c20a703578,其中 “Context cost and projection convergence: next implementation slice” 及其既有增量交付边界。没有用本 PR 的新说明证明它自身正确。

criterion_id 本 head 的判断
projection_owner implemented:原 Python/TS settlement owner 及 quota/TurnEnvelope 消费链保持,未增加准入服务或执行器。
current_authority implemented:原身份、命令、顺序和所有旧前置条件完整保留;真实拒绝、恢复与重放通过,没有新增本人确认。
full_first_delta_and_total_cost deferred:完整增量协议、宿主连续性与总模型输入成本继续由既有 #7166 集成工作验收;本 PR 没有声称完成或节省。

关键代码讲解

  1. build_turn_scoped_cli_settlement_plan 保留原精确命令构造,只从 CLI 的 DELIVERY_BATCH_SCALE_INPUT_CHOICES 传入当前可写值。历史只读别名不会被推荐为新写入值。
  2. turnScopedCliSettlementPlan 在原 durable_writeback 前置条件后追加说明。值来自现有 owner;证据 ID 的长度、ASCII 起始及字符集与当前写入校验一致。缺失、空或错误类型的内部列表会拒绝,未新增猜测式 fallback。普通完成、进行中继续与自主复盘仍保留各自的完成/Vision 边界。
  3. build_accountable_work_item_settlement_plan 是未修改的真实消费者,继续按原 App、generic CLI 等 profile 选择共享计划。新测试实际执行返回命令,而不是只验证新字符串存在。

五文件共 +115/-2,其中两个生产文件 +23/-2,其余为三处测试。没有新增数据存储、公共参数、actor 生命周期或持久兼容格式。Python 与 TS 桥接事实共同部署,全部实际调用者经过同一适配器;无需为未发现的外部调用者增加版本分支。

对主干的风险

最危险的情形是说明看起来更完整,却与原校验冲突、覆盖旧义务,或让一次工作重复扣额。我用同一份克隆的合成规范状态和相同绝对夹具路径,在不可变 base 与本 head 分别执行 File/SQLite × App/generic CLI。八份完整计划仅写回前置条件增加 968 UTF-8 字节;隔离这段明确新增的后缀后,所有原字段和原前置条件逐字相等,没有归一化身份或义务。Todo/复盘与 material/in-flight 的四种 builder 分支也分别比较。

独立真实入口断言在 base 因缺少合法规模提示而退出1,在 head 通过。两边都拒绝前导点文件路径式证据 ID 与提前扣额;合法写回随后成功,重复 spend 读回幂等,且每个场景仅一份扣额记录、Todo 仍 open。当前四个完整 Python 模块 237 passed / 0 failed / 0 skipped。完整控制面 TS 5,396 passed / 0 failed / 75 skipped,typecheck 与 owning TS 五项通过。标准 premerge 的六个直接检查和13个选择检查通过,没有 warning 或 manual hold;变更文件公开边界检查通过。

75 个跳过均是现有、需隔离 PostgreSQL URL 的可选存储/服务等用例,未改记通过。本 diff 不改存储、路由、事务或权限实现,因此没有将它们升级为本投影修复的必需条件;没有声称本轮 PostgreSQL 资格。全库 Python、正式 App 和真实模型未运行。本轮没有查询 CI;作者报告的较早 staging 干扰与本地注册查询失败保留其原始边界,没有冒称本轮修复。

语义与 CI 对齐

复用既有词表;classification 仍是描述标签,机器进展来自 typed result 和证据身份。新增文字是参数表达指引,原验证、完成、Vision 与结算义务仍被强制执行;最后一句明确这些选项不是默认值、成果证明或新要求。原 Monitor 无观察时的 blocked/no-spend 以及已提交 poll 无需 refresh/spend 条款完整保留。改动有意默认展示在原计划中,没有伪称为 default-off 功能;不变的未支持 profile 路由仍由原 owner 决定。

我的整体评价

结论 APPROVE,是有实际 CLI 消费者的 justified_increment。long_horizon 判定 preserved:原承诺、继续/完成分界、恢复和一次扣额保持;user_experience 在 CLI 参数可发现性上 improved,未推断模型实际理解或净效率收益。

复用同一个 TS settlement 投影,把已有枚举送到原写回步骤;没有第二套决策、持久配置或执行器。本 PR 的交付边界是普通 CLI 写回参数可发现性;不把它当作上下文增量协议的完成。

已检查 quota CLI 和 TurnEnvelope 计划;没有渲染页面、布局或设置改动。正式 App 安装态、模型实际阅读采用及长期净收益未验证。额外968字节是真实成本,后续应按原计划观察帮助读取和总模型输入,不以字节或通过数替代收益。本评审不授予合并、安装或额外评测权限。

English verdict: APPROVE — 23a46a88219cd1c9bb7153edec80bf24b2f036ac. The existing generated writeback now exposes its real input vocabulary. An independent public CLI oracle fails on immutable base and passes at head; File/SQLite and both profiles retain refusal, recovery, open-Todo and exactly-once settlement. Current Python:237 passed; full control-plane TS:5,396 passed,75 optional PostgreSQL skips,0 failures. Typecheck and standard premerge pass. The additive968-byte hint is disclosed; installed-host adoption and total model-input savings remain unverified.

@huangruiteng
huangruiteng merged commit 7e41342 into main Oct 24, 2026
30 of 41 checks passed
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