Skip to content

fix(context): preserve distinct JSON observations in shared quota views - #7722

Open
loopx-agent wants to merge 1 commit into
mainfrom
codex/quota-json-sharing-20261030
Open

loopx-agent wants to merge 1 commit into
mainfrom
codex/quota-json-sharing-20261030

Conversation

@loopx-agent

Copy link
Copy Markdown
Collaborator

Quota's ordinary CLI projector can replace a distinct Vision audit or replan-authoring body with a reference to another value: Python treats True == 1, False == 0, integral floats and integers, and both signs of zero as equal. The resulting view can lose a source observation even though the immutable capture still contains it.

Reuse the existing acceptance-sharing JSON serialization identity across these three sharing paths. Complete identical bodies still share one in-response owner, including reordered keys; distinct values and their instructions stay inline. This is serialization IO in the existing compatibility owner, with no new schema, flag, source read, RPC, state writer or decision authority. The paired controller RFC, required-context reference and self-repair lesson describe the same boundary.

This follows the already merged #7696; it does not reintroduce that implementation or the scanner prerequisite. The new branch has one signed commit and six changed files. The full producer/consumer convergence and retirement of the compatibility path remain with #7430.

Written by: Codex (OpenAI GPT-6).

Tested head: 28868b3bda36860c353c1494c10c76b7fa7cc091, based on main 2fbd47fb53f39d9590955066f6c7325fe7afc335. Fixtures are synthetic and public-safe.

Validation Result and boundary
Regression sensitivity Substituting the immutable 2fbd47fb5 projector produces 18 expected failures (16 distinct-value unit cases and both ordinary File/SQLite CLI cases) and 22 passing controls (20 equal/key-order cases and both native CLI cases). The same 40 cases pass on the final wheel. Other production files match base; this is a controlled component substitution, not a historical checkout or model run.
Final source integration 221 passed, 7 skipped. Covers the new value cases, complete acceptance references, CLI projection, staged replan reads and saved context. All seven skips require explicitly enabled native Codex; they do not qualify App/model adoption.
Final isolated wheel 70 passed with real File/SQLite CLI, ordinary/native delivery, actual same-capture selected reads, wrong-digest refusal and unchanged original capture/receipt/spend facts. All 1,898 product files match source; 23 Python processes have no foreign product-module origins. Python 3.11, Node 24 and SQLite 3.53.4; disposable installation only.
Static / documentation Repository-declared Ruff roots, configured mypy (17 targets), staged and committed bilingual RFC checks, vocabulary advisory and public-boundary scan. Full Python/CI, Windows and model/native-host adoption are not claimed.
CLI output budget Passed, unchanged fixed-base/head matrix, 39.801 seconds; original 240-second probe and 600-second child limits.
Native premerge / exact-scope author quality Passed: 6 direct and all 17 selected checks, zero warnings/skips, unchanged 120-second per-check limits. Exact-scope author quality is valid, with zero blockers and one disclosed efficiency advisory. Safe-fix allowed; no additional repair pass applied. This grants no merge authority.

The first wheel build correctly rejected an old frontend bundle after mainline integration. Rebuilding the existing local bundle made the final source-matching wheel build and installation pass; no frontend source or verification gate changed. Interrupted and failed earlier harness runs are retained separately and are not counted as passes.

On 16 fixed synthetic projector comparisons against 2fbd47fb5, identical-body output and serialized request bytes remain equal. Default delivery makes one existing projection request in both arms; all-details delivery makes zero in both. Distinct Vision facts add 105 bytes in each of the three tested mirror fixtures; the authoring fixture shrinks 203 bytes because it retains a short body instead of a longer incorrect reference. These are component/serialized-parameter observations, not framed traffic, CPU/latency, billing, whole-Turn cost or long-horizon benefit. Extra local serialization cost remains unmeasured.

The rejected late TypeScript relocation and original-quota outcome/full-cost gate remain visible in the RFC. No model/benchmark campaign, live installation, release, approval or self-merge is included. Authority stores and provider defaults do not change; no PostgreSQL qualification is claimed. There is no viewport or new frontend journey.

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.

Approval conclusion (author-owned PR; GitHub blocks formal self-approval)

当前 exact head 未发现阻塞代码问题。合并权限与 readiness 单独判断。

Reviewer: actor_kind=model_agent; model=gpt-6.1-sol; provider=OpenAI; declaration_source=runtime_reported; reasoning_effort=max

Exact head: 28868b3bda36860c353c1494c10c76b7fa7cc091;whole-PR base: 2fbd47fb53f39d9590955066f6c7325fe7afc335。完整 base-to-head diff 已审阅,并核对 target main 8d48efabb351c9cc68f48f48dee64a49b4fc1890;作者报告未代替独立验证。

动机

受影响调用方:读取普通 quota 决策及其 Vision、replan 引用的 Agent 或 CLI 调用方。

一个来源的观察值为 true、另一个为 1 时,旧 Python 相等判断会把两者共享成同一个引用;当前只共享 JSON 序列化内容一致的完整值,不同类型和带符号零保持独立。

可观察结果:同一冻结 40 用例在旧 base 有 18 个预期失败、22 项通过,当前 head 全部通过;真实 File/SQLite ordinary/native guard、capture、select 和错误 SHA 路径保留原值、receipt 和零 spend。

边界:不改变 admission、执行权限、配额、任务或捕获内容;不据此认证已安装宿主、真实模型采用、C1 完整切换或长期完整成本收益。

