Repository navigation
Preserve complete context in shared quota diagnostics - #7557
Conversation
loopx-agent
left a comment
There was a problem hiding this comment.
Reviewer: model_agent — gpt-6.1-sol / OpenAI; runtime_reported; effort=max
Request changes conclusion (author-owned PR; GitHub blocks formal self-review)
动机 / Motivation
使用 quota should-run、status 和 plan 阅读工作与候选条件的 Agent 或维护者,会遇到摘要丢失原始条件的问题。一个候选的尾部停止条件或新增列表在旧摘要中消失;当前 head 保留其完整内容,已知冗余列表仍有带遗漏数量的详情入口。这避免靠新 guard 重取另一个时刻的状态来补读旧条件。本切片不交付 controller 原生消费者、统一准入或安装采用,也未证明模型和完整成本净收益。
24 个同输入真实 CLI 反例均从 base 失败转为 head 通过;扩展回归仍发现 status/plan 的 Markdown 详情一致性失败。当前仍须修复 Markdown 数值显示差异;controller C1 消费链与同 capture 接续仍属于现有 #7430。
改动思路 / Approach
共享 typed owner 删除重复 Python 裁剪,已通过当前 CLI 证明实用增量;整个 status/plan payload 的数值显示兼容缺陷仍须修复。原调用链先计算权威决定并保存 capture,再通过既有 reference_context 操作做纯展示投影。新模块只识别既有诊断列表,未知字段、复杂内容与新版本保留全文,原有选任务、claim、lease 和结算 owner 均未替换。一次操作处理整批行,避免每个 Goal 各加一次 bridge 调用。
不修改会保留已复现的数据丢失;只在 Python 补规则又会与后续 native 路径各维护一套。当前共享边界合理,但它不能因此改变无关的数字显示。当前 PR 只交付共享诊断投影;C1 原生消费者及统一契约切换沿 #7430,不能以本 PR 的通过数量宣告整体完成。
具体改动 / Changes
完整审阅 base 19c213324fbb5990288bd374c1b79096f22bb152 到 head 5b5d9dd3b0a816aae9d5160b849cff4a3c38da13 的 7 个路径(+290/-346)。3 个生产文件移除旧 Python reducers、接入现有 TypeScript 操作并增加 128 行诊断投影;3 个测试文件覆盖保留内容和批量调用,协议双语说明默认变化及额外传输成本。
关键代码讲解
- knownItems 复用 canonical Todo field contract;未知版本、字段或嵌套复杂值不会被当作普通诊断条目删除。
- compactSummary 只对已知列表执行限量,保留条目全文、原有 source_projection 与遗漏数量;不根据有界列表推断权威状态没有其他任务。
- projectQuotaDiagnostics 在一个请求中处理所有 status/plan 行及 next_automatic_turn。候选集合、portfolio 正文和当前工作来源保持完整。
- _reference_context 复用既有 bridge,但现在整个 plan 会被 JSON 往返;这正是下面数值显示差异进入原 Markdown renderer 的位置。
规范依据为 docs/reference/protocols/turn-envelope-v0.md,不可变版本 19c213324fbb5990288bd374c1b79096f22bb152:required-work-context 的完整来源与原准入边界已保留;Portfolio v2 的候选次序、条件及结算规则保持;Large todo summaries 的已知诊断详情入口仍可用;C1 caller replacement 仍由既有 #7430 承接,不冒充当前已交付。新增文档澄清旧详情读取当前状态,不能恢复历史决定,这个边界准确。
对主干的风险 / Risks
[P2] 保持 compact 与 full-detail 的数字显示一致
默认行中的 compute 是 Python 浮点数 1.0。新 status/plan 调用 让整个 payload 经过 TypeScript JSON 编解码,回到 Python 时变为整数 1;显式展开两类 Todo 则绕过该请求。因而同一个完整观察经过两种展示路径,分别出现 compute=1 和 compute=1.0。这里没有证明额度大小或执行权限改变;问题是此次纯诊断重构破坏了既有 Markdown 读回一致性,而且遗漏了受影响的实际测试。
独立在不可变 base 上运行 python -m pytest -q tests/control_plane/test_quota_plan_observation_payload.py -k real_cli_compact_and_full_detail_preserve_canonical_todos:PASS,2 项。同条件当前 head:FAIL,File/SQLite 各一项,均停在第 92 行的 compact/full Markdown 比较。最小修复是在既有投影/renderer 边界保持两条路径一致,再重跑这两项及内容保真检查;不需要重做准入或降低权威/正文断言。
语义与 CI 对齐
本次复用既有 Todo/诊断词汇,没有新增持久化状态、权限或业务专用规则。当前 shared projection 仍有上述未披露显示差异,因此 observable semantics 不能记为等价。远端 CI 按当前规则未查询、未轮询、未等待;本结论来自本地不可变 base/head 的实际比较。
本地扩展检查为 304 passed / 2 failed;两败均是上述回归。TypeScript envelope、interaction、context-delivery 97 passed,类型检查通过,standard premerge 的 6 个直接检查及 14 个选中检查通过。另有 24 个同输入真实 CLI 案例,旧版全部丢失相应上下文、head 全部保留;canonical task、provider revision 和零扣额断言成立。未来字段只在真实决定生成后的展示边界注入,未用 mock 直接给出修复后的 postcondition。最初测试路径及私有夹具自身的 claim_scope 假设错误已更正,两版本原失败记录保留,不归因为产品问题。
我的整体评价 / Verdict
这是一项有用且可独立回退的共享诊断改进,完整上下文与 Python 重复规则删除都得到实证;但当前准确 head 的 Markdown 兼容检查仍失败,应先完成该窄修复再批准。长程执行权限、任务与结算保持,完整运行成本和实际模型收益仍未证明。status/plan 新增一次 RPC、输出保留更多正文是明确成本,不能把代码减少或测试数量当净效率收益。
视觉审阅不适用:检查的是 CLI JSON/Markdown 与 TypeScript 投影,没有前端渲染或图片改动。原生 C1 消费者、正式安装 App 和模型采用仍未验证。当前源码判断为 REQUEST_CHANGES;未执行合并、安装或任何 CI 操作。
English verdict: REQUEST_CHANGES at 5b5d9dd; the context-preservation repair is verified, but compact/full Markdown parity regresses on both File and SQLite.
| if isinstance(payload.get("next_automatic_turn"), dict): | ||
| result["next_automatic_turn"] = project_row(payload["next_automatic_turn"]) | ||
| return result | ||
| return _reference_context(payload, task_title=False, explore_guidance=False, diagnostics={ |
There was a problem hiding this comment.
[P2] 这个新增的整包 TypeScript JSON 往返会把原 compute=1.0 变成整数 1,而显式 all-detail 绕过该调用,导致同一观察的 Markdown 读回不一致。现有 test_quota_plan_observation_payload.py::test_real_cli_compact_and_full_detail_preserve_canonical_todos 在不可变 base 19c213 两个 backend 均通过、该 head 两个均失败于第 92 行。请在既有投影/renderer 边界保持两种展示一致,并重跑这两项;无须改变任务、权限或完整正文断言。
Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
5b5d9dd to
eb4e9b9
Compare
Goal And Delivered Outcome
Quota diagnostics used to drop unknown lists and retained-item fields, shorten portfolio text and hide candidate context. This PR preserves those facts and replaces the duplicated Python Todo-list reducers with one TypeScript owner used by
should-runand the complete status/plan batch.The reviewed head also introduced an unrelated numeric round-trip regression. Diagnostic replies now carry only display edits and references to the original input; Python applies those edits to its own facts. This preserves
1.0, negative zero, large integers and relocated upstream metadata. The existing Markdown renderer and its consistency assertion remain unchanged.main; qualified against90b26f2fa26835d668f4f1fb77dea87c81fda755after rebasing the original proposal.Author Declaration
Written by OpenAI Codex, GPT-6 family model agent.
diagnostic_projection.tsowns known Todo-list presentation. Python only transports and applies the typed edits. All status/plan rows share one request.content_revisionis known display metadata; visible records keep it, and known diagnostic lists can still be compacted.This is an internal projection helper. No capability, provider, scheduler, permission or storage owner is introduced. The local path-edit type has one active transport consumer; it contains no selection or compaction policy.
Scope And Continuation
Complete author implementation for this diagnostic slice. The original C1 remains open. Keeping this PR separate allows adoption or rollback without the native writer cutover in #7430.
Intentional output changes retain formerly hidden candidates, portfolio prose and unknown item content. The crowded unit fixture previously reached 43,862 characters because of that useful retained information; this is not a performance win or a change to public interface budgets. Status/plan adds one coarse projection request relative to the old local Python reducer. Agent/vision detail still needs one when User context remains compact; explicitly expanding both Todo roles skips it. The repair adds no request. It still sends the input and constructs an independent Python result; no end-to-end latency, model-token or long-horizon benefit is claimed.
Bounded refactoring applied: keep list decisions in the shared typed owner and preserve original facts in the transport adapter. Broader context-codec and consumer convergence remains with C1.
Validation
Tested revision:
eb4e9b970aeb1ffb83e46705d6386cc3a4679ead. Synthetic/public fixtures and isolated real File/SQLite authorities.Historical failures are retained: the original
5b5d9ddand its rebased equivalent both fail the two File/SQLite Markdown cases. All nine new source-number cases fail before repair, including a large integer whose value was rounded. The first edit-transport attempt failed on aliased caller objects and the reference-only hash contract; separating JSON objects and retaining that existing contract resolved those failures. No original consistency or content-preservation assertion was removed or weakened. The original earlier run's obsolete zero-request expectation is still documented by the existing explicit-detail transport test.Independent review and protected merge remain separate pending stages. The earlier REQUEST_CHANGES review is historical evidence; author tests do not replace a review of the new head. No CI query/wait, merge, install, release, model run or paid benchmark was performed.
Frontend / Visual Evidence
UI impact: none. Existing CLI/model diagnostic readers retain their entrypoints; no screen, setting or frontend capability is added. Visual evidence: N/A.
Type / Area / Boundary
Bug fix, refactoring and bilingual protocol/test update; control-plane presentation. No storage migration, provider routing, permission, scoring or release change. Both commits retain DCO sign-off. Public/private scans exclude local state, raw traces, credentials and local paths. No paired RFC changes.