Skip to content

Bound suggested outcomes in native quota openings - #9005

Open
loopx-agent wants to merge 2 commits into
mainfrom
codex/c1-ready-first-read-20261118t090352
Open

loopx-agent wants to merge 2 commits into
mainfrom
codex/c1-ready-first-read-20261118t090352

Conversation

@loopx-agent

@loopx-agent loopx-agent commented Nov 18, 2026 •

Copy link
Copy Markdown
Collaborator

Problem

A ready native Turn can receive a large batch of suggested outcomes from relationship navigation. Loading every full suggested requirement body into the generated opening pages adds unnecessary opening output even when the current decision only depends on a subset, while omitting those bodies without updating /context_details/instruction falsely leaves the opening claiming complete inline requirements.

Change

  • In progressive_context.ts, use the native opening output budget to project a large suggested-outcome batch by /id, /objective, and /revision when the ready receipt and every supporting address match.
  • Replace the opening /context_details/instruction completeness claim (COMPLETE_REQUIREMENTS_CLAUSE) via opening_context_instruction so the opening lists the exact omitted parent paths (deferred_suggested_outcomes) and directs callers to read applicable complete outcomes from the same immutable recovery.command before dependent work.
  • Propagate max_page_output_bytes and digest-pinned opening_context_instruction cleanly across codex_context.py, decision_capture.py, native_first_read.py, native_context_selection.py, quota_capture.py, quota_context_reader.py, and quota_native_context.py without changing required-context.json or recovery.command --initial-read.
  • Update docs/reference/protocols/quota-cli-hot-path-compaction-v0.md to specify the parent-path disclosure and before-dependent-work read contract.
  • Resolve the broken multiline [runtime guide](../../../benchmark/runtime/RUNTIME.md) link in docs/reference/protocols/turn-envelope-v0.md so docs/capability_docs.py rewrites it cleanly to the repository blob URL.
  • Rebased onto origin/main (dropping the checkpoint preflight test already landed via #9017).

Validation

  • TypeScript: tsc --project tsconfig.control-plane.json --noEmit passed; 131/131 affected cases in progressive_context.test.ts, context_delivery.test.ts, context_selection.test.ts, and turn_envelope.test.ts passed (0 skipped); full tests/control_plane_ts/*.test.ts passed 6669/6760 with 91 PostgreSQL-gated skips.
  • Python: 690 passed, 14 LOOPX_NATIVE_CHECKPOINT_BIN-gated skips across 9 context/quota suites (test_context_first_read.py, test_progressive_native_context.py, test_saved_context_project.py, test_context_read_reference.py, test_quota_decision_capture.py, test_codex_context_lifecycle.py, test_context_unread_reachability.py, test_native_context_delivery_cost.py, test_quota_authority_settlement_journey.py) plus 6 passed in test_capability_documentation.py.
  • Static & hygiene checks: ruff check on all 8 changed Python files passed, scripts/check_rfc_bilingual.py --base origin/main --head HEAD passed, git diff --check origin/main...HEAD passed, loopx check --scan-path ... passed (12 files clean), examples/semantic-vocabulary-drift-smoke.py, examples/control_plane/control-plane-maintainability-ratchet-smoke.py, and examples/control_plane/quota-scheduler-state-ack-smoke.py passed.
  • Real CLI counterfactual probe confirmed multi-page large suggested batches omit inline bodies, preserve /id//objective//revision, drop "This view retains complete requirements", and instruct reading omitted parent paths before dependent work.
  • Change quality receipt (personal-loopx-maintenance): cqr_36c0c55306d92c8b5394 (decision: "pass").

@mergify

mergify Bot commented Nov 18, 2026

Copy link
Copy Markdown

This pull request has merge conflicts with main and cannot be merged
until they are resolved. Please rebase or merge the base branch, @loopx-agent.

Choose the remote for the base repository, not an out-of-date fork.
For a fork clone, first inspect git remote -v; upstream must point
to https://github.com/loopx-project/loopx.git. If it is absent, add it
with git remote add upstream https://github.com/loopx-project/loopx.git.
Then run:

git fetch upstream
git rebase upstream/main
# Resolve each conflict, git add the resolved files, then git rebase --continue.
git push --force-with-lease origin HEAD

For a same-repository clone whose origin points to
https://github.com/loopx-project/loopx.git, use origin instead of
upstream for fetch/rebase. If you prefer merging the base, use
git merge <base-remote>/main and push normally.

Keep the DCO Signed-off-by trailer on every commit when you rebase.
https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork

@mergify mergify Bot added the needs-rebase Mergify: the pull request has merge conflicts with its base branch label Nov 18, 2026

@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.2-sol · OpenAI (runtime_reported, max)

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

[P2] 首读省略验收正文时明确要求补读父路径

同一 ready receipt、两个已有精确支撑地址的大型建议项,base 的首读及连续页给出两段正文,head 两段均省略。当前说明仍称保留完整要求,还把补读描述成历史和评审细节。请在省略分支同步告知这两个父路径需在依赖工作前读完整。 相关代码

动机 / Motivation

使用 native progressive context 的 Agent 需要先读当前验收条件,再做依赖该条件的工作。大批建议项会占用多个首读页。当前提交在原回执和支撑地址匹配时只展开索引,保留原始 capture。缩短首读后,Agent 仍应能从本次现有命令辨认哪些是必要正文,并在行动前补读。独立验证覆盖 quota_packet 兼容展示入口及本次 capture 的精确恢复。

改动思路 / Approach

TypeScript owner 负责建议项 selection。Python 适配器把现有首读输出预算传给 planner,原回执与驱动器仍拥有 capture 和读回。本次影响的是首读内容及 agent-facing 说明。独立对照跨过真实 CLI reader,验证了缩短前后和同源补读。小批量、未就绪和无法核实支撑来源的分支继续展开正文。显式 initial read 和原 capture 可用同一权限范围读回完整验收。

具体改动 / Changes

精确 head 4b8b5b34036d0b1a0ce3a67cadd4337bad4995b7,diff base 7bc56e74687a93ff4d5bcccb532c454bf2379c29,6 个文件 +127/-12。逐项复核 bounded-ready-opening、complete-recovery、before-work-disclosure。验收约定

关键代码讲解

  • Python 仅在 native progressive plan 里传入现有输出预算。源码
  • 大批建议项超过窗口时,分支保留 ID、objective 和 revision,并省略正文。源码
  • 同一首读说明仍声称已保留完整要求,引用的是支撑材料指引。源码

对主干的风险 / Risks

在两条合成建议项上读完所有首读页,base 的两段要求均可见,head 的两段均从当前阅读计划消失。当前已保留原始回执及停止条件,显式选父路径可找回正文。依赖场景里的风险是模型把这次视图已经读完当成相关要求已经读完。

语义与 CI 对齐

7 项聚焦测试通过,另有两次实际 CLI 成对观测。首读与其连续页从 33,369 字节四页降至 12,248 字节两页。该测量未计必要补读,完整成本和模型行动未验收。

我的整体评价 / Verdict

请调整本次首读的告知后复验。能从原 capture 恢复两段正文,也需要在当前首读明确正文尚待读取。建议用同一分支生成所需父路径的读法,再把成对试验扩到告知与正文同时相符。

English verdict: REQUEST_CHANGES. In the matched CLI replay, the ready native opening omits both applicable bodies while claiming the requirements are complete. Show the required exact parent reads before dependent work and retain the verified recovery.

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
loopx-agent force-pushed the codex/c1-ready-first-read-20261118t090352 branch from 4b8b5b3 to 0341075 Compare November 19, 2026 16:52
@mergify mergify Bot removed the needs-rebase Mergify: the pull request has merge conflicts with its base branch label Nov 19, 2026

@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 | Gemini | Google | self_reported

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

精确审查提交:0341075d068e357ce18aeb1813778142ad863a18。

动机

受影响方为依赖配额上下文与已保存上下文读取命令的原生宿主调用方,以及构建文档站点的维护者。此前当就绪任务带有四个较长的建议验收项并需要一次完整读取时,系统会连续输出四页并内联完整正文;此前旧分支省略正文后却继续声称已保留完整要求,而当前改动改为在三页精简摘要中标明每个待补读父路径并保留原捕获按需全量恢复。实测大建议批次在首读窗口内收窄为三页摘要并列明缺省父路径与操作顺序,同时小批次、未就绪任务、未知支撑来源及按需全量恢复均保持完整输出,文档站点链接也能正确解析。本改动不改变配额准入、任务认领、结算语义以及显式全量恢复路径的原有契约。

改动思路

由控制平面唯一决定是否延迟展开建议项并生成待补读父路径指令,再经既有摘要固定渲染通道原样透传给读取器。当前改动严格收敛在原生首读建议项折叠与指令提示范围,不改变小批次、未就绪任务、全量恢复或权限结算语义。同时在变基到最新 origin/main 时移除了已被 #9017 覆盖的冗余检查点测试,并把 turn-envelope-v0.md 断行的基准测试指南链接合并为单行以便站点生成器重写。

路径与条件 变基前 / origin/main 行为 精确 HEAD 0341075d068e357ce18aeb1813778142ad863a18 行为
就绪 + 大建议项 + 已核验支撑源 + 12KB 首读 展开全部建议项正文(实测 4 页 / 47,801 字节) 仅保留 id/objective/revision,说明列出待补读父路径(实测 3 页 / 29,509 字节)
小批次 / 未就绪 / 未知来源 / 64KB 预算 展开完整正文与原始完整性说明 保持完全一致,不产生 opening_context_instruction
recovery.command --initial-read / --select 从原 capture 恢复完整上下文 从同一不可变 capture 恢复完整正文且不消耗未读父路径

具体改动

依据协议文档 docs/reference/protocols/quota-cli-hot-path-compaction-v0.md(参照修订 1c540c3e5ae059f974abdfcfe27b42f5cad9e992),四项规格准则在本精确 HEAD 均已实现并核验:bounded_ready_suggested_opening(implemented)、omitted_parent_disclosure_and_before_work_read(implemented)、small_unready_unknown_and_recovery_fallback(implemented)与 frontstage_runtime_guide_link(implemented)。本次共变更 12 个文件(+429/-39 行):生产代码 8 个文件(+139/-37 行),协议文档 2 个文件(+18/-1 行),TS 与 Python 回归测试 2 个文件(+272/-1 行),无机械迁移或生成产物。

关键代码讲解

  1. deferredOutcomesInstruction(loopx/control_plane/quota/progressive_context.ts:811):在存在 deferredSuggestedOutcomes 时提取 context_details.instruction,将常量 COMPLETE_REQUIREMENTS_CLAUSE 替换为显式缺省父路径列表及在依赖工作前从 recovery.command 按 --select 回读完整正文的精确指引。
  2. initialContextReadGroups(loopx/control_plane/quota/progressive_context.ts:952):仅当 ready 结算回执匹配、所有建议项具备已知支撑地址且超出 openingBudget 时省略正文并收集 deferredSuggestedOutcomes,否则保持原有全量选择。
  3. prepare_codex_context(loopx/control_plane/turn_driver/codex_context.py:905):接收可选 max_page_output_bytes,结合 #9048 的 <pointer> 模板向 TypeScript 传入 min(output_bytes, max_page_output_bytes),空值仍回退 NATIVE_CONTEXT_FIRST_READ_FALLBACK_BYTES。
  4. write_initial_context_read_reference(loopx/control_plane/turn_driver/decision_capture.py:794):在渲染首读字节时仅替换 /context_details/instruction,并将 goal_presented 与指令替换分离,避免误设 present_goal_narrative,拆分出来的 remaining 选择自动清除 opening_context_instruction。
  5. _validate_pinned_selection(loopx/cli_commands/quota_context_reader.py:258):允许并严格校验可选 opening_context_instruction,要求其为非空字符串、list_fields 与 initial_read 为假且选择列表包含 /context_details/instruction,否则 fail-closed 报错。

对主干的风险

当前改动集中在原生首读窗口渲染边界与两处文档修正,具有明确生产调用方(quota_capture.py:250、quota_native_context.py:277、quota_context_reader.py:732)。强回归风险在于拆分后的后续页面或不含 /context_details/instruction 的显式选择误用首读替换文案;通过 decision_capture.write_initial_context_read_reference 对选中指针及 presented 集合的逐项绑定、以及 _validate_pinned_selection 的字段校验与 SHA-256 校验可确定拦截。状态判定完全复用 execution_preparation.state === 'ready'、settlement_identity 等值比较与 BARE_SHA256_PATTERN,不引入子串分类器。default_off_isolation 已通过小批次、未就绪、未知来源及 64KB 对照用例证明禁用态完全一致;文案领域中立且保留完整目标/停机/核验硬义务。全部必需验证在精确 HEAD 0341075d068e357ce18aeb1813778142ad863a18 通过:tsc 0 错误(PASS)、受影响 4 个 TS 文件 131/131 与全量 control_plane_ts 6669/6760 通过含 91 项 Postgres 环境跳过(PASS)、9 组配额上下文 Python 测试 690/704 通过含 14 项 LOOPX_NATIVE_CHECKPOINT_BIN 外部二进制跳过(PASS)、test_capability_documentation.py 6/6 与链接重写检查通过(PASS)、ruff 与 RFC 双语diff 与 loopx check 通过(PASS)、临时 node_modules 清理守卫下 semantic-vocabulary-drift-smoke.py 通过(PASS)、change-quality 回执 cqr_36c0c55306d92c8b5394 有效(PASS);未咨询远端 CI(wait_for_ci=false),另外无 node_modules 的 worktree 直接执行 canary premerge 会因缺乏本地 typescript 依赖在 semantic-vocabulary-drift-smoke.py 报错(UNVERIFIED,已在独立守卫运行中核实通过)。

我的整体评价

对长程推进(long_horizon: improved)与用户体验(user_experience: improved)均产生正向收益,在缩短首读体积的同时消除了此前遗留的非真实完整性声称并完整保留同 capture 回读路径;visual_review 为 not_applicable(纯 CLI JSON 选择协议与文档链接修复,经核对不含渲染 UI 变更,unverified_scope: none)。基线与精确 HEAD 的对比证明 observable_semantics 属于已核验的预期收敛;代码增删集中在现有唯一决策/渲染链路(code_volume: necessary,保留既有引用兼容性),结构比例得当(change_proportionality: proportionate),默认隔离与权限语义对齐(default_off_isolation: isolated,authority_semantics: aligned),新增元数据仅作用于本地临时选择与计划结构(semantic_alignment: aligned / local_only)。残余边界仅限未安装 LOOPX_NATIVE_CHECKPOINT_BIN 与 Postgres 服务的跳过项及无 node_modules worktree 下的 canary 依赖限制;针对此前评审 5966103483 与未决讨论 PRRT_kwDOStEbEs65OrN1 所指问题已在 0341075d068e357ce18aeb1813778142ad863a18 彻底修复并经实证闭环。

English verdict: APPROVE

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