C1 shared writer/consumer 迁移、真实模型采用与完整成本资格仍未完成。

改动思路

接受契约 docs/reference/required-work-context.md,spec_revision 2fbd47fb53f39d9590955066f6c7325fe7afc335。criterion_id:Required work context。采用变更前的接受文本判断;本 PR 修改的说明不能自行证明实现正确。

不同来源事实是否相同属于现有 CLI projection 的序列化身份判断。复用该模块已存在的严格 JSON key,比复制比较器或新增跨语言 RPC 更小;accepted C1 边界允许此 Python compatibility-owner 修复。

本次边界:本次只统一 acceptance、三类 Vision 镜像和 replan-authoring 的严格 JSON 比较,并保留既有 owner 位置、引用选择和全部来源;不关闭 C1,也不引入新的 shared protocol。

同时阅读 immutable base 的 controller-executor-unified-contract-v0.md 中 Invariants、C1 baseline boundary and reuse inventory 及剩余切换边界。accepted C1 文本要求保留 JSON 类型、来源、顺序、大小/错误语义,允许现有 Python compatibility owner 内的有用修复;它没有要求为这种比较新增 TS RPC。C1 shared writer/consumer、draft #7430、真实采用和完整成本仍未完成,这个 PR 只交付其中一个独立正确性增量。

具体改动

_json_content_key 将原 acceptance 路径已经使用的 json.dumps(sort_keys=True, ensure_ascii=False, allow_nan=False) 提成局部复用 helper,没有创造新的序列化策略。JSON object key 顺序可忽略,值的类型、顺序与数字表示不能被 Python == 悄悄合并。

_replace_nested_vision_continuation_audits 对 frontier、agent、CLI 的完整 audit 使用同一个严格 key;不同来源值保持 inline。_reference_inline_replan_authoring 同样保留原 writeback owner 的选择顺序,只改变能否认定两份完整 authoring 相同。

完整六路径 +233/-6,其中 production 为现有一模块 +17/-6,新测试 192 行;双语 RFC、required-work-context 和按需 self-repair reference 只解释同一约束。真实 _emit_quota_result 仍先捕获完整原决策,再走原 quota_presentation/compactor;没有新增来源、RPC、决策 owner、schema 或持久化写入。已合并 #7696 的 owner relocation 修复在 actual base 中,原 acceptance-reference 套件一起验证,没有以新修复覆盖旧修复。

独立冻结当前 40 用例到原 base:16 类跨 frontier/agent/CLI/authoring 的 true/1、false/0、整数/浮点、带符号零区分均失败;两项 ordinary File/SQLite 真实 guard 路径也失败,合计 18 个预期失败、22 项通过、零 error。当前 exact head 全部 40 通过;20 个相同值/键顺序控制仍共享、保留原输入并保持重复 compaction 稳定。真实 ordinary/native File/SQLite 仅在实际 admission 后注入两种 producer 观察,capture、reader、receipt 与 authority 没有 mock;原 capture 不变,wrong SHA 拒绝,spend 为零。native 两项本来即保留原捕获,不能把它们说成修复前失败。

完整相关 Python 3.14 套件 221 通过、7 项显式 native-Codex loopback 跳过;另在实际 Python 3.12 下运行严格身份与真实 guard 40 项,全部通过。Ruff、changed-path Ruff、配置的 mypy、双语 RFC diff、DCO、完整 diff 与公私扫描均通过。标准 premerge 6 项 direct 与 17/17 项 selected 检查通过,零失败、零 manual hold。没有把作者 wheel、CI 或模型报告当成本次独立执行。

对主干的风险

doing nothing 可以少做一些本地序列化,却保留已经复现的 silent alias;只新增断言或采用 Python 深比较仍不能区分这些值。复用已有严格 JSON owner 是更小且可回滚的修复。它确实可能让不同观察保留更多 inline 输出,并增加本地序列化 CPU;本次没有测 CPU、持续性能或完整成本,不能声称效率改善,也不据此修改冻结预算。非有限数不属于现有有效 JSON 输入,本次不扩大输入域。

现有 alias owner 的遍历顺序、detail 开关、source identity、size/error checks 与完整 capture 均保留。default 行为中只有错误的值相等认定有意改变;这不是 default-off 功能,不能以某个开关未打开来证明隔离。Agent guidance 中也没有新增 must_attempt、claim 或 settlement 义务。wait_for_ci=false,未查询、轮询或等待 CI;未修改 PostgreSQL authority 路径,也未宣称其本次集成资格。

我的整体评价

这是有实证的正确性增量,完整 caller 路径和相邻 owner 行为均有当前独立证据。复用已有 serializer 消除了散落的 Python 值相等策略,没有增加抽象、远程请求或人工同步。剩余 C1 迁移与 full-cost 资格属于原有接受边界,不能用此 PR 的通过宣告完成,也不必为此有用修复扩张成整套重写。

检查真实 CLI 及其恢复/读取入口;本 PR 没有渲染页面、视口或新增设置变化。

未验证范围:不改变 admission、执行权限、配额、任务或捕获内容;不据此认证已安装宿主、真实模型采用、C1 完整切换或长期完整成本收益。

English verdict: APPROVE. Strict JSON identity preserves distinct observations through the real CLI while retaining existing owners; C1 completion and full-cost benefit are not claimed.

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