Skip to content

perf(quota): slim unscoped Turn-envelope acceptance, fallback mirror, and first-read rows - #9498

Merged
huangruiteng merged 3 commits into
mainfrom
codex/slim-turn-envelope-todo-horizon-bloat-20261126
Nov 26, 2026
Merged

huangruiteng merged 3 commits into
mainfrom
codex/slim-turn-envelope-todo-horizon-bloat-20261126

Conversation

@loopx-agent

Copy link
Copy Markdown
Collaborator

Summary

Cuts Turn-envelope payload bloat and cold-start multi-hop pagination across unscoped and unsettled recovery quota turns while keeping TypeScript control-plane modules as the single owner, preserving 100% immutable capture readback, and keeping all fail-closed replan gates untouched:

  1. Scope goal_acceptance on UNSETTLED_HOST_TURN_RECOVERY and pre-claim planning_horizon (loopx/control_plane/quota/turn_envelope_scoping.ts):

    • Replaced isRoutineNormalRun check in scopeTurnGoalAcceptance with isScopableGoalAcceptanceTurn (normal_run or unsettled_host_turn_recovery, sharing isNonReplanTurn).
    • Derives todo_id from selected_todo.todo_id or heartbeat_receipt.settlement_identity.todo_id during unsettled_host_turn_recovery, so both planning_horizon (no --todo-id) and standalone agent_todo_summary (--include-detail agent-todos) compact >6 historical outcomes cleanly while keeping work_context strictly gated on an active selected_todo.
    • All fail-closed gates (autonomous_replan_required, replan_action_packet, vision_continuation_audit.required, goal_completion, include_goal_acceptance_detail, globalAmbiguity) and immutable deferred_settlement_details.goal_acceptance retention stay intact.
  2. Defer large unscoped non-replan historical outcome requirements & preserve single-owner heartbeat_recommendation dedup (loopx/control_plane/quota/progressive_context.ts, loopx/control_plane/quota/turn_envelope.ts):

    • When outcomes.length > SCOPED_OUTCOME_THRESHOLD (6) on unscoped (projection_mode !== "turn_scoped_v0"), non-replan (!isReplanObligationCarrier) carriers, progressiveContextPlan keeps active/suggested/gap/todo-linked outcomes detailed (sources + agent_review.{note,evidence_refs} deferred only) while deferring both sources and requirements on historical non-active rows into context_details with supporting_material_pointer.
    • Accurately rewrites PROGRESSIVE_OUTCOME_READ_GUIDANCE and context_details.instruction clauses when historical requirements move to context_details (preserving original phrasing unchanged when all requirements remain inline).
    • Deduplicates identical heartbeat_recommendation.blocked_priority_fallback against root /blocked_priority_fallback via {context_ref: "/blocked_priority_fallback"} through legacyRecommendationFallbackReferences in turn_envelope.ts (preserving typescript_module_budget=1 for heartbeat_recommendation and retaining full decision.json).
  3. Skip redundant summary_only rows in --initial-read (loopx/control_plane/quota/progressive_context.ts):

    • When requirements.projection_mode === "turn_scoped_v0", outcomes.length > 6, and container capture_read_command, cold_read_command, and cold_read_instruction are present, initialContextReadGroups omits expanding each summary_only row into 8 redundant pointer selections inside first_read_command, keeping O(1) first-read size with outcome count while leaving per-row capture_read_command / cold_read_command / read_modes untouched inside required-context.json.

Paired Benchmark (origin/main 5947dc87ec vs Branch, Seeded SQLite 81 Outcomes / 662 Todos)

Scenario Metric origin/main (5947dc87ec) This Branch Delta
PRE-CLAIM (no --codex-app) Required payload bytes 846,312 B 96,734 B -88.6% (-749.6 KB)
PRE-CLAIM CTX (--codex-app, no --todo-id) required-context.json 855,707 B 156,858 B -81.7% (-698.8 KB)
CLAIMED CTX (normal_run) first_read_command total_bytes 130,805 B (11 × 12 KB pages) 35,534 B (3 × 12 KB pages) -72.8% (11 -> 3 pages)
UNSETTLED RECOVERY (no --todo-id) required-context.json 856,020 B 156,926 B -81.7% (-699.1 KB)
UNSETTLED RECOVERY + --include-detail agent-todos required-context.json 853,352 B 158,578 B -81.4% (-694.8 KB)

