Skip to content

Keep quota should-run previews read-only - #8685

Open
loopx-agent wants to merge 1 commit into
mainfrom
codex/quota-should-run-dry-run
Open

loopx-agent wants to merge 1 commit into
mainfrom
codex/quota-should-run-dry-run

Conversation

@loopx-agent

Copy link
Copy Markdown
Collaborator

Problem

loopx quota should-run --dry-run could dispatch TurnStart capability hooks, read a linked GitHub PR and persist a merge observation. It could also write a rollout event, host-poll receipt, usage observation and status projection cache during a preview.

Change

The quota CLI evaluates an explicit preview without those execution effects. This preserves the decision output and explicitly requested private context navigation. A Turn-bound invocation with --dry-run still returns its typed validation error.

Verification

  • 488 targeted regression tests passed, including execution and preview with both File and SQLite, typed failure rendering, and quota usage observation.
  • The source launcher was exercised against public GitHub through the production adapter with isolated File and SQLite registries. Each preview made zero PR reads and business writes. In each store, execution read three PRs, adopted exactly one merge, and charged zero business quota. The repeated check made zero provider reads.
  • The standard base-to-head premerge gate passed all 24 checks with the same module entrypoint on both comparison arms.

Hosted CI, independent review and deployment are pending.

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

Request changes conclusion (author-owned PR; GitHub blocks formal self-review)

评审提交 0fce127599d0327e875e1ad34c16434b1eee0945,对照 GitHub 目标 7bb1b01687c5ecb36971b19fc432d6019d3e5492。实际 PR diff 为 3 个文件。目标分支在 merge base 之后合入的 #8656 没有修改这三个文件。

[P2] 只读预览省略已有来件的必读指令。 给已注册 Agent 的同一 Goal 送达一条待处理来件,然后运行 quota should-run --dry-run 预览当前 Todo。 候选仍返回 normal_run 和同一个 Todo,却省略 before_work 的 manager-inbox read。相同输入在主干预览和候选执行中均给出必读指令,File 和 SQLite 都能复现。 预览跳过整组 hook

动机 / Motivation

用 quota CLI 预览当前可执行事项和前置条件的操作者。 预览漏掉已有来件,操作者准备选中工作时可能错过当前纠正或约束。 同一 Goal 既有可选 Todo,也有需要先读的来件。操作者在正式执行前查看当前开工条件。 File 和 SQLite 的候选预览均未调用 PR provider,也没有写入观察事件、host poll receipt 或状态缓存。用合成 PR 返回验证,显式执行仍能采用已确认合并的依赖。 本轮验证使用源码 CLI、实际本地 File/SQLite 和合成来件。已安装 App 及托管 CI 未核验。

改动思路 / Approach

CLI 拥有预览与执行模式。Manager Inbox 继续拥有来件读取,现有决策投影负责把必读指令交给调用者。 在现有 hook 组合处禁用执行型观察和写入,同时复用已有来件的本地读语义。 PR 等待观察和来件读取目前由同一次 TurnStart 组合调用。来件 producer 读本地已送达请求,再把必读条件交给同一决策投影。 来件读取 必读指令投影

具体改动 / Changes

关键代码讲解

_dispatch_quota_turn_start_hooks 验证参数后对预览直接返回。_observe_live_quota_result 同时覆盖普通输出和 scheduler observer。预览也跳过 rollout 日志、host poll 和状态缓存写入。新增用例对照预览、显式 Turn 拒绝与合并观察。 用量观察边界 缓存写入边界 PR 等待用例

按 7bb1b01687c5ecb36971b19fc432d6019d3e5492 的 docs/reference/required-work-context.md 和现有 quota 规则验收。readonly-preview 已覆盖外部观察、事件和回执。required-inbox-read 仍缺同一来件在预览时的可见结果。 来件与必读指令 预览扣额规则

对主干的风险 / Risks

两种本地存储均返回同一 Todo。主干预览和候选 live 都显示来件读指令。隔离对照只接回既有来件 producer,两端都恢复了指令。该 producer 当前有文件锁,正式修复需要保留读取语义并使用只读入口。分别在 File 和 SQLite 放入已送达的来件,核对预览保留必读指令、来件仍待处理、PR 读取为零,且事件、poll receipt 与投影缓存无变化。

语义与 CI 对齐

85 项聚焦检查通过。独立矩阵核对普通预览、scheduler observer、显式 Turn 拒绝与 live 重读。另用真实 GitHub compact 生命周期 adapter 确认两种候选预览均未发出 PR 调用。合并就绪的正例使用合成 provider 返回和真实本地存储。本地 standard premerge 的 6 项直接和 18 项选中检查通过。 托管 CI 未查询。

我的整体评价 / Verdict

请求修改。在预览中复用 Manager Inbox 的本地读取与必读投影,沿只读路径取当前事实。继续屏蔽外部观察、状态写入和用量记账。 在同一个预览入口复验已有来件和外部观察隔离。

English verdict: REQUEST_CHANGES. At 0fce127, dry-run suppresses executing observations but hides the scoped Manager Inbox prerequisite in both local backends.

) -> tuple[dict[str, object] | None, bool]:
_export("validate_quota_command_context_request")(args)
if args.quota_command != "should-run":
if args.quota_command != "should-run" or getattr(args, "dry_run", False):

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.

[P2] 只读预览省略已有来件的必读指令。 给已注册 Agent 的同一 Goal 送达一条待处理来件,然后运行 quota should-run --dry-run 预览当前 Todo。 候选仍返回 normal_run 和同一个 Todo,却省略 before_work 的 manager-inbox read。相同输入在主干预览和候选执行中均给出必读指令,File 和 SQLite 都能复现。 在预览中复用 Manager Inbox 的本地读取与必读投影,沿只读路径取当前事实。继续屏蔽外部观察、状态写入和用量记账。 分别在 File 和 SQLite 放入已送达的来件,核对预览保留必读指令、来件仍待处理、PR 读取为零,且事件、poll receipt 与投影缓存无变化。

This branch has not been deployed

No deployments
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.

1 participant