Verification (ee6c6c512eb80ca514be2f6dc580427e0337d9ff)

  • Rebased Exact-Head Checks (ee6c6c512e):
    • npm run typecheck:control-plane: 0 errors
    • Targeted TS suites (turn_envelope_scoping.test.ts, progressive_context.test.ts, turn_envelope.test.ts, content_digest_single_owner.test.ts w/ --experimental-sqlite): 110 / 110 passed (0 failures)
    • pytest tests/control_plane/test_scoped_turn_envelope_cli.py: 10 / 10 passed (File & SQLite end-to-end pre-claim, first_read_command multi-page concat, and unsettled recovery)
    • ruff check tests/control_plane/test_scoped_turn_envelope_cli.py: All checks passed!
    • scripts/check_rfc_bilingual.py --base origin/main --head HEAD: RFC bilingual diff check passed.
    • loopx check --scan-path ... (6 changed files): 0 errors, 0 warnings (public boundary scan clean: 6 files)
    • Change-Quality Receipt: cqr_7755bc2b9f7c24b1f98a (decision="pass", receipt_valid=true, scope 7755bc2b9f7c24b1f98a9d1d79c75d6dbaa333c4fedfb3e02f9b0858f2d01f40)
    • loopx canary premerge --tier standard --from-git-diff --git-diff-base origin/main: gate.status="passed", merge_gate_passed=true, 18/18 checks passed (direct 4/4, py_compile 1/1, catalog_run 5/5 incl. semantic-vocabulary-drift-smoke.py & control-plane-maintainability-ratchet-smoke.py, risk_profile_run 8/8, failures=0, manual_hold_count=0)
  • Broader Pre-Rebase Matrix (5947dc87ec + exact code delta, no edits afterward except non-overlapping rebase onto 0e8c2b2b25):
    • 11 Python control-plane quota/envelope/context/recovery/parity suites + tests/architecture/ (excluding upstream E12 failure in test_semantic_incident_retrodiction.py from 2c5cf6042c): 2,485 passed, 1 skipped (0 failures, test_semantic_vocabulary_drift.py passed)
    • npm run test:control-plane: 6,828 passed, 97 skipped; 26 failures solely in managed_claim_execution_conformance / original expiry expecting legacy 45m TTL vs upstream 6268621e5e (#9487 3h lease TTL).

… and first-read rows

Keep TypeScript control-plane modules as the single owner for Turn-envelope payload compaction while preserving full immutable capture readback and fail-closed replan gates:

- Scope goal_acceptance on UNSETTLED_HOST_TURN_RECOVERY (including planning_horizon without --todo-id and standalone agent_todo_summary with --include-detail agent-todos) and pre-claim planning_horizon runs while keeping work_context fail-closed on an active selected_todo.
- Defer historical non-active outcome requirements alongside sources on large (>6 outcomes) unscoped non-replan carriers in progressiveContextPlan, accurately updating outcome read guidance clauses when historical requirements move to context_details.
- Deduplicate identical heartbeat_recommendation.blocked_priority_fallback against root /blocked_priority_fallback via a context_ref owned by turn_envelope.ts (preserving single TS module ownership and full decision.json capture).
- Skip per-row summary_only entries in initialContextReadGroups (--initial-read) when container capture_read_command, cold_read_command, and cold_read_instruction exist on >6-outcome scoped declarations, leaving required-context.json row readback commands intact.

Measured on SQLite 81-outcome / 662-todo fixture vs origin/main (5947dc8):
- Pre-claim should-run (no --codex-app) required bytes: 846,312 B -> 96,734 B (-88.6%)
- Pre-claim --codex-app required-context.json: 855,707 B -> 156,858 B (-81.7%)
- Claimed normal_run first_read_command total_bytes: 130,805 B (11 pages) -> 35,534 B (3 pages, -72.8%)
- Unsettled recovery required-context.json: 856,020 B -> 156,926 B (-81.7%)
- Unsettled recovery + --include-detail agent-todos required-context.json: 853,352 B -> 158,578 B (-81.4%)

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.2-sol · OpenAI · runtime_reported · xhigh

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

[P2] 显式 Goal 验收详情也会延后历史 requirements。include_goal_acceptance_detail 在完整决策合成时跳过分组压缩,但这里的第二次投影仍按数量和活动条件移走历史 requirements。在两个实际本地后端上,之前一次 --include-detail goal_acceptance 或 all 能读取的八条条目现在需要额外捕获读取。原件仍可读回。 将显式 goal_acceptance 详情选择传给渐进投影,在显式请求(含 all)保留既有历史 requirements,只收窄普通入口。加一条同 fixture 的 File/SQLite 真实 CLI 反例,分别断言普通入口可补读而显式入口直接返回完整条目。 源码

动机 / Motivation

减少大型 Goal 在预认领、未结算恢复和原生初读中的重复内容,同时保留当前 Outcome 验收和显式详情读取契约。 基线启用渐进交付时,普通视图及 --include-detail goal_acceptance 仍在历史 Outcome 行保留 requirements。 涉及大 Goal 的日常 Agent、结算恢复调用方与显式请求完整验收的 CLI 消费者。

普通启动的重复要求扩大首包及读页。显式读取的额外往返会影响一次性读取完整验收的脚本。 独立 fixture 在 File 与 SQLite 各创建 9 个 Outcome。候选的普通视图均保留当前已绑定和未绑定的待办验收条件,历史行的 8 条条件均可按同次 capture 的摘要校验指针读回。本次观察的紧凑 JSON 分别由 100,964→60,111 B 和 101,044→60,191 B。 精确候选的真实 CLI 定向用例 10 项通过(基线 8 项);精确候选 TypeScript 定向套件 110 项通过、控制面 typecheck 通过。独立测试使用合并基线与候选各自的源码入口。 验证覆盖隔离 File/SQLite 及上述定向测试。托管 CI、全量套件和已安装 Codex 实际保留没有纳入本次验证,字节变化仅适用于这组 fixture。 基线契约

改动思路 / Approach

该改动沿用 quota should-run、原始决策捕获和 quota context-read。前置作用域判断保护已知 replan、审计和全局歧义。正常和恢复视图复用捕获导航,完全相同的 fallback 可共享同一快照值。 composeCompleteTurnDecision 根据显式 include_goal_acceptance_detail 保留完整决策,之后 progressiveContextPlan 的按尺寸规则没有收到这个选择,在不同入口共用的展示层再次延后要求。 只调整既有投影选择输入,避免引入第二个 CLI 详情契约或复制状态提供器。

具体改动 / Changes

精确提交 ee6c6c5,本次对照目标 0e8c2b2。6 个文件,+607/−24。生产改动限于原有三个 Turn 投影模块,余量为 TypeScript 与真实 CLI 回归。

关键代码讲解

  • progressiveContextPlan。历史行大于阈值且既非本轮相关也非已 scoped 时延后正文,显式详情也经过该分支。 源码

  • composeCompleteTurnDecision。合成层已尊重显式 Goal 验收详情请求,后续投影另行执行。 源码

  • scopeTurnGoalAcceptance。允许非 replan 的准备与未结算恢复阶段分组,捕获仍持有原始数据。 源码

  • initialContextReadGroups。对保有完整读取命令的 summary-only 历史行收敛初读选择。 源码

  • explicit-quota-detail(partial)。普通热路径可缩减,显式 --include-detail all 恢复支持的各个详情,验收详情选择应保留基线的要求条目。

对主干的风险 / Risks

同一个 fixture 上,quota should-run --include-detail goal_acceptance 和 --include-detail all 在基线上直接交付这 8 条历史 requirements,候选在 File 与 SQLite 均改为 supporting_material_pointer,须再执行 quota context-read 才拿到条目。候选显式加 --context-delivery off --delta-delivery off 后恢复内联。 额外补读会增加一部分显式调用方的成本,并破坏依赖原内联字段的调用。 将显式 goal_acceptance 详情选择传给渐进投影,在显式请求(含 all)保留既有历史 requirements,只收窄普通入口。加一条同 fixture 的 File/SQLite 真实 CLI 反例,分别断言普通入口可补读而显式入口直接返回完整条目。

语义与 CI 对齐

同一个 fixture 上,quota should-run --include-detail goal_acceptance 和 --include-detail all 在基线上直接交付这 8 条历史 requirements,候选在 File 与 SQLite 均改为 supporting_material_pointer,须再执行 quota context-read 才拿到条目。候选显式加 --context-delivery off --delta-delivery off 后恢复内联。 将显式 goal_acceptance 详情选择传给渐进投影,在显式请求(含 all)保留既有历史 requirements,只收窄普通入口。加一条同 fixture 的 File/SQLite 真实 CLI 反例,分别断言普通入口可补读而显式入口直接返回完整条目。

我的整体评价 / Verdict

REQUEST_CHANGES。 默认包收缩与当前验收保留在两种本机后端均观察到,显式验收详情的兼容性需要修复。 默认入口减少首读,但显式详情的一次读取退化成补读;未验证长期完整成本。

English verdict: REQUEST_CHANGES at ee6c6c5. With progressive delivery on, both explicit Goal acceptance detail and all-detail requests defer historical requirements. Paired File and SQLite CLI runs reproduce the regression and verify readback. Preserve explicit output while retaining the default hot-path savings.

…ext projection

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

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

动机 / Motivation

涉及大 Goal 的日常 Agent(quota should-run 预认领与 --codex-app --initial-read 首读)、未结算主机恢复调用方(unsettled_host_turn_recovery),以及显式请求完整验收的 CLI 消费者(--include-detail goal_acceptance 或 all)。 改造前(基线 0e8c2b2b25):预认领与未结算恢复场景下,planning_horizon 和 agent_todo_summary 全量内联 >6 个历史 Outcome 的 requirements,initialContextReadGroups 对每个 summary_only 行逐条拼接首读指针,且上一评审头 ee6c6c512e 在二次投影阶段误将显式 --include-detail goal_acceptance|all 的历史 requirements 一并延后。改造后(0cc37e5219):普通入口仅保留活跃/建议/缺口/关联待办 Outcome 的完整 requirements 并收敛首读与重复 blocked_priority_fallback,历史要求全部保留在同次不可变捕获 context_details 中可按指针读回;显式 --include-detail goal_acceptance|all 则直接内联返回全部历史 requirements。 在 test_scoped_turn_envelope_cli.py 与 progressive_context.test.ts 的 9-Outcome(含 8 条历史 Outcome)及 12-Outcome 隔离验证中,普通入口的 required-context 将 8 条历史 requirements 移至 context_details 且可通过 supporting_material_pointer/requirements 与 capture_read_command 完整读回,而显式 --include-detail goal_acceptance 与 --include-detail all 直接内联返回全部 8 条历史 requirements;turn_scoped_v0 且 outcomes.length > 6 时 first_read_command 不再展开冗余 summary_only 指针。 本 PR 不修改核心配额决策与重规划逻辑,不删除 decision.json 中的任何字段,也不在 autonomous_replan_required、vision_continuation_audit.required、goal_completion 或 globalAmbiguity 场景启用历史条目裁剪。

改动思路 / Approach

沿用既有的 TypeScript 单一投影所有权(turn_envelope_scoping.ts、progressive_context.ts、turn_envelope.ts)并复用既有 quota_detail_sections_from_args 详情选择,避免新增第二套 CLI 详情契约或旁路状态提供器。 当前 PR 边界限定于配额 Turn 信封与渐进上下文投影层(quota_capture.py / quota_result_delivery.py / turn_envelope.py / codex_context.py / decision_capture.py 仅做参数透传),不修改底层存储格式、不引入独立服务。

  • 作用域收敛(turn_envelope_scoping.ts):通过共享前置判断 isNonReplanTurn 提取非重规划条件,新增 isScopableGoalAcceptanceTurn 允许 normal_run 与 unsettled_host_turn_recovery 在缺少 selected_todo 时从 heartbeat_receipt.settlement_identity.todo_id 推导任务,仅收敛 planning_horizon 与独立 agent_todo_summary;work_context 仍严格要求有效 selected_todo,所有重规划与全局歧义场景保持 fail-closed。
  • 未作用域历史条目延后与去重(progressive_context.ts / turn_envelope.ts):当未作用域且非重规划载体的 outcomes.length > 6(SCOPED_OUTCOME_THRESHOLD)且未请求 include_goal_acceptance_detail 时,仅保留活跃、建议、缺口或关联待办 Outcome 的完整 requirements,其余历史行的 sources 与 requirements 移至 context_details 并仅在确实发生延后时改写引导文案;legacyRecommendationFallbackReferences 仅在 isDeepStrictEqual 成立时将 heartbeat_recommendation.blocked_priority_fallback 引用化为 /blocked_priority_fallback。
  • 首读命令收敛(progressive_context.ts):在 turn_scoped_v0、outcomes.length > 6 且容器 capture_read_command、cold_read_command 与 cold_read_instruction 齐全时,initialContextReadGroups 不再对每个 summary_only 行拼接冗余指针,同时保留每行自身命令字段原样。

具体改动 / Changes

精确提交 0cc37e52199527f9d863bcc80536b2fece671b21(对照合并基线 0e8c2b2b25de168422248db5f960fed8bcf1bcba),共修改 11 个文件(+809/−35)。对照规范 docs/reference/protocols/quota-cli-hot-path-compaction-v0.md(基线修订 0e8c2b2b25de168422248db5f960fed8bcf1bcba):

  • CRIT-1(implemented):普通预认领、未结算恢复与首读在保持不可变回读的前提下收敛无关历史 requirements 与重复 blocked_priority_fallback。
  • CRIT-2(implemented):显式 --include-detail goal_acceptance 与 --include-detail all 通过 quota_detail_sections_from_args 完整透传至 progressiveContextPlan,保留全部历史 requirements 内联输出。
  • CRIT-3(implemented):autonomous_replan_required、replan_action_packet、vision_continuation_audit.required、goal_completion 与 globalAmbiguity 保持 fail-closed,不裁剪历史条目。

关键代码讲解

  • progressiveContextPlan(progressive_context.ts):读取 request.include_goal_acceptance_detail 并在 deferLargeHistoricalOutcomes 取反门控,既修复 ee6c6c512e 显式详情被二次延后的回归,又按 suggestedIds、gapOutcomeIds 和 relevantTodoIds 精确区分活跃行与历史行。
  • initialContextReadGroups(progressive_context.ts):仅当 projection_mode === "turn_scoped_v0"、容器级三项读回字段齐全且 outcomes.length > 6 时跳过 summary_only 行的初读指针展开;<= 6 边界测试确认保留行级读取指针。
  • legacyRecommendationFallbackReferences / checkedContextPresentationPlan / contextPresentationPlan(turn_envelope.ts):统一将 include_goal_acceptance_detail 与等值 blocked_priority_fallback 引用去重传给 progressiveContextPlan;不等值场景保持原对象。
  • scopeTurnGoalAcceptance(turn_envelope_scoping.ts):通过 isScopableGoalAcceptanceTurn 覆盖 unsettled_host_turn_recovery(settlement_identity.todo_id 回退)与预认领 planning_horizon,同时守住 work_context 与重规划隔离边界。
  • Python CLI 透传链(quota_capture.py、quota_result_delivery.py、turn_envelope.py):借助 quota_detail_sections_from_args 将 goal_acceptance 与 all 统一展开并透传至 prepare_codex_context、capture_progressive_context 与 project_captured_context。

对主干的风险 / Risks

  • 正反例与边界验证(PASS):已核验 tests/control_plane_ts/progressive_context.test.ts、turn_envelope_scoping.test.ts 与 tests/control_plane/test_scoped_turn_envelope_cli.py::test_explicit_goal_acceptance_detail_retains_historical_requirements_directly(覆盖 File 与 SQLite 后端)。普通入口将 8 条历史 requirements 收敛至 context_details 且可通过 supporting_material_pointer/requirements 与 capture_read_command 完整读回;显式 --include-detail goal_acceptance 与 --include-detail all 直接内联返回全部 8 条 requirements。不等 blocked_priority_fallback、<= 6 Outcome 边界与 autonomous_replan_required 均保持原语义。
  • 非本 PR 引入的基线检查失败(UNRELATED):运行 loopx canary premerge --from-git-diff --git-diff-base origin/main 时,18 项检查中 17 项通过,examples/control_plane/cli-output-budget-regression-smoke.py 在 test_brief_budget_retains_full_commands_on_real_long_paths 失败(heartbeat_prompt_brief/json emitted 11951 chars; variant ceiling is 11400)。已在同一机器对合并基线 0e8c2b2b25de168422248db5f960fed8bcf1bcba 做隔离 worktree 反证,基线完全复现同一 11951 > 11400 超限错误;全仓 loopx check --scan-path . 亦命中主干既有 apps/workbench/packages/daemon/test/context-tool-history.test.ts:30(credential),扫描本 PR 改动根 loopx/ 与 tests/ 为 0 错误(ok: True)。两者均与本 PR 无关,不阻塞审阅结论。
  • 残余边界:本次验证基于隔离 Git worktree 中的本地 TypeScript、Python CLI 与 canary 套件,未运行托管 GitHub Actions CI 及全仓库全量测试。

我的整体评价 / Verdict

APPROVE(以 author-owned COMMENTED 形式发布)。 本 PR 仅调整 CLI JSON/渐进捕获投影,不涉及渲染页面或前端视觉布局变更。 对长周期(long_horizon)任务:减少大型 Goal 在预认领、未结算恢复与首读中的冗余上下文注入并维持 100% 不可变捕获回读(improved);对用户体验(user_experience):修复 ee6c6c512e 后显式 --include-detail goal_acceptance|all 直出完整历史要求,普通模式显著缩减首包与分页(improved)。

  • 独立验证汇总(精确头 0cc37e52199527f9d863bcc80536b2fece671b21):
    • npx tsc -p tsconfig.control-plane.json --noEmit:PASS(0 errors)
    • node --no-warnings --experimental-sqlite --experimental-strip-types --test tests/control_plane_ts/progressive_context.test.ts tests/control_plane_ts/turn_envelope_scoping.test.ts tests/control_plane_ts/turn_envelope.test.ts tests/control_plane_ts/content_digest_single_owner.test.ts:PASS(110/110)
    • uv run --extra test python -m pytest tests/control_plane/test_scoped_turn_envelope_cli.py -q:PASS(12/12)
    • uv run --extra test ruff check ... / git diff --check / scripts/check_rfc_bilingual.py --base origin/main --head HEAD:PASS
    • loopx check --scan-path loopx/ --scan-path tests/:PASS(0 errors)
    • loopx canary premerge --from-git-diff --git-diff-base origin/main:17/18 PASS;cli-output-budget-regression-smoke.py(11951 > 11400)经 0e8c2b2b25de168422248db5f960fed8bcf1bcba 基线对照确认为主干既有无关失败。
  • 本次改动复用既有 quota_packet / turn_scoped_v0 / include_goal_acceptance_detail 契约,未引入新公共词汇或额外兼容债务。

English verdict: APPROVE at 0cc37e5. Explicit --include-detail goal_acceptance and all now preserve historical requirements inline across TypeScript and Python CLI entrypoints while keeping ordinary unscoped, unsettled-recovery, and first-read slimming intact; 110/110 targeted TS tests, tsc, 12/12 File/SQLite CLI tests, ruff, check_rfc_bilingual.py, and touched-root boundary scans pass, and the single cli-output-budget-regression-smoke failure (11951 > 11400) reproduces identically on merge-base 0e8c2b2b25.

@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 · xhigh

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

[P2] 显式 Todo 详情应保留完整 fallback 镜像。 存在真实高优先级阻塞与可执行备用项,同时请求 --include-detail agent-todos 或 all 并开启上下文交付。 上下文交付开启时,agent-todos 和 all 的四个后端组合由完整 fallback 诊断对象变成 context_ref。保存的完整决定、摘要绑定读取、根对象和 normal_run 均可复核。 将 agent-todos 详情意图透传给该呈现分支。显式详情保留完整 fallback 镜像,普通上下文交付继续对已确认等值的镜像去重。

动机 / Motivation

对大型 Goal 做预认领、恢复或首读的 Agent,以及显式读取 Todo 诊断的 CLI 调用方。 同一个 P0 阻塞和可继续的备用 Todo,分别通过 File 和 SQLite,比较普通、显式详情与关闭 context delivery。 上下文交付开启时,agent-todos 和 all 的四个后端组合由完整 fallback 诊断对象变成 context_ref。保存的完整决定、摘要绑定读取、根对象和 normal_run 均可复核。 本轮核对本地 File、SQLite 和精确源捕获。真实模型采用、后续补读成本及托管 CI 留待观测。 预认领和未结算恢复反复携带历史 Outcome,已绑定任务的首读还逐行展开摘要地址。 缩短普通 Turn 的工作开场并保留完整诊断、显式详情和不可变捕获读回。 对照契约 对照修订 0e8c2b2b25de168422248db5f960fed8bcf1bcba。

  • Q1 普通输出仅在两份 fallback 完全等值时允许引用,完整根值仍在同一视图。 通过。
  • Q2 既有 agent-todos 视图保留完整内联诊断。 当前反例成立。
  • Q3 原始决定与保存的捕获保留形状和原值。 通过。

改动思路 / Approach

保留 TypeScript 的 Turn 作用域和上下文呈现分工。Python 负责读取参数和传输,原始决定继续由同一 owner 核对并保存。 复用已有详情选择恢复显式读取契约,可在同一条呈现路径保留正常入口的压缩收益。 普通投影可引用等值 fallback,显式 agent-todos 详情和原始捕获保留完整镜像。 候选保留 #9498 上一轮修复的显式 goal_acceptance / all 历史要求。当前问题在 fallback 的另一条独立详情契约。 对仓库经验采用其中的最小真实路径方法,分别核对正常操作、失败和恢复后的结果。

具体改动 / Changes

精确提交 0cc37e52199527f9d863bcc80536b2fece671b21,11 个文件 +809/−35。11 文件的新增主要在三份验证。生产改动集中在 TS 呈现与作用域,Python 透传;收窄 fallback 引用可减少另一种 wire 形状的维护成本。

  • checkedContextPresentationPlan。根据完整 Turn 生成呈现计划,候选无显式 Todo 详情判断地附加 fallback 引用。 代码
  • legacyRecommendationFallbackReferences。比较根和嵌套 fallback,构造同一视图引用。原始标量恒等检查仍掌握在 requiredNativeContext。 代码
  • scopeTurnGoalAcceptance。按非重规划动作和已验证捕获缩小计划或恢复验收;工作上下文的已选 Todo 检查保留。 代码
  • initialContextReadGroups。保留当前建议的正文和容器读回导航,减少大作用域摘要逐行选择。 代码

12 项真实 File/SQLite CLI 测试和 110 项 TypeScript 测试通过,覆盖历史要求补读、显式 Goal 详情和 admission-time 恢复。配对观察 16 例的保存决定及摘要绑定选择读取一致。 定向回归测试

对主干的风险 / Risks

两个后端在基线显式详情都内联,候选显式开启时四例均引用化,关闭交付仍内联。 标准本地预检存在独立配对的基线问题。两边 heartbeat_prompt_brief 都为 11,951 字符,超过 11,400 的预算。 只读 merge-tree 和签署检查通过。真实模型采用、完整 token 成本及托管 CI未实测。

语义与 CI 对齐

在真实触发下保留调用方所选的范围。上下文交付开启时,agent-todos 和 all 的四个后端组合由完整 fallback 诊断对象变成 context_ref。保存的完整决定、摘要绑定读取、根对象和 normal_run 均可复核。 用同一真实 quota should-run 固定输入,在 File 和 SQLite 成对检查普通、agent-todos、all、关闭交付及对 decision.json 的摘要绑定选择读取。 复用现有词汇,约束由既有源码拥有者执行。

我的整体评价 / Verdict

REQUEST_CHANGES。 将 agent-todos 详情意图透传给该呈现分支。显式详情保留完整 fallback 镜像,普通上下文交付继续对已确认等值的镜像去重。 长程收益的确定性证据是较短的普通首读和可读回历史要求。显式诊断回归给排障带来额外解析分支,每个独立消费者都要处理。 保持现有 v1 决定和已保存捕获。显式 agent-todos/all 消费者无需识别新引用形状。

English verdict: REQUEST_CHANGES at 0cc37e5. With native context delivery enabled, explicit agent-todos and all replace the established inline fallback diagnostic on File and SQLite. The original signed capture and ordinary compaction remain readable.

…tail

Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
@huangruiteng
huangruiteng merged commit ff55255 into main Nov 26, 2026
8 of 10 checks passed
@huangruiteng
huangruiteng deleted the codex/slim-turn-envelope-todo-horizon-bloat-20261126 branch November 26, 2026 18:54
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