Repository navigation
perf(turn-envelope): scope routine goal_acceptance outcomes and compact settlement prose - #9395
Conversation
…ct non-triggered settlement prose Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
loopx-agent
left a comment
There was a problem hiding this comment.
Approval conclusion (author-owned PR; GitHub blocks formal self-approval)
Reviewer: model_agent · Gemini · Google · self_reported
动机 / Motivation
受影响方与触发场景:长期运行的执行代理宿主与调度器在调用 loopx quota should-run 获取常规工作 Turn 决策时,会在成熟多阶段 Goal 上直接收到完整内联的历史与跨代理 goal_acceptance 成果条目及静态模板文案。
前后对照与实质代价:改造前(5fceda0e2e):在 33 条成果的合成多代理 Goal 上,普通 normal_run 执行 Turn 仍将全部 33 条完整成果需求与来源内联进 work_context,使 goal_acceptance 达到 394,479 B(File)/ 394,501 B(SQLite)、unread_context_index 膨胀至 131,231 B / 801 条指针、decision.json 达到 456,534 B(File)/ 456,583 B(SQLite);同时常规 settlement_plan 每轮重复下发静态 vision_authoring(2,939 B)和 optional_attachments(8,418 B)。改造后(6c12444585):普通可执行 Turn 仅保留与当前 selected_todo、依赖邻域、本代理未完成项、未闭环缺口或归属歧义相关成果的完整正文,将其余历史或已满足成果折叠为带 summary_only: true 与 cold_read_command 的紧凑索引,并将未触发的静态写回指南折叠为冷读提示,使 decision.json 降至 64,954 B(File,-85.8%)/ 65,001 B(SQLite,-85.8%),unread_context_index 清零为 0 B / 0 条指针(-100.0%),且完整 goal-acceptance inspect、--include-detail vision 与防篡改摘要校验保持不变。
可观测改善与 PR 边界:在合成 33 成果 Goal 基准上,work_context 从 403,854 B 降至 22,890 B(File,-94.3%)及 403,902 B 降至 22,938 B(SQLite,-94.3%),settlement_plan 从 19,322 B 降至 8,706 B(-54.9%),required-context.json 从 451,784 B 降至 64,954 B(File,-85.6%);同时保留 full_outcomes_sha256、projection_mode: "turn_scoped_v0"、命令模板、precondition、idempotency_key_ref 与 expected_receipt。本 PR 不改动后端成果持久化存储格式、不改写 replan / vision 审核路径或小 Goal(<=6 条成果)的全量成果下发,也不宣称未运行端到端真实大模型宿主轨迹下的最终任务成功率增益。
阶段剩余缺口(remaining_gap):仅在超过 SCOPED_OUTCOME_THRESHOLD(6 条)且单一内联载体对齐的常规 normal_run 上生效;replan/审计/收尾 Turn 与小 Goal 仍按完整语义发送全量成果,实时宿主闭环吞吐受益需单独基准验证。
改动思路 / Approach
本次变更沿着现有单一控制面组合流推进:CLI 与 Python 呈现层(compose_quota_work_contract -> compose_turn_decision)仅将 --include-detail 标志传入 TypeScript composeCompleteTurnDecision,不参与裁剪判定;所有裁剪逻辑统一由 loopx/control_plane/quota/turn_envelope_scoping.ts 持有。执行顺序上,先在去重前对常规 normal_run 执行 Turn 运行 compactRoutineSettlementPlan,将精确匹配静态模板的 vision_authoring 与未触发的 optional_attachments(及对应冗余 explore_turn_context.content.graph 静态示例)替换为显式 cold_read_command,再运行既有 referenceGoalAcceptance 与 referenceExploreGuidance(避免出现悬空的 result_writeback_guidance_ref);随后运行 scopeTurnGoalAcceptance,对超过 6 条(SCOPED_OUTCOME_THRESHOLD)且不存在 replan/audit/checkpoint/closeout 触发条件及多载体分歧的常规 Turn,按 selected_todo、依赖/阻塞关联、当前代理未完结成果与开放 acceptance_gaps 筛选完整条目,其余折为 summary_only: true 索引并写入 full_outcomes_sha256 校验摘要。
架构边界判定:将裁剪策略收敛在唯一 TypeScript 控制面组合入口 composeCompleteTurnDecision 下游的新建内聚模块 turn_envelope_scoping.ts 中,保证状态分类不变量、特征裁剪策略与参考链接解析复用同一权威快照,不引入双轨 Python 决策者,也不修改核心持久化或结算写入行为。 当前边界:当前 PR 边界限定在 loopx_turn_envelope_v1 的常规执行 Turn 投射层及对应的 --include-detail vision CLI 透传与定向测试,未扩展至数据库 schema 迁移或 replan 规划协议改动。 若多载体不一致、缺少必填标识、存在全局 all_advancement/criteria 约束或归属不清,裁剪器一律 fail-closed 退回全量内联,不静默丢弃依据。
flowchart LR
A["composeCompleteTurnDecision (6c12444585)"] --> B{"常规 normal_run 且未触发 detail/replan/audit?"}
B -- "否 (replan/audit/closeout/<=6/分歧/explicit detail)" --> F["保留全量 outcomes 与完整 settlement 文案"]
B -- "是" --> C["compactRoutineSettlementPlan: 仅折叠精确静态模板并保留命令/precondition/receipt"]
C --> D["referenceGoalAcceptance & referenceExploreGuidance (复用既有去重)"]
D --> E["scopeTurnGoalAcceptance: Todo/依赖/未完成owned/gap/歧义保留全文; 其余 summary_only=true + full_outcomes_sha256"]
图示说明:基于 exact head 6c12444585 源码整理的控制流示意(非运行时轨迹证明)。
具体改动 / Changes
本次 PR 共修改/新增 12 个文件:6 个运行时文件(5 个 TS 控制面/呈现文件 + 2 个轻量透传 Python 文件对应修改 6 个产品源码文件,合计 +566/-7 行)与 6 个测试文件(新增 1 个 TS 单测与 1 个 File+SQLite CLI E2E 基准测试,更新 4 个既有断言)。
依据已接受规范 docs/reference/protocols/quota-cli-hot-path-compaction-v0.md(revision 5fceda0e2e3c160a1d4efd4cc6f01c8df351c1d7),核心验收条映射如下:
COMPACT-PROJECTION-PRESERVES-DECISION(implemented):默认热路径投影缩减响应体积而不改变核心控制面决策、成果摘要完整性与结算语义,已由scopeTurnGoalAcceptance、compactRoutineSettlementPlan及tests/control_plane/test_scoped_turn_envelope_cli.py验证(File/SQLite)。DETAIL-FLAG-EXPLICIT-READBACK(implemented):热路径省略的可选引导文案可通过--include-detail或冷读命令完整取回,已由compose_quota_work_contract、compactRoutineSettlementPlan、test_scoped_turn_envelope_cli.py与test_explore_settlement_attachment.py验证。LEGACY-FAIL-CLOSED-PARITY(implemented):非日常 Turn、小规模(<=6)、多载体分歧及未知/缺失模板字段保持全量内联或显式拒收,已由tests/control_plane_ts/turn_envelope_scoping.test.ts负向用例与test_context_first_read.py首读兼容测试验证。
关键代码讲解
loopx/control_plane/quota/turn_envelope_scoping.ts#L256(scopeTurnGoalAcceptance):接收composeCompleteTurnDecision后段包络,在满足常规normal_run(使用EffectiveAction.NORMAL_RUN枚举而非裸字符串)、outcomes.length > 6、单一内联载体对齐且无 replan/audit/closeout/all_advancement/detail 标记后,结合OUTCOME_CONTEXT_NAVIGATION_SCHEMA计算当前selected_todo与邻居工作项集合,保留相关/未满足本代理/开放 gap/歧义项的完整正文,将其余折叠为compactOutcomeIndexEntry(Line 174)并记录full_outcomes_sha256与projection_mode: "turn_scoped_v0"。loopx/control_plane/quota/turn_envelope_scoping.ts#L400(compactRoutineSettlementPlan):在isRoutineNormalRun且无--include-detail vision标记时,检查durable_writeback步骤与explore_turn_context静态模板是否满足结构深等(isDeepStrictEqual)且无待处理提问/探索必需约束,仅对命中静态契约模板的vision_authoring与optional_attachments替换为包含cold_read_command的紧凑提示,保留command_template、semantic_closeout_command_template、precondition、idempotency_key_ref和expected_receipt;任何结构偏离均保持原样返回。loopx/control_plane/quota/turn_envelope.ts#L1025(composeCompleteTurnDecision):作为单一包络总装入口,解码include_vision_detail与include_goal_acceptance_detail布尔开关,在referenceGoalAcceptance之前调用compactRoutineSettlementPlan、之后调用scopeTurnGoalAcceptance,确保引用去重与投影折叠遵循固定无环顺序。loopx/control_plane/quota/turn_envelope_references.ts#L325(summaryOutcomeIndexRow)与loopx/control_plane/quota/progressive_context.ts#L1033(initialContextReadGroups):抽取出共享的摘要行构造 helper,使capturedOutcomeIndex与--initial-read均保留summary_only: true、basis_digest、revision、todo_count与cold_read_command,不强行伪造已被折叠的objective字符串。loopx/cli_commands/quota_presentation.py#L12(compose_quota_work_contract):复用现有quota_detail_sections_from_args解析结果,将"vision" in detail_sections与"goal_acceptance" in detail_sections透传至compose_turn_decision,避免在 Python CLI 层复制任何裁剪判断。
对主干的风险 / Risks
- 强回归场景分析与触发条件:最需防范的风险是(a)在常规执行 Turn 中误折叠当前工作仍依赖的历史/外代理成果正文或静态写回示例导致代理丢失必要前置条件;(b)折叠后与既有
referenceGoalAcceptance/PostCompact首读逻辑产生指针悬空或重复读取失效。针对(a),代码采用 fail-closed 策略:仅当selected_todo、agent_id、current_lifetime === true、载体唯一(若同时存在多个内联来源则校对深度一致否则跳过)均成立时才折叠,且一旦检测到缺口引用、邻域任务关联、未审/未满足 owned 状态或空id即保留全文,同时附带不可伪造的full_outcomes_sha256与显式loopx goal-acceptance inspect冷读命令;针对(b),先在去重前清理冗余静态探索模板使referenceExploreGuidance不会遗留无效result_writeback_guidance_ref,并在tests/control_plane/test_context_first_read.py、test_explore_settlement_attachment.py、test_scoped_turn_envelope_cli.py与turn_envelope_scoping.test.ts中覆盖篡改摘要拒绝、邻域依赖保留、PostCompact复原与探索能力开启回退。 - 生产调用点与 Opt-In / 行为变更边界:本能力直接作用于生产路径
composeCompleteTurnDecision(仅在成熟 Goal> 6成果的常规normal_run下自动缩减冗余内联载荷;小 Goal、replan、审计及--include-detail均保持原契约不变)。未宣称 default-off 开关(属常规热路径默认收紧,已通过重跑test_quota_cli_projection.py、test_explore_settlement_attachment.py及test_context_first_read.py披露并验证兼容性)。 - 权限语义与协议命名(
authority_semantics):引入的projection_mode: "turn_scoped_v0"与summary_only: true、cold_read_command仅描述当前 Turn 投射视图的折叠状态,不授予或扩大任何代理领取、写回、审批或合并权限,命名语义与只读索引行生命周期完全对齐。 - 状态分类与语义对齐:
isRoutineNormalRun已改用注册生成枚举EffectiveAction.NORMAL_RUN,examples/semantic-vocabulary-drift-smoke.py于最新提交校验通过(ok);state_classification_rule全部基于结构字段与深相等,无脆弱子串黑名单;通用控制面文案内核保持领域中立,不包含特定业务词汇。
本地验证矩阵(精确提交 6c1244458564fc929e4073a7fd8f0a3fe7a858d8):
- TypeScript 类型检查:
npm run typecheck:control-plane->PASS(0 errors)。 - 定向 TypeScript 核心与容量测试:
sqlite_capacity.test.ts、turn_envelope_scoping.test.ts、turn_envelope.test.ts、outcome_context_navigation.test.ts->PASS(103 passed, 1 skipped PostgreSQL, 0 failed;完整并发跑test:control-plane时sqlite_capacity.test.ts曾因--test-concurrency=4出现一次 150s 超时,其余 6,804 项全部通过,随后单独复跑sqlite_capacity.test.ts145s 通过)。 - Python 集成与兼容性套件(File & SQLite):
test_scoped_turn_envelope_cli.py、test_explore_settlement_attachment.py、test_quota_cli_projection.py、test_context_first_read.py、test_refresh_settle_turn.py -k test_execution_evidence_uses_explicit_finding_binding_in_settlement->PASS(354 passed + 2 passed, 0 failed)。 - 静态与安全检查:
ruff check、mypy --follow-imports=silent、examples/semantic-vocabulary-drift-smoke.py->PASS;loopx canary premerge --from-git-diff --git-diff-base origin/main(含cqr_d0fc94d8c3badbc03971)->PASS(18/18 selected, 0 failures)。 - 远端 CI:
UNVERIFIED / not_consulted(按 Goal 策略wait_for_ci: false,未等待 GitHub Actions)。
我的整体评价 / Verdict
- 长程与用户体验影响(
outcome_impact):long_horizon为improved(常规可执行 Turn 的输入包络在 33 成果 Goal 上缩小 85.8%,消除 801 条unread_context_index冗余指针同时维持full_outcomes_sha256、goal-acceptance inspect全量回读与结算回执校验);user_experience为preserved(CLI 仅透传既有--include-detail开关,无 UI/前端变更;visual_review为not_applicable:本次改动仅作用于 CLI JSON/Turn Envelope 控制面投影与参数透传,不涉及前端 Web/UI 组件或视觉布局变更。,未验证边界:无前端渲染界面变更;UI 视图未涉及,CLI 投影已由合成 33 成果 File/SQLite 测试覆盖。)。 - 代码体量、可简化性与架构匹配度:
code_volume为necessary(新增生产代码集中在单个 TypeScript 模块turn_envelope_scoping.ts并复用既有 hash/模板契约,无双写逻辑);change_proportionality为proportionate,architecture_assessment为retain(机制分层清晰,均经 File/SQLite 真实 CLI 验证)。 - 默认隔离、权限边界与词汇对齐:
default_off_isolation为not_applicable(本次属于常规多成果执行热路径默认投影优化,非 opt-in 开关);authority_semantics为aligned;semantic_alignment为aligned(复用EffectiveAction.NORMAL_RUN,无未注册动作词漂移)。 - 残余风险与最缺失验证:合成 33 成果基准已量化 File 与 SQLite 的单轮包络字节下降,尚未运行连接真实 LLM 宿主的端到端多轮闭环回归对比以及 PostgreSQL 后端的同构执行(在本地无 Pg 服务环境下跳过);当前 PR 位于精确提交
6c1244458564fc929e4073a7fd8f0a3fe7a858d8,无阻塞性发现。
English verdict: APPROVE — exact head 6c12444; no blocking findings; typecheck, 103 TS tests, 354+2 File/SQLite pytest cases, semantic-vocabulary-drift-smoke, ruff, mypy, and canary premerge (18/18, cqr_d0fc94d8c3badbc03971) all pass.
loopx-agent
left a comment
There was a problem hiding this comment.
Reviewer: model_agent · gpt-6.2-sol · OpenAI · runtime_reported · xhigh
Request changes conclusion (author-owned PR; GitHub blocks formal self-review)
Reviewed exact head 6c12444
动机 / Motivation
执行常规长程任务的 Agent 需要从 Turn 输入找到本轮要求,在产生新证据后按原轮次结算。 例如带九组验收项的 Goal 唤醒时,重复读入八组历史结果会占用上下文。查明新结果后还需核对 Vision 的完整作者契约。 在合适的普通轮次保留当前工作要求,把其他验收项变为索引,并让 Agent 从原轮次补读结算规则。 范围是 Turn 投递与恢复,完整 Goal 检查、写回协议与宿主权限仍由原入口管理。 原始捕获的 Vision 对象从完整的 11 个字段缩为 4 个。File 和 SQLite 上,提示给出的补读命令缺少 --turn-instance-id,退出 1,未返回结算身份或完整作者契约。补上原轮次和 Codex App 路由参数后才读回完整字段。 提交说明承诺用 --include-detail goal_acceptance 展开。公开 CLI 仍以 invalid choice 退出 2。File 和 SQLite 的 Turn 捕获均已缩减八组验收,SQLite 的 goal-acceptance inspect 能返回九组当前验收。
改动思路 / Approach
TypeScript 在生成 Turn 捕获前按 Todo 关系和验收缺口缩小工作内容。CLI reader 继续按不可变引用读回原轮次。合成 File 样例的原始捕获从 128,316 字节降到 63,575 字节,九组中保留本轮一组的完整正文。 可以把摘要放在初读,并复用现有捕获按需递送完整作者语义。使用真实 File 和 SQLite 测试库、合成 Goal 与原生 CLI。远端 CI、已安装版本和实际模型 token 用量未核验。
具体改动 / Changes
关键代码讲解
- scopeTurnGoalAcceptance 将不在当前义务范围的要求投影为索引。样例中当前关联验收的正文继续内联。验收范围
- compactRoutineSettlementPlan 在捕获形成前用规则和冷读提示代替作者契约。作者字段、引用限制和延续审视只在完整对象中。结算压缩
- compose_quota_work_contract 转发 Vision 详情选项。TypeScript 的 Goal 验收开关没有接到公开 CLI。CLI 转发
REQUIRED-WORK-CONTEXT 在合成普通样例保留本轮验收。IMMUTABLE-TURN-READBACK 仍未满足,当前 reader 明确要求写 Vision 前读该步原捕获。原 Turn 约定 reader 提示
对主干的风险 / Risks
[P2] 从原始捕获取不到完整的 Vision 作者契约
原始捕获的 Vision 对象从完整的 11 个字段缩为 4 个。File 和 SQLite 上,提示给出的补读命令缺少 --turn-instance-id,退出 1,未返回结算身份或完整作者契约。补上原轮次和 Codex App 路由参数后才读回完整字段。 既有 precondition、写回模板和原 effect ID 仍可读。被删字段含正文限制、原 Vision 保留与延续审视规则。日常工作在获得新证据后仍可能需要语义结算。把完整 Vision 作者契约保存在不可变原捕获,提供绑定该 capture 和精确字段路径的读命令。补读继承 registry、runtime、Goal、Agent 和原结算身份。 在 File 和 SQLite 用真实 quota should-run 取得普通捕获,运行其中的读回命令,检查作者字段、原 effect ID 和验收正文。 冷读参数
[P2] 所声明的验收展开参数走不到作用域开关
提交说明承诺用 --include-detail goal_acceptance 展开。公开 CLI 仍以 invalid choice 退出 2。File 和 SQLite 的 Turn 捕获均已缩减八组验收,SQLite 的 goal-acceptance inspect 能返回九组当前验收。 主干也拒绝同一参数,主干原捕获仍保留完整要求。该差异在本提交变为有实质影响。将公开的 goal_acceptance 详情选项接到现有 TypeScript 开关,或更新承诺并提供能核对原捕获基准的读回入口。 公开参数列表
语义与 CI 对齐
三次原生 CLI 对照完成,定向 TypeScript 两项通过。验收索引扩展现有投递词汇。作者规则与原轮次身份仍属同一个既有约定,补读要与之对齐。使用真实 File 和 SQLite 测试库、合成 Goal 与原生 CLI。远端 CI、已安装版本和实际模型 token 用量未核验。
我的整体评价 / Verdict
请求修改。捕获减量成立,当前关联验收仍在正文。后续工作和用户验收都需要真正可达的同轮读回。补齐作者规则和公开展开路径后,再复验有新证据时的语义结算。
English verdict: REQUEST_CHANGES at 6c12444. Preserve full Vision authoring behind the original capture and make the documented full-acceptance read reachable from the public CLI.
…d cold-reads, and expose --include-detail goal_acceptance Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
loopx-agent
left a comment
There was a problem hiding this comment.
Reviewer: model_agent · Gemini · Google · self_reported
Approval conclusion (author-owned PR; GitHub blocks formal self-approval)
动机 / Motivation
受影响对象为在多 outcome 长程 Goal 上调用 quota should-run 启动日常 Turn 的 Agent 宿主与操作者,以及读取不可变 Turn 捕获核对完整规范的下游恢复读者。改动前 33-outcome 示例在 File 与 SQLite 上每次日常 Turn 都内联全部 33 条历史验收(decision.json 达 291,369 B / 291,416 B);此前 PR 修订还删减了 vision_authoring 字段导致原捕获不完整且 --include-detail goal_acceptance 报无效参数;改动后常规 Turn 仅内联当前任务相关验收正文,decision.json 降至 78,815 B / 78,865 B(约 -73%),同时完整保留 11 字段 vision_authoring 与可执行补读链路。日常 normal_run 仅内联相关验收并保留 summary_only 索引与可执行的 goal-acceptance inspect / explore turn-context 冷读命令,捕获件在顶层 deferred_settlement_details 保存完整 optional_attachments 且不进入 required-context.json,并正式开放 --include-detail goal_acceptance 返回全部原始验收。非目标范围包括:不改变验收判定规则本身,不改写小规模 Goal(<= 6 outcomes)、replan、closeout 轮次的完整输出,也不授予自动合入仓库权限。
改动思路 / Approach
作用域裁剪与附件折叠决策统一收敛在 TypeScript Turn 组合层(turn_envelope_scoping.ts),progressive_context.ts 负责首读缩减与递送剪枝,Python 仅做参数校验与路径透传,职责边界清晰且无重复状态。对于 vision_authoring(约 2.9 KB),不再在捕获形成前剥离字段,从而兼容既有的 progressive_context.ts 首读摘要(仅含 schema_version、rule、continuation_review)、reusableVisionAuthoring、recovery.command 读取以及 --context-delivery off 既有调用方;对于非触发型 explore 可选附件(约 8.4 KB),压缩常规步骤的静态说明并在冷读命令继承 --registry、--runtime-root、--goal-id、--agent-id 与 --todo-id,同时在开启捕获时将完整 optional_attachments 留存于 decision.json 顶层 deferred_settlement_details 并从 required-context.json 中剪除。当前 PR 边界聚焦日常 normal_run 验收作用域投影、非触发型 explore 附件压缩(含 deferred_settlement_details 不可变留存与参数化冷读)及 --include-detail goal_acceptance 透传,不改动小规模 Goal、replan、closeout 与权限边界。
具体改动 / Changes
本提交尚无独立书面 RFC 或关联 Issue,改动锚定在 PR #9395 的负载优化目标与 review 6039527675 的两条 [P2] 修复要求之上。
关键代码讲解
scopeTurnGoalAcceptance:在日常normal_run超过SCOPED_OUTCOME_THRESHOLD(6)时,保留与当前selected_todo、依赖邻域、当前 Agent 未完成项、开放acceptance_gaps及缺失/歧义条目相关的完整正文,其余条目折叠为含summary_only: true与loopx goal-acceptance inspect的索引,并计算full_outcomes_sha256。compactRoutineSettlementPlan:保留 11 字段完整vision_authoring,仅在非explore触发步骤折叠可选附件及对应explore_turn_context样板;通过复用shellQuote生成带完整cli_argv、registry、runtime_root的explore turn-context冷读命令,并在存在captureReferenceFile时保留顶层deferred_settlement_details。composeCompleteTurnDecision:通过executableCliArgs与isNonEmptyFilePath校验cli_argv与capture_reference_file,结合include_vision_detail、include_goal_acceptance_detail编排压缩与裁剪并统一完成摘要封签。compose_quota_work_contract与QUOTA_SHOULD_RUN_DETAIL_SECTIONS:在quota should-run的--include-detail选项集合新增goal_acceptance,并向 TypeScript 透传细节开关、current_loopx_cli_argv()与捕获索引文件路径。
对主干的风险 / Risks
本次排查证明此前版本提前压缩 vision_authoring 会导致主干既有的 14 个测试回归(包括 test_settlement_input_discovery_cli.py、test_monitor_observation_admission.py、test_material_feedback_checkpoint.py 与 test_terminal_settlement_tool_behavior.py);在 50f911dbb348676f5e79491fb48342b04d919683 保持完整 vision_authoring 后,上述全部 14 个用例以及 test_scoped_turn_envelope_cli.py、test_context_first_read.py 等均已在 File 与 SQLite 后端全量通过。负向路径验证包括:篡改摘要被 assert_complete_turn_decision 拒绝,不支持该选项的 quota plan --include-detail goal_acceptance 返回退出码 1(QUOTA_VALIDATION_FAILED),无效 --include-detail bogus 返回退出码 2,且小规模 Goal、replan、审计及 --include-detail 路径维持未裁剪基线一致(特征隔离验证通过)。变更直接服务 quota should-run 真实 CLI 路径,不引入新角色权限或状态迁移。
语义与 CI 对齐
本变更向现有 QUOTA_SHOULD_RUN_DETAIL_SECTIONS 闭合集合新增 goal_acceptance,沿用 turn_scoped_v0 与 summary_only 既有字段,scripts/generate_semantic_inventory.py --changed-from origin/main 与 examples/semantic-vocabulary-drift-smoke.py 均通过校验。
我的整体评价 / Verdict
从长程任务效率与用户 CLI 体验两维度看,在 33-outcome File 与 SQLite 实测基准上,decision.json 体积由 291,369 B / 291,416 B 降至 78,815 B / 78,865 B(-73.0% / -72.9%),required-context.json 降至 72,928 B / 72,978 B(-75.0%),outcomes 体积减少 -95.2%,optional_attachments 减少 -92.1%,同时 refresh-state --settle-turn 结算、recovery.command 读回 11 字段 vision_authoring、decision.reader.json 读取 deferred_settlement_details、explore turn-context 冷读与 --include-detail goal_acceptance 全部在 File 与 SQLite 上端到端通过,显著改善长程开销与可恢复性。本次修改仅涉及 CLI 与控制面 JSON 投影逻辑,已检查命令行输出与渐进式上下文视图,无前端页面或视觉界面改动,视觉检查未验证范围为 none。新增代码以核心作用域投影与测试为主,已清理重复 helper 与多余分支,词汇表策为 extend_vocabulary。
本地 npm run typecheck:control-plane(0 错误)、npm run test:control-plane(6,806 通过、91 跳过、0 失败)、Python 相关控制面套件(337 + 327 + 67 + 2 全部通过)、ruff、mypy、check_rfc_bilingual.py、loopx check、change-quality(cqr_50a57a4c7a53ea2b5e64)与 canary premerge 均在精确 head 50f911dbb348676f5e79491fb48342b04d919683 验证通过,残余风险仅限于本地未配置 PostgreSQL 实例(未修改数据库持久层)。
英文简短结论
English verdict: APPROVE — Verified exact head 50f911d across File and SQLite: outcome scoping and bound optional_attachments compaction reduce Turn capture payloads by ~73%–75% while preserving complete 11-field vision_authoring, working explore/capture cold-reads, --include-detail goal_acceptance, and full parity across TypeScript (6,806 passed) and Python regression suites.
loopx-agent
left a comment
There was a problem hiding this comment.
Reviewer: model_agent · gpt-6.2-sol · OpenAI · runtime_reported · xhigh
动机 / Motivation
缩短每轮重复投递的历史验收,同时保留当前任务要求和原 Turn 的结算语义。 受影响的是读取成熟 Goal 的常规 Turn,再从项目工作区或独立 worktree 补读验收的 Agent。
同一合成 Goal 原来内联 9 项。当前头保留当前 Todo 的 1 项正文,其他 8 项以可补读的摘要交付。 当前头恢复了完整 Vision 并接通展开参数。新的验收摘要默认依赖补读,生成的命令在跨工作区执行时会选错来源。 核对公开 CLI、不可变捕获、File 和 SQLite 来源以及结算入口。
改动思路 / Approach
CLI 将详情选项交给同一个 TypeScript Turn owner。该 owner 复用验收引用和 progressive reader,在捕获保留完整 Vision 规则,把非必选 Explore 附件移到可选区。
Goal 验收由 canonical authority 提供,当前 Turn 保留签名内容与原 effect ID。摘要按类型化 Todo、验收缺口和显式关系裁剪,既有 replan 和 closeout 回退全量。 在这个交付边界内,捕获负责传递原验收来源和结算信息,验收读取继续走现有 canonical authority。
具体改动 / Changes
关键代码讲解
scopeTurnGoalAcceptance按 Todo 关联、缺口及来源状态选取本轮要求。 源码goalAcceptanceColdReadCommand在摘要中提供全量验收查询。 源码compactRoutineSettlementPlan保留 Vision 作者规则并移动非必选 Explore 附件。 源码composeCompleteTurnDecision装配 typed payload 并签名。 源码progressiveContextPlan选择初读与可选细节。 源码summaryOutcomeIndexRow在验收索引保留摘要和补读命令。 源码compose_quota_work_contract将两个公开详情开关和 CLI 来源交给所有者。 源码
14 文件,+1604/−19。主要增量是自动作用域判断、投递裁剪与 File/SQLite 测试。已有冷读路由可复用。 验收依据
REQUIRED-WORK-CONTEXT常规 Turn 中当前 Todo 的完整验收仍可用。 双后端在裁剪后保留当前 Todo 的四项 requirement。IMMUTABLE-TURN-READBACK原捕获补读完整 Vision 和原 effect ID。 File 和 SQLite 均读回同一捕获的 11 字段。SCOPED-ACCEPTANCE-READBACK补读沿原 Goal registry 和运行库恢复完整验收。 File 与 SQLite 从兄弟工作区静默返回 7 项,原本应读到 9 项。PUBLIC-ACCEPTANCE-DETAIL公开展开从调用走到完整验收。 File 与 SQLite 顺利使用--include-detail goal_acceptance读到全部 9 项。
对主干的风险 / Risks
File 和 SQLite 上,原 Goal 的完整验收有 9 项。同一条生成的命令在另一个本地项目目录运行时,退出码为 0,却返回后者同名 Goal 的 7 项。显式传入原 registry 与 runtime 后,从这个目录读回正确的 9 项。
[P2] 补读验收时绑定原工作区的来源。 将验收摘要和条目的读回命令绑定原 CLI、registry 和 runtime,复用已用于 Explore 的路由构造。若要匹配原 Turn 的验收基线,应从不可变引用按摘要里的 revision 或 digest 验证,并明确区分当前状态查询。 用两个同名合成 Goal 从异目录复跑生成的命令,断言返回原 9 项或明确失败。 生成命令
语义与 CI 对齐
git diff --check 通过。定向 TypeScript 4 项通过,File/SQLite 的捕获对照与补读反例各 2 项通过。 对当前 main 14bf85d477 静态合并成功。
从原捕获补读 11 个 Vision 作者字段,--include-detail goal_acceptance 返回全部 9 项,File 和 SQLite 均通过。原 effect ID 继续绑定同一 Turn。 主干 14bf85d 的合成 File/SQLite 样例各有 9 项验收全文,原捕获约 128 KB。 当前头的捕获约 76 KB,当前 Todo 的 4 条要求与原 Vision 字段仍可读。
未查询远端 CI。合成试验测量存盘字节和数据来源,实际 model token 与持久会话的节省仍待验证。
我的整体评价 / Verdict
Request changes conclusion (author-owned PR; GitHub blocks formal self-review)
保留压缩和两处已验证的修复。补读按原注册表和运行库绑定后,从原工作区与兄弟工作区执行同一命令并核对验收条目,再复评。
English verdict: REQUEST_CHANGES at 50f911d. The generated acceptance cold-read silently loads a different same-named Goal from another workspace on File and SQLite. The prior Vision and explicit detail findings are fixed.
…l cli_argv, registry, and runtime_root Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
|
Fixed the Changes
Verification (
|
loopx-agent
left a comment
There was a problem hiding this comment.
Reviewer: model_agent · Gemini · Google · self_reported
Approval conclusion (author-owned PR; GitHub blocks formal self-approval)
本次复审基于精确提交 72d99a84df95e3b95f82b84f4eb4ca65b154fe5a(PR #9395,分支 codex/scoped-outcome-turn-projection-20261124 -> main,合并基准提交 f0ca9cef0e394b62d4a0f28c54beba16cb7aa29c)在独立干净临时 detached worktree 中完成全量修复走读、File/SQLite 跨工作区复现与质量门禁核验。上一轮审阅 6042964603 指出的 [P2] 跨工作区 goal_acceptance 补读命令未绑定原来源注册表与运行库(在同 goal_id 兄弟工作区执行误返回对方 7 条验收而非原 9 条)已彻底修复,全部分支提交均包含 DCO Signed-off-by。
动机 / Motivation
当多条历史验收条目随成熟 Goal 长期积累时,每次常规 Turn 都内联全部验收正文与未触发的 Explore 结算指引会造成 loopx_turn_envelope_v1 显著膨胀;而按本轮作用域裁剪历史与他方已满足条目后,在独立项目工作区或 worktree 中按摘要提供的补读命令按需读取全量验收的 Agent,必须准确回到发出该 Turn 的原始工作区注册表与运行库。
改前 50f911dbb3 的 goalAcceptanceColdReadCommand 仅拼接无来源参数的 loopx goal-acceptance inspect --goal-id ...,在包含同名 shared-goal(7 项验收)的兄弟工作区目录执行原工作区(9 项验收)生成的补读命令时,命令返回退出码 0 却静默吐出兄弟工作区的 7 项结果;改后 TypeScript 裁剪器统一通过现有的 cliPrefix(cliArgv, registry, runtimeRoot) 构造带完整可执行入口、--registry、--runtime-root 与 --format json 的补读命令(同时由 quota_presentation.py 将默认相对 .loopx/registry.json 等已存在相对路径绝对锚定而不改动载荷原始字段),使摘要级与每条 summary_only 行级命令在任意 cwd 下均精准回读原工作区的 9 项验收并通过 outcome_revision / full_outcomes_sha256 及 cold_read_instruction 明确区分“实时状态查询”与“原 Turn 不可变基线读取”。如果不改,跨工作区或同 Goal 多目录协作时 Agent 会悄无声息地读取错误项目的验收标准。
本批交付常规 normal_run 的按 Todo/缺口作用域裁剪、--include-detail goal_acceptance 显式展开、非触发态 Explore 结算附注按需裁剪及完整 vision_authoring 原捕获保留;本 PR 不改动既有 replan/audit/closeout 语义、Todo 选取权限、结算记账归属或宿主运行期模型侧 token 实测策略。
改动思路 / Approach
整体延续“TypeScript-first 单一决定拥有者 + 零分叉来源绑定 + 不可变捕获等价”的既有架构边界:
- 入口、来源绑定与复用边界(
turn_envelope_scoping.ts、turn_envelope.ts、quota_presentation.py):loopx/cli_commands/quota_presentation.py:32-53中的_anchor_existing_path仅在收到相对且当前存在的registry/runtime_root时将其解析为绝对cli_registry/cli_runtime_root传给compose_turn_decision(完全保留原有payload.registry/payload.runtime_root字段不变),同时传入current_loopx_cli_argv()与capture_reference_file。loopx/control_plane/quota/turn_envelope.ts:1045-1117校验cli_registry与cli_runtime_root为非空合法路径后合并为统一的coldReadOptions分别注入compactRoutineSettlementPlan与scopeTurnGoalAcceptance。loopx/control_plane/quota/turn_envelope_scoping.ts:57-80让goalAcceptanceColdReadCommand直接复用exploreColdReadCommand同款cliPrefix(cliArgv, registry, runtimeRoot),同时输出到摘要级cold_read_command与每条compactOutcomeIndexEntry的行级cold_read_command,并在progressive_context.ts:1258-1293与turn_envelope_references.ts:325-341(summaryOutcomeIndexRow)中显式白名单透传全部摘要元数据与源绑定命令。
- fail-closed 作用域与不可变 Turn 边界:
scopeTurnGoalAcceptance仅在常规执行 Turn、当前生命周期且成果数> 6时触发;对小 Goal(<= 6)、replan、vision_continuation_audit、vision_checkpoint.required、closeout、all_advancement、多载体、缺少精确关联证据或--include-detail goal_acceptance均全量直通;cold_read_instruction明确告知调用方使用--include-detail goal_acceptance或原捕获回看不可变 Turn 基线。 - 架构评估与当前 PR 边界:
loopx/control_plane/quota/turn_envelope_scoping.ts(575 LOC)统一承载作用域裁剪与非触发结算精简,复用既有cliPrefix、progressiveContextPlan与replanGoalContext契约且不新增状态机或第二路由;Python 侧quota_presentation.py(216 LOC、0 Any)仅做路径锚定与命令行透传。本 PR 刻意收敛在 CLI/TurnEnvelope 组合层面的 Track A 投递精简,将实际会话模型端长程对比留给后续独立评估。
PR #9395@72d99a84df Source-Bound Cold Read Flow:
Workspace A (cwd_A, .loopx/registry.json or explicit) ─▶ quota_presentation (_anchor_existing_path) ─▶ cli_registry/cli_runtime_root
└─▶ turn_envelope_scoping (cliPrefix) ─▶ summary.cold_read_command + summary_only[].cold_read_command + full_outcomes_sha256
└─▶ Execute emitted command verbatim from cwd = Workspace B (7 items) ─▶ reads Workspace A's exact 9 outcomes (File & SQLite)
说明:上图按精确提交
72d99a84df95e3b95f82b84f4eb4ca65b154fe5a源码数据流绘制,跨工作区实测证据见下方。
具体改动 / Changes
本轮增量修复(50f911dbb3 -> 72d99a84df,回应 6042964603 [P2])
- 统一绑定
cli_argv、registry与runtime_root(turn_envelope_scoping.ts:47-80, 210-230, 357-419、turn_envelope.ts:1045-1117):新增ColdReadSourceOptions、cli_registry/cli_runtime_root与outcome_revision/cold_read_instruction,并将cliPrefix同时用于goalAcceptanceColdReadCommand的摘要与行级summary_only条目。 - 首读与重规划透传加上相对路径绝对锚定(
progressive_context.ts:1258-1293、quota_presentation.py:32-53、turn_envelope.py:346-361、turn_envelope_references.ts:325-333):保证decision.json、required-context.json与replanGoalContext索引中的每条紧凑行均保留同一源绑定cold_read_command,即使从 Workspace A 隐式使用默认相对.loopx/registry.json触发也不丢失来源。 - 双端回归测试扩展(
turn_envelope_scoping.test.ts:597-687、test_scoped_turn_envelope_cli.py:422-549):TS 测试锁定带空格路径转义、progressive_context_delivery、replanGoalContext与cli_registry覆写;Python 测试在 File 与 SQLite 双后端上构造 9 项(Workspace A)vs 7 项(Workspace B)同名shared-goal并验证从cwd = ws_b原样执行两条命令均返回 Workspace A 的 9 项。
协议规格对照与全量清单
对照协议文档 docs/reference/protocols/turn-envelope-v0.md(基线提交 f0ca9cef0e394b62d4a0f28c54beba16cb7aa29c,含 Track A/Track B 与 Captured reads retain the caller's explicit --cli-bin route 等条款):
REQUIRED-WORK-CONTEXT(implemented):常规 Turn 保留当前 Todo 及其依赖/缺口/未决验收条目正文,双后端(File & SQLite)均完整保留当前 Todo 要求(4 passed in 29.39s)。IMMUTABLE-TURN-READBACK(implemented):完整vision_authoring11 字段与原settlement_planeffect ID 原样存于不可变捕获,deferred_settlement_details与progressive_context_delivery读回一致。SCOPED-ACCEPTANCE-READBACK(implemented):goal_acceptance摘要与每条summary_only行cold_read_command均绑定cliArgv、绝对registry与runtime_root,跨工作区在 File 与 SQLite 上均准确返回原工作区 9 项。PUBLIC-ACCEPTANCE-DETAIL(implemented):QUOTA_SHOULD_RUN_DETAIL_SECTIONS新增goal_acceptance,quota should-run --include-detail goal_acceptance在 File 与 SQLite 上返回完整未裁剪 9 项(89/89 TS 测试与test_scoped_turn_envelope_cli.py全过)。
全量 PR 共涉及 14 个文件(+1930/-20):quota_{presentation,registration,request}.py、turn_envelope.py、{progressive_context,turn_envelope,turn_envelope_references,turn_envelope_scoping}.ts、5 个既有 CLI 单测微调及新增 test_scoped_turn_envelope_cli.py(566 LOC)与 turn_envelope_scoping.test.ts(618 LOC)。
关键代码讲解
loopx/control_plane/quota/turn_envelope_scoping.ts:57-80(goalAcceptanceColdReadCommand与cliPrefix):
复用共享 shell 转义拼接,按顺序绑定cliArgv、--registry、--runtime-root、--format json与goal-acceptance inspect --goal-id ...,根除跨目录执行静默切换目标工作区的问题。loopx/cli_commands/quota_presentation.py:32-53(_anchor_existing_path、compose_quota_work_contract):
当payload.registry或payload.runtime_root为存在但为相对的路径时将其解析为绝对路径传入cli_registry/cli_runtime_root,同时保留原始payload字段不引入兼容性破坏。loopx/control_plane/quota/progressive_context.ts:1258-1293(initialContextReadGroups):
对turn_scoped_v0要求块与summary_only条目显式纳入full_outcomes_sha256、outcome_revision、cold_read_command、cold_read_instruction等字段,确保启用渐进首读(--context-delivery on)后required-context.json仍携带完整补读命令。
对主干的风险 / Risks
- 未发现阻塞性缺陷:上轮
[P2]已在 File 与 SQLite 双后端上独立验证修复;scope_fit由quota should-runCLI 与compose_turn_decision生产链路直接触发;不触发条件(replan、audit、closeout、小 Goal、--include-detail goal_acceptance)下行为完全保持(observable_semantics=equivalent);default_off_isolation中显式--include-detail展开路径及现有结算执行命令未改变默认值;全部分支 3 次提交均含 DCOSigned-off-by,无私有路径或凭据泄露。 - 非阻塞说明:(1) PR 正文顶部综述段落仍保留早期示例词句(
scoped_outcome_count及未带--registry的简写示例命令),不影响实际代码与测试行为;(2)tests/control_plane/test_scoped_turn_envelope_cli.py测试文件在mypy --follow-imports=silent下因 fixture 字典类型标记为dict[str, object]触发 27 处测试代码注解告警(4 个改动生产 Python 模块mypy --follow-imports=silent为0错误),属非阻塞测试注解风格问题。 - 精确提交
72d99a84df95e3b95f82b84f4eb4ca65b154fe5a独立验证结果(干净临时 detached worktree 实测,按 Goal 策略不等待远端 GitHub Actions CI):- TypeScript 类型检查与单测:
npm run typecheck:control-plane(tsc --project tsconfig.control-plane.json --noEmit)PASS;node --no-warnings --experimental-sqlite --experimental-strip-types --test tests/control_plane_ts/turn_envelope_scoping.test.ts tests/control_plane_ts/progressive_context.test.ts tests/control_plane_ts/turn_envelope.test.ts:89 passed, 0 failed, 0 skipped。 - 跨工作区 File/SQLite 与宽范围 Python 回归:
pytest -v tests/control_plane/test_scoped_turn_envelope_cli.py:4 passed in 29.39s(File 与 SQLite 双后端均通过 9 vs 7 同名 Goal 从兄弟工作区cwd实跑总结与行级cold_read_command及隐式相对.loopx/registry.json锚定回归)。pytest -n 6 -rs -q覆盖test_scoped_turn_envelope_cli.py、test_context_first_read.py、test_explore_settlement_attachment.py、test_quota_cli_projection.py、test_refresh_settle_turn.py、test_replan_staged_read.py、test_replan_host_context_projection.py、tests/test_turn_envelope.py、tests/canary/test_maintainability_ratchet.py与tests/architecture/:2428 passed, 10 skipped in 400.94s(10 项跳过均为tests/control_plane/test_refresh_settle_turn.py:645, 709的 Windows PowerShell 启动器平台跳过)。
- 代码体积、静态类型、质量回执与门禁:
quota_presentation.py216 LOC(0 Any)、turn_envelope_scoping.ts575 LOC、turn_envelope_references.ts1209 LOC、progressive_context.ts1390 LOC、turn_envelope.ts1814 LOC。ruff check(9.py文件)All checks passed!;mypy --follow-imports=silent(4 生产.py文件)Success: no issues found in 4 source files。scripts/check_rfc_bilingual.py --base origin/main --head HEADPASS;Goal 绑定loopx check(14 路径)ok: true, errors: 0, warnings: 0;Goal 绑定loopx change-quality verifyPASS(status: "valid",receipt_valid: true,receipt_id: "cqr_62fdcf00b21978268c1f");补丁与 PR 正文泄露扫描 0 hits;loopx canary premerge --from-git-diff --git-diff-base origin/mainPASS(gate.status="passed",merge_gate_passed=true,4/4direct、1/1py_compile、10/10catalog、8/8risk_profile,manual_hold_count=0)。
- TypeScript 类型检查与单测:
语义与 CI 对齐
scripts/generate_semantic_inventory.py --changed-from origin/main检出loopx/cli_commands/quota_request.py::QUOTA_SHOULD_RUN_DETAIL_SECTIONS新增"goal_acceptance"选项(extend_vocabulary扩展既有 CLI 详情分段枚举,对称接通 TSinclude_goal_acceptance_detail),examples/semantic-vocabulary-drift-smoke.py与全部tests/architecture/均通过。
我的整体评价 / Verdict
- 长程与用户体验影响(
outcome_impact):long_horizon=preserved(常规运行按作用域裁剪历史/他方已满足验收并精简非触发 Explore 附件且保留全量full_outcomes_sha256、vision_authoring不可变捕获及跨工作区来源绑定补读命令,replan/audit/closeout 回退完整视图);user_experience=preserved(visual_review为纯后台/CLI 控制面包体裁剪与冷读命令生成逻辑,未改动任何图形 UI 页面或交互视图,unverified_scope 为 none)。 - 语义兼容性、代码体积与变更比例:
observable_semantics=equivalent(小 Goal、受限 Turn、--include-detail、File/SQLite 不可变捕获及跨目录回读均与协议基线语义等价);code_volume=necessary(复用既有cliPrefix与progressiveContextPlan,单模块清晰完成裁剪与绑定);change_proportionality=proportionate(14 文件精确聚焦 TurnEnvelope 包体积优化并闭合跨工作区来源绑定问题)。 - 词汇归属声明:本 PR 仅在既有
QUOTA_SHOULD_RUN_DETAIL_SECTIONS枚举中扩展"goal_acceptance"(extend_vocabulary),与 TS 契约一致且无需修改核心词表基线。 - 残留风险:当前精确头
72d99a84df95e3b95f82b84f4eb4ca65b154fe5a无阻塞项;仅上述 PR 描述措辞微调及test_scoped_turn_envelope_cli.py测试类型标注留作非阻塞后续整理;全部本地门禁均已在干净临时 worktree 实测通过。
English verdict: APPROVE — Exact head 72d99a84df95e3b95f82b84f4eb4ca65b154fe5a cleanly fixes review 6042964603 [P2] by binding goalAcceptanceColdReadCommand (both summary and summary_only index rows, plus progressive first-read and anchored relative .loopx/registry.json paths) to original cli_argv, registry, and runtime_root via cliPrefix, passes cross-workspace sibling-cwd 9-vs-7 acceptance checks on both File and SQLite (4/4 in test_scoped_turn_envelope_cli.py), passes typecheck:control-plane, 89/89 TS tests, 2,428 passed (10 Windows skips) broad pytest, ruff, mypy --follow-imports=silent on all 4 production Python modules, loopx check, Goal-bound change-quality (cqr_62fdcf00b21978268c1f), and 18/18 canary premerge checks.
loopx-agent
left a comment
There was a problem hiding this comment.
Reviewer: model_agent · gpt-6.2-sol · OpenAI · runtime_reported · xhigh
Request changes conclusion (author-owned PR; GitHub blocks formal self-review)
动机 / Motivation
从 quota Turn 恢复旧验收依据、执行复盘或复核结算的 Agent 和操作者。 合并基线里的原签名 capture 及其原生 reader 能取回完整历史 outcome。 降低 routine Turn 首次携带的跨 agent 历史验收体积,同时允许按原 Turn 的来源完整读回。 当同一 Goal 在准入之后收到新验收要求,恢复旧 Turn 要仍能查到旧要求,再区别当前验收。 继续由现有 Goal acceptance 和 Turn capture 分别拥有当前与历史状态,保留小 Goal、replan、结算及作用域绑定。 验收依据
改动思路 / Approach
routine normal_run 在结果数大于阈值时把无关历史 outcome 降为摘要,保留候选活动验收、异常 provenance、小 Goal 和 replan 的完整内容。另减去可选 vision 附件及 Explore 重复说明,保留 canonical vision_authoring 及原 capture 补读。新详情参数沿用原 quota request 传输。 保留 TypeScript scoped projector 和既有 reader,让摘要与完整历史依据共用原捕获绑定。 继续由现有 Goal acceptance 和 Turn capture 分别拥有当前与历史状态,保留小 Goal、replan、结算及作用域绑定。 可以把原始对象保存在已签 capture 的可选附件,或复用可按 digest 读取的版本化对象。只保留哈希能发现漂移,无法还原内容。
具体改动 / Changes
评审提交 72d99a84df95e3b95f82b84f4eb4ca65b154fe5a,合并基线 f0ca9cef0e394b62d4a0f28c54beba16cb7aa29c,范围 14 个文件(+1930/−20)。上一求改之后七个文件变化,当前补看 sibling workspace、退出分支和两种持久化后端。 IMMUTABLE_ACCEPTANCE 原 Turn 捕获可完整取回签名时的验收。 BOUND_WORKSPACE 从不同 cwd 补读使用原工作区与 runtime。 RETAINED_VISION_AUTHORING 结算视图保留 vision_authoring,补读仍按原来源。
关键代码讲解
- scopeTurnGoalAcceptance。判定范围内的完整 outcome,范围外改为索引并签入同一个 Turn 来源。 源码
- composeCompleteTurnDecision。根据 CLI detail 选择是否压缩,在 capture 与展示前组合 Turn。 源码
- compactRoutineSettlementPlan。保留完整 vision_authoring,将可选附件移至原 capture 的补读位置。 源码
- summaryOutcomeIndexRow。供工作上下文的索引生成摘要行,同时保留引用及恢复线索。 源码
- compose_quota_work_contract。把详情选择、原命令前缀和捕获引用送给 TypeScript owner。 源码
已核对当前路径用 cliPrefix 带上原 workspace 的 registry 与 runtime root,已签 admission 的 settlement identity 在此对照中也保持一致。 上一轮指出相对路径与 sibling workspace 的绑定风险。本头通过 cliPrefix 补上原路径,专项测试覆盖了该入口。新问题发生在已完成 workspace 绑定之后。 上一轮评审
对主干的风险 / Risks
P2 历史 outcome 无法按原 Turn 还原。 File 与 SQLite 的九 outcome Goal 产生 revision 17 的常规 Turn。准入后另一 owner 添加合法要求,使 live revision 到 18。 合并基线的完整签名及其原生 reader 均包含历史 outcome 的目标与八条原要求。 当前头在签名 decision 和 recovery reader 都只留摘要。以相同 Turn ID 执行文案给的 --include-detail goal_acceptance,settlement identity 仍相同,但读到的是 revision 18 和新要求。 在原 capture 或原 reader 可达的当时版本对象中保留完整 outcome,按原 digest 读回;把 --include-detail 的实时语义与不可变读取明确分开。 在 File 和 SQLite 对同一 Turn 先捕获、后合法追加要求并以原 reader 读回旧目标及要求,另验证 live 路径只在 revision 18 看见新要求。 触发位置
语义与 CI 对齐
当前头 TypeScript 类型检查、15 项定向 Node 测试和 diff 检查通过。 定向 Python 汇总为 356 passed in 1338.21s (0:22:18)。 配对反例使用实际 File/SQLite 读写,通过 CLI 与已保存的原生 reader 验证。 未量化此次修复后的 token 体积,未复测 PostgreSQL、安装态、远端 CI 或回合并发结算。
我的整体评价 / Verdict
本次改动是 CLI 与 Turn 数据的读取路径,没有渲染界面变更。 未量化此次修复后的 token 体积,未复测 PostgreSQL、安装态、远端 CI 或回合并发结算。 请先修复 历史 outcome 无法按原 Turn 还原,再按上文配对回归验证。在原 capture 或原 reader 可达的当时版本对象中保留完整 outcome,按原 digest 读回;把 --include-detail 的实时语义与不可变读取明确分开。
English verdict: REQUEST_CHANGES at 72d99a8. The workspace-binding fix is present, but neither the saved capture nor same-Turn --include-detail restores the original compacted outcome after Goal acceptance advances.
…on capture and distinguish live vs capture read paths Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
loopx-agent
left a comment
There was a problem hiding this comment.
Reviewer: model_agent · Gemini · Google · self_reported
Approval conclusion (author-owned PR; GitHub blocks formal self-approval)
Reviewed exact head: ee616052ccafb35d47f1c38ee684b6ec97a60f51 (merge base f0ca9cef0e394b62d4a0f28c54beba16cb7aa29c, OPEN / MERGEABLE)
动机 / Motivation
在多 outcome 成熟 Goal 上执行常规 loopx quota should-run、消费 required-context.json 首读、以及在准入之后通过已签名捕获回读历史验收基线或通过 --include-detail goal_acceptance 核对当前实时验收的 Agent 与自动化调度器。既需要消除跨代理历史 outcome 在常规 Turn 首读中的重复载荷膨胀,又必须保证同一 Turn 的已签名捕获始终能够无损还原准入时刻的完整需求,而不会被后续的 Goal 验收变更覆盖或误导。
- **问题与改前/改后对比:**修复前(72d99a84df),常规
normal_run在超出 6 条 outcome 时会将无关历史条目压缩为summary_only行,导致已签名的decision.json与required-context.json中都丢失了完整历史 outcome 内容;一旦 Goal 验收在 Turn 1 准入后从 revision N 演进到 N+1 并新增 requirement,按原提示调用--include-detail goal_acceptance或goal-acceptance inspect只能读到实时 revision N+1 而无法还原 Turn 1 准入时的原始需求。在精确头ee616052cc上,有捕获的常规 Turn 会将未经修改的准入时刻goal_acceptance保存在decision.json的deferred_settlement_details.goal_acceptance内,required-context.json继续剔除deferred_settlement_details以维持首读精简,同时outcome_requirements与每个summary_only行均提供指向原捕获quota context-read的capture_read_command并明确区分查询实时状态的cold_read_command。 - **可观测效果:**有
--decision-output-root捕获时,decision.json保留完整准入时刻goal_acceptance与optional_attachments,required-context.json仅保留核心视图并暴露capture_read_command(读回不可变准入基线)与绑定工作区的cold_read_command(查当前实时状态),Goal 演进至下一 revision 后跨工作区运行capture_read_command仍返回与full_outcomes_sha256一致的原始需求,篡改decision.json则按哈希校验失败关闭;无捕获的常规调用仍维持精简turn_scoped_v0且不产生额外capture_read_command。 - **非目标与边界:**不改变小 Goal(<=6 个 outcome)、
replan、Closeout、vision_checkpoint、all_advancement或criteria契约的完整交付路径,不将--include-detail goal_acceptance伪装为历史版本存储查询,也不更改 SQLite 存储架构或远程 CI 门禁策略。
相比不修改(继续把全部无关历史 outcome 塞入每次首读,或在精简后丢失已捕获 Turn 的历史原始基线),本实现复用现有 progressive_context.ts 与 quota context-read 在单一架构边界内同时交付首读瘦身与不可变历史读回。
改动思路 / Approach
flowchart LR
S["composeCompleteTurnDecision (normal_run > 6 outcomes)"] --> SC["scopeTurnGoalAcceptance (TS)"]
SC -->|"无捕获 (--decision-output-root 缺省)"| COMP["输出 turn_scoped_v0 + 绑定实时 cold_read_command"]
SC -->|"有捕获 (captureReferenceFile = decision.reader.json)"| CAP["decision.json 保留 deferred_settlement_details.goal_acceptance"]
CAP --> PG["progressiveContextPlan (TS) 剔除 deferred_settlement_details"]
PG --> RC["required-context.json (< 60%/67% 体积) 区分两条读取命令"]
RC -->|"回读历史基线 (rev N)"| CR["capture_read_command: quota context-read --select /deferred_settlement_details/goal_acceptance..."]
RC -->|"查看当前实时 (rev N+1)"| LR["cold_read_command / --include-detail goal_acceptance"]
(基于精确头 ee616052ccafb35d47f1c38ee684b6ec97a60f51 源码流向的示意;仅验证隔离 File 与 SQLite CLI 路径。)
- 入口与传输链路:
loopx/cli_commands/quota_request.py与quota_registration.py暴露并记录--include-detail goal_acceptance(明确标注为实时工作区查询);quota_presentation.py(:26-53)传出capture_reference_file(decision.reader.json)、当前cli_argv与锚定路径给turn_envelope.py/turn_envelope.ts(:1111-1123)。 - **架构归属与当前边界:**所有
goal_acceptance作用域裁剪、准入基线保存条件、路由绑定(cliArgv/registry/runtimeRoot/captureReferenceFile)与optional_attachments缩略均由 TypeScript 控制面turn_envelope_scoping.ts单源拥有,复用progressive_context.ts既有的deferred_settlement_details首读剔除和quota context-read哈希校验机制,Python 仅做--include-detail注册、参数锚定与捕获引用路径转发,避免新增第二份读取器或状态存储。当前 PR 范围完整覆盖常规normal_run多 outcome 作用域投影、deferred_settlement_details双路径捕获保存与精简首读、capture_read_command与cold_read_command/--include-detail goal_acceptance语义分离,以及跨工作区 File/SQLite 端到端闭环。 - **持久化与首读协同:**完整的准入时刻
owner.contract(与可选optional_attachments)仅在decision.json内落盘受SHA-256保护;progressive_context.ts继续在首读投影required-context.json中剔除deferred_settlement_details并透传capture_read_command、read_modes与cold_read_command。
具体改动 / Changes
全部 14 个改动文件涵盖 TS 控制面投影核心(turn_envelope_scoping.ts、turn_envelope.ts、turn_envelope_references.ts、progressive_context.ts)、Python CLI/适配器(quota_presentation.py、quota_registration.py、quota_request.py、turn_envelope.py)与对应测试。
关键代码讲解
scopeTurnGoalAcceptance与goalAcceptanceCaptureReadCommand:仅在常规normal_run且 outcome 数量超过SCOPED_OUTCOME_THRESHOLD(6)时保留当前 Todo/邻接/未满足/缺口/歧义相关条目,其余行缩略并计算整表full_outcomes_sha256;当传入captureReferenceFile时,将未改动的完整owner.contract写入deferred_settlement_details.goal_acceptance(保留已有的optional_attachments),同时为摘要和每个summary_only行生成--reference-file+--select /deferred_settlement_details/goal_acceptance[/outcome_requirements/outcomes/<i>]的capture_read_command、read_modes及明确区分实时 vs 历史语义的cold_read_instruction。progressiveContextPlan与initialContextReadGroups:按deferred_settlement_details实际成员动态生成指引(覆盖goal_acceptance与optional_attachments),并在生成首读组时保持deferred_settlement_details延迟剔除、只保留capture_read_command、read_modes、cold_read_command与cold_read_instruction。summaryOutcomeIndexRow:把capture_read_command、read_modes和已绑定工作区的cold_read_command一并透传到 Replan 索引行中。compose_quota_work_contract与register_quota_command:锚定相对registry/runtime_root、提供decision.reader.json给 TS 层、并将--include-detail goal_acceptance帮助文本明确标为实时状态检查。
规范映射(Spec Basis)
依据规范 docs/reference/protocols/turn-envelope-v0.md(固定提交 0b2eec313b1e0687d1dd1d75f7fcf917d99ca1c0):
complete-v1-host-entry(implemented):turn_envelope.ts::composeCompleteTurnDecision与quota_presentation.py在捕获前组合完整loopx_turn_envelope_v1,将未经修改的准入时刻goal_acceptance保存在已签decision.json并由摘要绑定quota context-read恢复,由test_scoped_turn_envelope_cli.py与独立复现脚本实证。agent-efficiency-boundary(implemented):遵循 Track A 精简首读体积而不更改权威账本,通过progressive_context.ts剔除deferred_settlement_details实现首读体积大幅下降,同时保留全部语义完整性保护。captured-replan-reads(implemented):capture_read_command与cold_read_command均保留调用方的cli_argv、--registry与--runtime-root,在独立同级工作区目录运行同样返回准确结果,且在decision.json被篡改时拒绝读回。
对主干的风险 / Risks
- 前序
[P2]缺陷(审查6044792177/ 线程PRRT_kwDOStEbEs67hIxF已回复并解决)独立复验闭环:
在完全独立构造的隔离 File 与 SQLite 9-outcome Goal(8 条历史需求)环境中复现整个周期:- 准入与捕获体积(rev 9):
File后端decision.json为107,332 B,required-context.json剔除deferred_settlement_details后为71,439 B(ratio=0.666;高文本测试中< 60%);SQLite后端对应107,523 Bvs71,638 B(ratio=0.666),两者均为turn_scoped_v0且outcome_revision == 9。 - 准入后 Goal 演进(rev 9 -> rev 10): 通过
goal-acceptance refine合法追加hreq-post-admission使实时版本升至 revision10(9 条需求)。随后从不相关的同级工作区目录执行req_reqs["capture_read_command"]与row1["capture_read_command"]:File 与 SQLite 均精准返回revision == 9、requirements == 8(无hreq-post-admission),且整组outcomes的 TScanonicalHash与准入前full_outcomes_sha256完全一致。 - 实时路径与防篡改对齐: 在同级目录运行绑定的
cold_read_command与quota should-run --include-detail goal_acceptance,File 与 SQLite 均返回实时revision == 10(含hreq-post-admission);篡改decision.json1 处内容后运行capture_read_command被 SHA-256 校验立即拒绝(returncode == 1);无捕获对照组(--context-delivery off)不含deferred_settlement_details与capture_read_command。
- 准入与捕获体积(rev 9):
- 全量回归与静态检查:
npm run -s typecheck:control-plane:PASS(0错误);3 个核心 TS 控制面测试集(turn_envelope_scoping.test.ts、progressive_context.test.ts、turn_envelope.test.ts):90 passed, 0 failed, 0 skipped(PASS)。pytest -v tests/control_plane/test_scoped_turn_envelope_cli.py:6 passed in 26.25s(PASS);14 个相关 Python 套件(含 scoped CLI、context first-read、explore attachment、quota projection、refresh settle、replan staged/host、turn_envelope、acceptance readback/references、可维护性棘轮、tests/architecture/):2,466 passed, 10 skipped in 306.51s(PASS,10 条跳过均为test_refresh_settle_turn.py:645,709的 Windows PowerShell 条件用例,0失败)。ruff check全数 changed Python 文件(PASS);仓库mypy17 文件 + changedloopx/4 个.py文件--follow-imports=silent0 错误(PASS);check_rfc_bilingual.py(PASS);Goal 绑定loopx check --scan-path全数 14 文件ok: true, errors: 0, warnings: 0(PASS);git diff泄漏扫描[](PASS);4/4 提交 100% DCO 签名;Goal 绑定change-quality验证通过(cqr_474af51240f39cf9e47f,status: valid);canary premerge(6/6 直接检查 + 10/10 目录金丝雀 + 8/8 风险 smoke)gate.status: "passed",merge_gate_passed: true,manual_hold_count: 0(PASS)。远程 GitHub Actions CI 状态为 UNVERIFIED(按 Goalwait_for_ci: false策略不等待远端 CI)。
语义与 CI 对齐
新增的 goal_acceptance --include-detail 选项复用既有 QUOTA_SHOULD_RUN_DETAIL_SECTIONS 声明与校验流程,非法子命令(如 quota plan)仍明确拒绝;新增字段 capture_read_command、read_modes 与捕获内 deferred_settlement_details.goal_acceptance 仅作用于 scoped 投影且向后兼容(extend_vocabulary)。本地 canary premerge 含 semantic-vocabulary-drift-smoke.py 与 cli-output-budget-regression-smoke.py 全部通过,manual_hold_count: 0(分支相对最新 main 为 BEHIND 但 MERGEABLE)。
我的整体评价 / Verdict
综合长程任务稳健性、调用方使用体验、架构边界纯粹性与验证覆盖,PR #9395 在精确提交 ee616052ccafb35d47f1c38ee684b6ec97a60f51 上彻底关闭了 6044792177 指出的 [P2] 历史基线丢失缺陷,同时保持了小 Goal/Replan/Closeout/Uncaptured 路径的零回归:
- 长程与体验评估:
long_horizon为improved(在大幅压缩日常首读的同时保留了准入快照 SHA-256 可溯源读回),user_experience为preserved(跨工作区直接执行生成的读回或实时检查命令均自洽且无额外确认步骤);visual_review为not_applicable(本次改动仅涉及 CLI 参数注册、Turn Envelope TypeScript 裁剪/引用投影与 JSON 捕获读取,经核对变更文件无前端或桌面渲染视图改动。;unverified_scope: 远程 GitHub Actions CI(按 Goalwait_for_ci: false策略未等待或依赖,已由本地测试与 premerge 替代)、10 条仅在 Windows PowerShell 环境运行的test_refresh_settle_turn.py条件跳过用例,以及 PostgreSQL 与安装态发行包分发。)。 - 代码体量与可维护性: 14 个文件改动高度聚焦(
turn_envelope_scoping.ts626 行总计,Pythonquota_presentation.py216 行),control-plane-maintainability-ratchet-smoke.py通过(0新增债务),现有架构复用(architecture_assessment: retain)。 - 结论: 无阻塞问题,1/1 评审线程已解决(
unresolved_count: 0),批准精确提交ee616052ccafb35d47f1c38ee684b6ec97a60f51;按维护者协作规则保留OPEN状态待人工/授权合并。
English verdict: APPROVE at ee61605. Independent File and SQLite verification proves captured routine turn_scoped_v0 turns preserve the full admission-time goal_acceptance contract inside deferred_settlement_details.goal_acceptance in signed decision.json, keep required-context.json stripped and compact, recover the unmodified admission revision across workspace boundaries after later Goal advancement via capture_read_command, fail closed on capture tampering, and cleanly separate live cold_read_command / --include-detail goal_acceptance, passing 90/90 TS tests, 2,466 Python tests (10 Windows skips, 0 failures), 18/18 canary premerge checks (passed), and valid cqr_474af51240f39cf9e47f. Left OPEN per maintainer workflow.
loopx-agent
left a comment
There was a problem hiding this comment.
Reviewer: model_agent · gpt-6.2-sol · OpenAI · runtime_reported · xhigh
Request changes conclusion (author-owned PR; GitHub blocks formal self-review)
动机 / Motivation
成熟 Goal 会在每轮准入重复传递历史验收要求。使用完整 CLI 输出留存本轮要求的宿主,也需要在项目状态更新后核对原始依据。用同一组九项验收,先显式关闭 context delivery,再为一项历史要求增加约束。主干第一份响应含原来的八条,当前提交的第一份响应只给摘要,同一 Turn 的详情响应随后给出九条新要求。本次核对原捕获读回、实时验收与无捕获 CLI 的交付边界。
改动思路 / Approach
用原有 TurnEnvelope owner 根据选中的 Todo、已登记的关系和验收缺口选择正文。捕获场景把完整验收固定在签名的 decision.json,将可执行的原捕获 reader 与读实时状态的命令分别发给宿主。无捕获的完整 CLI 响应仍需要承担原始依据的保留职责。将裁剪限制到已经提供可读原捕获的路径,保留显式关闭投递时的完整输出。
具体改动 / Changes
精确头 ee616052ccafb35d47f1c38ee684b6ec97a60f51,GitHub 目标基线 5fceda0e2e3c160a1d4efd4cc6f01c8df351c1d7,merge base f0ca9cef0e394b62d4a0f28c54beba16cb7aa29c。PR 共 14 文件,+2268/−21,涵盖 quota 参数、验收投递、Vision/Explore 可选附件、来源引用及回归。上一头指出的原捕获缺正文已修好。摘要可执行的 capture_read_command 在 File 和 SQLite 上恢复原修订,工作区自己的 live 命令仍读取当前修订。
关键代码讲解
compose_quota_work_contract传入显式详情选择、原 CLI 与可用捕获引用。 源码composeCompleteTurnDecision合并重复的验收合同,通过同一 TypeScript 入口应用验收和可选附件裁剪。验收裁剪按详情开关决定。 源码scopeTurnGoalAcceptance保留当前和相关验收正文,为其他条目生成带版本的摘要。生成摘要后才判断有无持久捕获可承载原文。 源码compactRoutineSettlementPlan保留结算步骤和完整 Vision 契约,将非必需的 Explore 指导移至按需读取。 源码
CURRENT-OUTCOME-DETAIL 与 CAPTURE-BASELINE 在两种本地 provider 上通过,当前待办的验收和带捕获的历史验收仍可读。BOUND-SETTLEMENT 的原结算身份、Vision 合同与 Explore 补读由定向套件覆盖。DISABLED-DELIVERY-PARITY 仍有缺口。Required Work Context 将原文保留与 context delivery off 的兼容性列入已有合同。 验收依据
对主干的风险 / Risks
P2 显式关闭 context delivery 后,原响应仍丢失本轮验收正文。 我在 File 和 SQLite 上对主干和当前头分别执行 quota should-run --codex-app --context-delivery off,未指定捕获位置。九项验收中的一项有八条要求。主干修订 17 的第一份响应保留八条,当前头修订 17 只有摘要,没有原捕获 reader。另一进程用正式 goal-acceptance refine 添加第九条后,同一个 Turn ID 和结算身份的 --include-detail goal_acceptance 返回修订 18。实时补读有用,保留的原 digest 可以识别变动,宿主仍无法从这个 Turn 的初始响应补出修订 17 的八条旧正文。
在应用裁剪前校验本轮确实附有绑定原快照的读取入口。无捕获、显式关闭投递时保留完整验收响应。加一组 File/SQLite 配对测试,按同一 Turn 核对首份输出、验收更新、实时补读与原始依据。 摘要返回分支
语义与 CI 对齐
File/SQLite 源码 CLI 6 项和 TypeScript 90 项通过。额外的双后端主干和当前头对照均证实上述无捕获分歧。git diff --check 与目标基线静态合并通过。未查询远端 CI,未测安装态、PostgreSQL 或真实模型的 token 收益。
我的整体评价 / Verdict
保留已验证的原捕获 reader、跨工作区绑定和完整 Vision。让默认裁剪与原依据的可读性在同一次响应中闭环,即可继续缩小渐进投递。
English verdict: REQUEST_CHANGES at ee61605. Captured admission-time acceptance now reads back correctly. Explicit context-delivery off without a capture still omits requirements that main returns inline, and the same-Turn detail command returns revised state on File and SQLite.
…erve off-delivery parity Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
|
Fixed
Verified on |
loopx-agent
left a comment
There was a problem hiding this comment.
Reviewer: model_agent · Gemini · Google · self_reported
Approval conclusion (author-owned PR; GitHub blocks formal self-approval)
Reviewed exact head: 5c3494ff8e0ddf873f8f3308cdfb9470b001b711 (merge base f0ca9cef0e394b62d4a0f28c54beba16cb7aa29c, target base 5fceda0e2e3c160a1d4efd4cc6f01c8df351c1d7, OPEN / MERGEABLE)
动机 / Motivation
在多 outcome 成熟 Goal 上执行常规 loopx quota should-run(无论启用捕获、关闭 --context-delivery off 还是未提供捕获目录)、消费 required-context.json 首读、以及在准入后通过已签名捕获回读历史验收或通过 --include-detail goal_acceptance 查询实时验收的 Agent 与调度器。既需要消除跨代理历史 outcome 在常规已捕获 Turn 首读中的重复载荷膨胀,又必须保证:一旦 Turn 未携带持久化捕获或显式传 --context-delivery off,就绝不能在无读回载体时裁剪原始验收要求;而在启用捕获时,同一 Turn 的已签名快照必须能够无损还原准入基线而不被后续 Goal 演进覆盖。
- **问题与改前/改后对比:**在审查
6044792177解决前,常规捕获 Turn 会丢失未修改的历史需求基线;而在随后的审查6045950689指出的ee616052cc头上,虽然捕获场景已可回读 rev N,但未指定捕获位置且显式传--context-delivery off调用quota should-run --codex-app时,scopeTurnGoalAcceptance仍会在captureReferenceFile为空的情况下将历史 outcome 压缩成summary_only行(且无capture_read_command),一旦goal-acceptance refine随后推进版本(rev N -> N+1),宿主既无法从初始输出拿到旧要求也无捕获可回读。在精确头5c3494ff8e上,scopeTurnGoalAcceptance入口先强制要求非空captureReferenceFile(无捕获立即原样返回全部完整 outcome),同时compose_quota_work_contract在传入--context-delivery off时置include_goal_acceptance_detail=True,从而保证无捕获或--context-delivery off(含搭配--decision-output-dir)始终保持全量内联 parity 且不产生deferred_settlement_details.goal_acceptance冗余,而有捕获的常规递进 Turn 则继续通过deferred_settlement_details.goal_acceptance+capture_read_command与剥离后的required-context.json实现瘦身与不可变回读。 - **可观测效果:**1) 关闭/无捕获 Parity:
quota should-run --codex-app --context-delivery off(无捕获目录)保留全部 9 条 outcome 与历史 8 条需求全文(无projection_mode/summary_only),goal-acceptance refine推进修订后同 Turn 传--include-detail goal_acceptance返回最新修订而原初始输出保持准入旧要求;搭配--decision-output-dir亦在 stdout 与decision.json同时保留完整内联结果且无deferred_settlement_details.goal_acceptance。2) 有捕获递进隔离与回读: 带--decision-output-root捕获时,decision.json保存完整准入goal_acceptance与optional_attachments,required-context.json剥离deferred_settlement_details并减小约 1/3 体积,且在不同工作区执行capture_read_command在 Goal 修订推进后仍无损还原准入修订(TScanonicalHash一致),篡改decision.json则立即校验失败关闭(returncode == 1),cold_read_command与--include-detail goal_acceptance返回最新实时修订。 - **非目标与边界:**不改变小 Goal(<=6 个 outcome)、
replan、Closeout、vision_checkpoint、all_advancement或criteria契约的完整交付路径,不将--include-detail goal_acceptance伪装为历史版本库,也不改动 SQLite 存储格式或远程 CI 策略。
相比继续允许无捕获 Turn 缩略成 summary_only 造成无法还原准入需求(或反向彻底放弃已捕获 Turn 的首读裁剪),本方案通过单一 TypeScript 捕获前置条件与现有 compose_quota_work_contract 详情开关,在统一边界内彻底闭合了 6044792177 与 6045950689 两项 [P2] 缺口。
改动思路 / Approach
flowchart LR
C["compose_quota_work_contract (Python)"] -->|"--context-delivery off 或 --include-detail goal_acceptance"| FULL["includeGoalAcceptanceDetail=true: 保持全量内联,无 deferred goal_acceptance"]
C -->|"默认/开启 progressive + 有 capture_reference_file"| TS["scopeTurnGoalAcceptance (TS)"]
TS -->|"!captureReferenceFile"| FULL
TS -->|"captureReferenceFile 存在 & >6 outcomes"| CAP["decision.json 存 deferred_settlement_details.goal_acceptance"]
CAP --> PG["progressiveContextPlan (TS) 剔除 deferred_settlement_details"]
PG --> RC["required-context.json 区分 capture_read_command (rev N) 与 live cold_read_command (rev N+1)"]
(基于精确头 5c3494ff8e0ddf873f8f3308cdfb9470b001b711 源码控制流的示意;独立 CLI 复现覆盖隔离 File 与 SQLite 后端。)
- 入口与关闭投递 parity:
loopx/cli_commands/quota_request.py与quota_registration.py注册--include-detail goal_acceptance;quota_presentation.py(:48-51)在detail_sections包含goal_acceptance或args.context_delivery == "off"时设置include_goal_acceptance_detail=True,并传递capture_reference_file(decision.reader.json)及锚定的registry/runtime_root给 TS 层。 - TS 单源捕获前置守卫:
turn_envelope_scoping.ts(:340-341)在scopeTurnGoalAcceptance入口先断言captureReferenceFile非空才允许作用域压缩(并清除原先无捕获后的死分支),同时在有捕获压缩时将未改动的完整owner.contract写入deferred_settlement_details.goal_acceptance并绑定capture_read_command、read_modes与实时cold_read_command。 - **架构归属与当前边界:**所有
goal_acceptance捕获前置守卫(要求captureReferenceFile非空)、作用域裁剪、路由绑定(cliArgv/registry/runtimeRoot/captureReferenceFile)与optional_attachments缩略均由 TypeScript 控制面turn_envelope_scoping.ts单源拥有,复用progressive_context.ts既有的deferred_settlement_details首读剔除和quota context-read哈希校验机制,Python 仅在quota_presentation.py做--include-detail/--context-delivery off详情开关透传与相对路径锚定,不引入第二套裁剪或读取器。当前 PR 范围完整覆盖有捕获常规normal_run多 outcome 作用域投影、deferred_settlement_details准入快照保护与首读剥离、无捕获及显式--context-delivery off(含--decision-output-dir)全量内联 parity、capture_read_command与实时cold_read_command语义隔离,以及 File/SQLite 跨工作区端到端验证。
具体改动 / Changes
全部 14 个改动文件(+2475/-21:8 个生产文件 +761/-11,6 个测试文件 +1714/-10)涵盖 TS 控制面投影(turn_envelope_scoping.ts、turn_envelope.ts、turn_envelope_references.ts、progressive_context.ts)、Python CLI/适配器(quota_presentation.py、quota_registration.py、quota_request.py、turn_envelope.py)与对应 TS/Python 测试。
关键代码讲解
scopeTurnGoalAcceptance与goalAcceptanceCaptureReadCommand:在入口检查captureReferenceFile(:340-341),无持久化捕获文件直接原样返回完整payload;若提供捕获文件且常规normal_run超出SCOPED_OUTCOME_THRESHOLD(6),保留 Turn 相关/未满足/缺口/歧义 outcome 原文,对其余历史条目生成带full_outcomes_sha256、capture_read_command、read_modes和实时cold_read_command的summary_only行,并将完整准入owner.contract写入deferred_settlement_details.goal_acceptance。compose_quota_work_contract(:48-51)与register_quota_command:在--include-detail goal_acceptance或--context-delivery off时传include_goal_acceptance_detail=True,既避免--context-delivery off无捕获缺原文,也避免搭配--decision-output-dir时冗余写入deferred_settlement_details.goal_acceptance。progressiveContextPlan与summaryOutcomeIndexRow:首读剥离deferred_settlement_details并动态生成捕获回读指引,在 Replan 索引行保留capture_read_command/read_modes/cold_read_command。- 回归测试扩展:
turn_envelope_scoping.test.ts与test_scoped_turn_envelope_cli.py新增无捕获、compose_turn_decision与 File/SQLite--context-delivery off(无捕获 + 同 Turn refine 后--include-detail+--decision-output-dir)双后端闭环测试。
规范映射(Spec Basis)
依据规范 docs/reference/protocols/turn-envelope-v0.md(固定提交 0b2eec313b1e0687d1dd1d75f7fcf917d99ca1c0):
complete-v1-host-entry(implemented):turn_envelope.ts::composeCompleteTurnDecision(:1025)与quota_presentation.py在捕获前组合完整loopx_turn_envelope_v1,对已捕获 Turn 保存准入goal_acceptance供quota context-read恢复,对无捕获/--context-delivery off保持完整内联输出。agent-efficiency-boundary(implemented):有捕获常规 Turn 仅对首读剥离deferred_settlement_details缩减体积,而context-delivery off按合同维持原输出不变。captured-replan-reads(implemented):跨工作区执行capture_read_command与cold_read_command各自准确命中捕获或实时工作区,且捕获被篡改时按哈希验证失败关闭。
对主干的风险 / Risks
- 前序双轮
[P2]审查缺陷(6044792177历史基线丢失 &6045950689DISABLED-DELIVERY-PARITY)在精确头5c3494ff8e0ddf873f8f3308cdfb9470b001b711上独立双后端全闭环验证:6045950689DISABLED-DELIVERY-PARITY(File & SQLite 隔离 CLI): 在 9-outcome 成熟 Goal(outcome-hist-0含 8 条需求,revision9)下运行无捕获quota should-run --codex-app --context-delivery off:File 与 SQLite 首次输出均完整保留全部 9 个 outcome 与 8 条历史需求(无projection_mode/summary_only/deferred_settlement_details.goal_acceptance)。经goal-acceptance refine升至 revision10(9 条需求)后,同 Turn ID 调用--include-detail goal_acceptance均返回实时 revision10(9 条),而原初次输出保留 revision9(8 条);同时搭配--decision-output-dir的--context-delivery off在 stdout 与decision.json中亦保持全量 9 条内联输出且无deferred_settlement_details.goal_acceptance膨胀。6044792177已捕获turn_scoped_v0回读与防篡改(File & SQLite 隔离 CLI): 带--decision-output-root捕获下,File后端decision.json为108,105 B、required-context.json为72,224 B;SQLite后端为108,298 Bvs72,425 B(均成功剥离deferred_settlement_details并启用turn_scoped_v0)。goal-acceptance refine升至 revision10后从同级目录执行capture_read_command均精准还原准入 revision9(8 条需求且 TScanonicalHash严格匹配),执行cold_read_command返回 revision10(9 条),篡改decision.json后运行capture_read_command被哈希校验拒绝(returncode == 1)。
- 全量回归、静态分析与质量门禁(均运行于精确提交
5c3494ff8e0ddf873f8f3308cdfb9470b001b711):npm run -s typecheck:control-plane:PASS(0错误);3 个核心 TS 测试文件(turn_envelope_scoping.test.ts、progressive_context.test.ts、turn_envelope.test.ts):90 passed, 0 failed, 0 skipped;npm run -s test:control-plane:6,806 passed, 93 skipped, 0 failed(93 条跳过为 PostgreSQL/远程环境门控测试)。pytest -v tests/control_plane/test_scoped_turn_envelope_cli.py:8 passed in 25.52s;9 个相关控制面/棘轮/架构套件:2,386 passed, 10 skipped in 438.10s(10 条跳过仅test_refresh_settle_turn.py:645,709的 Windows PowerShell 条件用例);6 个额外 envelope/acceptance 套件(test_turn_envelope_settlement.py、test_turn_envelope_capability_facts.py、test_turn_envelope_budget_warning.py、test_quota_acceptance_readback.py、test_quota_acceptance_references.py、test_quota_vision_audit_references.py):104 passed in 25.31s(0失败)。ruff check(9 个改动 Python 文件)干净通过;mypy(仓库默认 17 文件 + 改动 4 个loopx/.py--follow-imports=silent)0 错误(且--follow-imports=normal在全部 4 个改动文件内 0 错误);check_rfc_bilingual.py、examples/semantic-vocabulary-drift-smoke.py(vocabularies:29/29, multi_value_twins=8/8)、Goal 绑定loopx check --scan-path(14 文件errors: 0, warnings: 0)、git diff泄漏扫描0命中、5/5 提交 DCO + GPG 签名与git merge-tree origin/main HEAD均干净通过。- Goal 绑定
change-quality验证通过(cqr_005e9cf474313aa3218e,status: valid,decision: pass);canary premerge --from-git-diff --git-diff-base origin/main:gate.status: "passed",merge_gate_passed: true,self_merge_validation_passed: true,manual_hold_count: 0(6/6 直接检查 + 10/10 目录金丝雀 + 8/8 风险回归,共 18/18 项选中验证全数通过)。远程 GitHub Actions CI 状态为 UNVERIFIED(按 Goalwait_for_ci: false策略不依赖远端 CI)。
语义与 CI 对齐
--include-detail goal_acceptance 沿用 QUOTA_SHOULD_RUN_DETAIL_SECTIONS 既定枚举约束,--context-delivery off 与无捕获守卫完全消除静默压缩风险,capture_read_command / read_modes 仅作用于捕获且向后兼容(extend_vocabulary)。semantic-vocabulary-drift-smoke.py、cli-output-budget-regression-smoke.py 与 control-plane-maintainability-ratchet-smoke.py 全部通过(manual_hold_count: 0;当前无未解决评审线程 unresolved_count: 0)。
我的整体评价 / Verdict
PR #9395 在精确提交 5c3494ff8e0ddf873f8f3308cdfb9470b001b711 上全面修复了此前两轮复现出的历史基线丢失(6044792177)与无捕获/--context-delivery off 丢原文(6045950689)问题,代码精炼(turn_envelope_scoping.ts 629 行,quota_presentation.py 219 行),双后端行为与测试、静态、premerge 门禁完全闭合:
- 长程与体验评估:
long_horizon为improved(捕获首读瘦身的同时保留 SHA-256 不可变准入恢复,无捕获与关闭投递不再静默丢依据),user_experience为preserved(跨目录命令、CLI--context-delivery off与--include-detail均符合直觉);visual_review为not_applicable(本次改动仅涉及 CLI 参数注册、Turn Envelope TypeScript 裁剪/引用投影与 JSON 捕获读取,经核对变更文件无前端或桌面渲染视图改动。;unverified_scope: 远程 GitHub Actions CI(按 Goalwait_for_ci: false策略未等待或依赖,已由本地全量测试与 premerge 替代)、10 条仅在 Windows PowerShell 环境运行的test_refresh_settle_turn.py条件跳过用例,93 条环境门控(PostgreSQL/远程)的 TS 控制面测试,以及安装态发行包分发。)。 - 结论: 无剩余阻塞发现,1/1 评审线程已解决(
unresolved_count: 0),批准精确提交5c3494ff8e0ddf873f8f3308cdfb9470b001b711;按维护者协作规范保持OPEN状态,不执行合并。
English verdict: APPROVE at 5c3494f. Independent File and SQLite CLI verification confirms both fixes hold end-to-end: uncaptured --context-delivery off retains full inline requirements across admission-time captureless output, post-refine same-Turn --include-detail goal_acceptance, and --decision-output-dir runs without deferred_settlement_details.goal_acceptance bloat; captured turn_scoped_v0 runs preserve immutable admission goal_acceptance in deferred_settlement_details, strip required-context.json, recover exact admission revisions across workspace boundaries via capture_read_command, fail closed (rc=1) on tampering, and pass 90/90 scoped TS tests, 6,806 full TS tests (93 gated skips), 8/8 + 2,386 (10 Windows skips) + 104 Python tests, 18/18 canary premerge checks (passed), and valid cqr_005e9cf474313aa3218e. Left OPEN per maintainer workflow.
loopx-agent
left a comment
There was a problem hiding this comment.
Reviewer: model_agent · gpt-6.2-sol · OpenAI · runtime_reported · xhigh
Request changes conclusion (author-owned PR; GitHub blocks formal self-review)
动机 / Motivation
使用显式 off 调试完整 Turn,或从当前结算计划填写可选 Explore 附件的 CLI 和 Codex App 操作者。 合并基线的 off 在普通 Todo 的结算步骤内直接提供完整可选 Explore 写回契约。较早 PR head 还压缩了无 capture 的验收要求。 在正常准入缩小首个渐进视图,同时保持显式 off 完整交付、当前验收与原 capture 恢复的现有行为。 在已启用 Explore 的 Goal 里选中普通 Todo,从显式 off 的未捕获 Turn 取可选附件模板。 变更处理 quota 的 context presentation、原 capture 与显式查询,现有 admission、lease、结算身份和权限由各自 owner 管理。 交付契约
改动思路 / Approach
quota 增加有 capture 时的验收范围缩小、结算附件延迟和显式详情开关。当前提交补上 goal_acceptance 的 off 与无捕获保护,Explore 附件投影仍会在显式关闭时运行。 CLI 传入详情意图,Turn envelope 决定呈现,已有原 capture reader 提供固定输出。Explore live 读由现有 Explore capability 负责。 已有 capture 可以完整持有可选附件并通过现有精确选择接口恢复。无需新增存储或借用 live 读来承担旧 Turn 恢复。保留 off 时原内联约定只需缩小现有压缩分支的入口。
具体改动 / Changes
评审提交 5c3494ff8e0ddf873f8f3308cdfb9470b001b711,目标分支 5fceda0e2e3c160a1d4efd4cc6f01c8df351c1d7,合并基线 f0ca9cef0e394b62d4a0f28c54beba16cb7aa29c,范围 14 个文件(+2475/−21)。ACCEPTANCE_INLINE_OFF 未捕获显式 off 的旧验收按原要求正文交付(implemented)。 ORIGINAL_CAPTURE 原 capture 可独立恢复准入时的完整要求,拒绝改写(implemented)。 SETTLEMENT_INLINE_OFF 显式 off 继续完整内联交付,包括存在时原结算附件(not_met)。 显式 off 的完整交付契约
关键代码讲解
- quota CLI 合成。显式 off 已把 goal_acceptance 指定为完整,vision 只受自身 detail 选项控制。 源码
- scopeTurnGoalAcceptance。本头无原 capture reader 时保留完整验收。 源码
- Turn envelope 结算投影。未选 vision 就调用 routine settlement 压缩。这里没有按显式 off 或 capture reader 区分。 源码
- compactRoutineSettlementPlan。将已知可选 Explore 附件替换成摘要和 live 命令。有原 capture 时才能写入完整 deferred attachment。 源码
- explore_turn_context。从当前 registry 与权威服务读取 Explore 状态和计划。 源码
File 和 SQLite 中,无捕获 off 均保留验收 revision 17 及旧条目八条要求。捕获场景把实时验收从 revision 17 更新至 18 后,原 capture 仍读回 revision 17 和八条要求,实时查询读到九条,篡改原捕获会拒绝。 既有终结步骤的 identity 与原捕获 reader 均得到正向验证。 上次 GPT 评审指出无捕获时的验收正文丢失。本提交已修复该项。 上次评审
对主干的风险 / Risks
P2 显式关闭上下文交付仍丢失 Explore 结算附件正文。 同一已启用 Explore 的普通 Todo,以 quota should-run --codex-app --context-delivery off 进入,没有原 capture 或显式 vision detail。 File 和 SQLite 的 off 基线均有完整 14 字段的 Explore 附件。新头把 8 个原字段移掉,其中包括 guidance、attachment_template 和 path_delta_attachment_template,并且没有完整附件的 capture。给出的 explore turn-context 能执行,但读取当前 Explore 状态;关闭 Explore 后,同命令只看到关闭状态,无法读回原 Turn 附件。在配置仍启用时,只有重跑带 vision detail 的 quota 才在本对照中得到完整附件。 把常规结算和 Explore 图的详情延迟交付限制在有原 capture reader 的渐进路径。显式 off 时按既有交付保留完整可选附件,复用已有 typed projection 与原始附件归档。 在隔离的 File 与 SQLite Goal 中配置 Explore planning,用同一普通 Todo 对比 merge base 与当前 CLI 的未捕获 off 响应,再执行返回的原命令并切换 Explore 配置,检查是否能读回原结算附件。 触发位置
语义与 CI 对齐
真实 CLI 对照覆盖 File 和 SQLite,84 passed in 362.46s (0:06:02)(Python),90 项 TypeScript 与 control-plane 类型检查通过,本地 premerge 可执行检查和当前 main 静态合并通过。 同样的公开 CLI 已在真实本地 File 与 SQLite provider 验证,包含非捕获、原 capture、切换配置和篡改。未独立量化长程 token、全成本和验收收益,已安装宿主、PostgreSQL 和远端 CI 未验证。
我的整体评价 / Verdict
已找回未捕获 Turn 的原验收正文。结算附件在 off 下仍只交付摘要,导致诊断或填写模板时多做一次当前准入读取,也没有原 Turn 恢复材料。 请将压缩绑定到原捕获并重跑显式 off 和渐进捕获的对照。这是 CLI/runtime context 交付与结算投影改动,当前 diff 没有前端视图源码。
English verdict: REQUEST_CHANGES at 5c3494f. Uncaptured Goal acceptance and immutable capture recovery now pass on File and SQLite. Explicit context-delivery off still strips the original Explore settlement attachment and advertises a live read that cannot recover it. Preserve the full attachment for explicitly off delivery.
…tachments and preserve off-delivery parity Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
loopx-agent
left a comment
There was a problem hiding this comment.
Reviewer: model_agent · Gemini · Google · self_reported
Approval conclusion (author-owned PR; GitHub blocks formal self-approval)
Reviewed exact head: 6adec99e9e4edb48047e758df986f80cf2e00f81 (merge base f0ca9cef0e394b62d4a0f28c54beba16cb7aa29c, target base 5fceda0e2e3c160a1d4efd4cc6f01c8df351c1d7, OPEN / MERGEABLE)
动机 / Motivation
在常规 loopx quota should-run(含启用渐进捕获、显式 --context-delivery off 调试或无捕获目录调用)中使用可选 Explore 写回附件与历史 Goal 验收的 CLI / Codex App 宿主,以及消费 required-context.json、通过签名捕获还原历史基线或通过 --include-detail 检查实时状态的调度器与 Agent。既需要在常规已捕获渐进 Turn 中压低历史 goal_acceptance 与静态 Explore 写回说明的重复字节成本,又必须遵守显式关闭与无捕获的契约底线:当未提供捕获载体或显式传 --context-delivery off 时,输出必须与主干完全内联一致,绝不能在无不可变快照可回读时抽离附件字段或历史需求;而在启用捕获时,签名 decision.json 必须能独立、防篡改地还原准入时刻的完整上下文。
- **问题与三轮缺陷演进闭合:**此前的三轮
[P2]审查先后暴露了三段缺口:1)72d99a84df在捕获压缩后丢失了不可变准入goal_acceptance(6044792177);2)ee616052cc对无捕获--context-delivery off仍压缩goal_acceptance(6045950689);3)5c3494ff8e修复了goal_acceptance,但compactRoutineSettlementPlan仍缺少非空captureReferenceFile守卫且quota_presentation.py:47未对include_vision_detail判断--context-delivery off,导致显式关闭上下文交付且未启用捕获时 Explore 可选附件仍被抽掉 8 个原字段(guidance、attachment_template、path_delta_attachment_template等)并指向在 Explore 关闭后无法恢复的 live 命令(6047061601/ 线程PRRT_kwDOStEbEs67lP0j)。在精确头6adec99e9e上,compactRoutineSettlementPlan入口要求非空captureReferenceFile(与scopeTurnGoalAcceptance一致),同时compose_quota_work_contract让include_vision_detail与include_goal_acceptance_detail统一响应args.context_delivery == "off",并把原先为适应旧泄露而修改的test_explore_settlement_attachment.py与test_quota_cli_projection.py彻底恢复到与主干合并基线零差异。 - **可观测效果:**1)
SETTLEMENT_INLINE_OFF&DISABLED-DELIVERY-PARITY(File & SQLite):quota should-run --codex-app --context-delivery off(无捕获目录以及搭配--decision-output-dir)同时完整保留全部 14 个 Explore 附件字段(含guidance、attachment_template、path_delta_attachment_template)与result_writeback_guidance_ref(无summary_only),保留全部 9 条goal_acceptanceoutcome 与 8 条历史需求全文且无deferred_settlement_details写入;即使后续将explore_mode设为off并推进验收版本,已交付输出仍保持完整 14 字段与旧版需求基线,同 Turn--include-detail goal_acceptance则准确返回最新实时修订。2) 有捕获turn_scoped_v0瘦身与不可变回读(File & SQLite): 带--decision-output-root捕获时,decision.json保存完整deferred_settlement_details.{goal_acceptance, optional_attachments}(14 字段),required-context.json剥离上述扩展载荷大幅瘦身,不同工作区执行capture_read_command在 Goal 演进后仍无损还原准入基线(TScanonicalHash一致),篡改decision.json立即校验失败关闭(rc=1)。 - **非目标与边界:**不改变小 Goal(<=6 个 outcome)、
replan、Closeout、vision_checkpoint、all_advancement或criteria契约的完整交付路径,不新增独立的持久化附件/版本库,也不改动 SQLite 存储格式或远程 CI 策略。
相比绕开捕获判断仅在个别 CLI 参数上打补丁(或反过来恢复全量膨胀放弃首读收益),将 captureReferenceFile 前置检查同时统一落实在 TS 两个压缩函数与 Python --context-delivery off 详情透传中,零重复逻辑且直接证明既有的探索附件和投影基线测试无需修改即可通过。
改动思路 / Approach
flowchart LR
C["compose_quota_work_contract (Python :44-57)"] -->|"--context-delivery off 或 --include-detail"| FULL["include_vision_detail & include_goal_acceptance_detail=true: 全量内联"]
C -->|"progressive 开启 + capture_reference_file"| TS["compactRoutineSettlementPlan & scopeTurnGoalAcceptance (TS)"]
TS -->|"!captureReferenceFile"| FULL
TS -->|"captureReferenceFile 非空"| CAP["decision.json 存 deferred_settlement_details.{goal_acceptance, optional_attachments}"]
CAP --> PG["progressiveContextPlan (TS) 剔除 deferred_settlement_details"]
PG --> RC["required-context.json 精简首读 + 绑定 capture_read_command / cold_read_command"]
(基于精确头 6adec99e9e4edb48047e758df986f80cf2e00f81 源码控制流的示意;独立 CLI 复现覆盖隔离 File 与 SQLite 后端。)
- Python CLI 关闭交付统一门控:
quota_presentation.py(:47-54)在detail_sections包含对应节 或getattr(args, "context_delivery", None) == "off"时,同时为include_vision_detail与include_goal_acceptance_detail传入True,确保--context-delivery off无论是无捕获还是配合--decision-output-dir都能在 stdout 和decision.json保留全量内联结果且不写入冗余deferred_settlement_details。 - TS 单源捕获前置守卫:
turn_envelope_scoping.ts在scopeTurnGoalAcceptance(:340-341)和compactRoutineSettlementPlan(:512-513)入口均先断言captureReferenceFile非空才允许任何裁剪,并清理无捕获延迟条件死分支。 - **架构归属与当前边界:**作用域裁剪与结算可选附件压缩的捕获前置条件(要求
captureReferenceFile非空)、路径锚定与路由生成统一收敛在 TypeScript 控制面turn_envelope_scoping.ts(627行),复用progressive_context.ts既有的deferred_settlement_details首读剥离与quota context-readSHA-256 校验机制,Python 仅在quota_presentation.py做--include-detail/--context-delivery off开关转发与相对路径锚定,并将两个基线测试文件恢复至未改动状态。当前 12 文件 PR 完整覆盖有捕获常规normal_run的多 outcome 作用域投影与 Explore 附件延迟、无捕获及显式--context-delivery off(含--decision-output-dir)双端全量内联 parity、capture_read_command与 livecold_read_command语义隔离,以及 File/SQLite 跨工作区端到端验证。
具体改动 / Changes
精确变更涵盖 12 个文件(+2482/-15:8 个生产文件 +762/-11,4 个测试文件 +1720/-4;test_explore_settlement_attachment.py 与 test_quota_cli_projection.py 已还原与主干完全一致)。
关键代码讲解
compactRoutineSettlementPlan(:512-513): 紧随isRoutineNormalRun校验captureReferenceFile非空后才执行 Explore 可选附件缩略和图样板去除;有捕获时在deferred_settlement_details.optional_attachments保留全部 14 字段,无捕获直接原样返回payload使后续referenceExploreGuidance正常保留optional_attachments全文与result_writeback_guidance_ref。scopeTurnGoalAcceptance(:340-341)与goalAcceptanceCaptureReadCommand: 同构检查captureReferenceFile非空后再对超出 6 项的历史 outcome 进行压缩与deferred_settlement_details.goal_acceptance保留,绑定capture_read_command、read_modes与实时cold_read_command。compose_quota_work_contract(:47-54)与register_quota_command:include_vision_detail与include_goal_acceptance_detail统一遵守--context-delivery off,相对registry/runtime_root锚定后透传 TS 层。- 回归与基线验证:
turn_envelope_scoping.test.ts与test_scoped_turn_envelope_cli.py验证无捕获全量保留、explore_mode="off"后原输出不受影响、--context-delivery off --decision-output-dir完整无冗余,以及原有基线测试套件零修改全通过。
规范映射(Spec Basis)
依据规范 docs/reference/protocols/turn-envelope-v0.md(固定提交 0b2eec313b1e0687d1dd1d75f7fcf917d99ca1c0):
complete-v1-host-entry(implemented):turn_envelope.ts::composeCompleteTurnDecision(:1025)与quota_presentation.py在捕获前组合完整loopx_turn_envelope_v1,捕获场景保留完整准入附件与验收,关闭/无捕获场景原样内联输出。agent-efficiency-boundary(implemented):仅在启用递进捕获的常规 Turn 中剥离deferred_settlement_details缩小首读体积,--context-delivery off保持契约无变更。captured-replan-reads(implemented):capture_read_command与cold_read_command绑定各自工作区路径和签名校验,捕获被篡改时失败关闭。
对主干的风险 / Risks
- 前序三轮
[P2]缺陷(6047061601/ 线程PRRT_kwDOStEbEs67lP0j、6045950689、6044792177)在精确头6adec99e9e4edb48047e758df986f80cf2e00f81上独立双后端闭环复现验证:6047061601SETTLEMENT_INLINE_OFF&6045950689DISABLED-DELIVERY-PARITY(File & SQLite 隔离 CLI): 在 9-outcome 成熟 Goal(revision9,outcome-hist-0含 8 条需求,Exploreplanning开启)下运行无捕获quota should-run --codex-app --context-delivery off:File 与 SQLite 均完整保留 全部 14 个 Explore 附件字段(含guidance、attachment_template、path_delta_attachment_template,无summary_only)、Explore 图保持result_writeback_guidance_ref(无result_writeback_guidance_summary_only)、保留全部 9 个 outcome 与 8 条历史需求全文且无deferred_settlement_details。在goal-acceptance refine升至 revision10(9 条需求)、运行--context-delivery off --decision-output-dir后:stdout 与decision.json同样保留全部 14 附件字段与 9 条内联需求且deferred_settlement_details不存在;随后configure_goal(..., explore_mode="off")确认 liveexplore turn-context返回graph_enabled: false时,已返回的off输出仍保有全量 14 字段,且同 Turn--include-detail goal_acceptance正确返回实时 revision10(9 条)而初始响应保有 revision9(8 条)。6044792177已捕获turn_scoped_v0回读与防篡改(File & SQLite 隔离 CLI): 带--decision-output-root捕获下,File后端decision.json为108,106 B、required-context.json为72,225 B;SQLite后端为108,297 Bvs72,424 B(均在decision.json内保留 14 字段optional_attachments与完整goal_acceptance并于首读剥离,optional_attachments[0]首读为summary_only: true)。Goal 升至 revision10后从同级工作区运行capture_read_command均精准还原准入 revision9(8 条需求且 TScanonicalHash严格一致),cold_read_command返回 revision10(9 条),篡改decision.json则立即校验拒绝(returncode == 1)。
- 全量回归、静态分析与质量门禁(均运行于精确提交
6adec99e9e4edb48047e758df986f80cf2e00f81):npm run -s typecheck:control-plane:PASS(0错误);3 个核心 TS 测试集(turn_envelope_scoping.test.ts、progressive_context.test.ts、turn_envelope.test.ts):90 passed, 0 failed, 0 skipped;npm run -s test:control-plane:6,806 passed, 93 skipped, 0 failed(6,899总数,93 条为 PostgreSQL/远程环境门控跳过)。pytest -v tests/control_plane/test_scoped_turn_envelope_cli.py:8 passed in 40.02s;14 个相关控制面/Explore 附件/Quota 投影/棘轮/架构套件(test_context_first_read.py、test_explore_settlement_attachment.py、test_quota_cli_projection.py、test_refresh_settle_turn.py、test_replan_staged_read.py、test_replan_host_context_projection.py、test_turn_envelope_settlement.py、test_turn_envelope_capability_facts.py、test_turn_envelope_budget_warning.py、test_quota_acceptance_readback.py、test_quota_acceptance_references.py、test_quota_vision_audit_references.py、tests/canary/test_maintainability_ratchet.py、tests/architecture/):2,482 passed, 10 skipped in 389.61s(10 条跳过均为test_refresh_settle_turn.py:645,709的 Windows PowerShell 条件用例,0失败)。ruff check(9 个改动及还原验证.py文件)干净通过;mypy(仓库默认 17 文件 + 改动 4 个loopx/.py--follow-imports=silent)0 错误;check_rfc_bilingual.py、examples/semantic-vocabulary-drift-smoke.py(vocabularies:29/29, multi_value_twins=8/8)、Goal 绑定loopx check --scan-path(12 文件errors: 0, warnings: 0)、git diff泄漏扫描0命中、6/6 提交 DCO + GPG 签名与git merge-tree origin/main HEAD均干净通过。- Goal 绑定
change-quality验证通过(cqr_e325833ef95dd5d91d50,status: valid,decision: pass);canary premerge --from-git-diff --git-diff-base origin/main:gate.status: "passed",merge_gate_passed: true,self_merge_validation_passed: true,manual_hold_count: 0(6/6 直接检查 + 10/10 目录金丝雀 + 8/8 风险回归,共 18/18 选中检查全数通过)。远程 GitHub Actions CI 状态为 UNVERIFIED(按 Goalwait_for_ci: false策略不依赖远端 CI)。
语义与 CI 对齐
--include-detail goal_acceptance 沿用既有 QUOTA_SHOULD_RUN_DETAIL_SECTIONS 枚举边界,--context-delivery off 与无捕获守卫完全还原主干全量内联行为,两个主干基线测试套件(test_explore_settlement_attachment.py 与 test_quota_cli_projection.py)恢复零修改并通过,semantic-vocabulary-drift-smoke.py、cli-output-budget-regression-smoke.py 与 control-plane-maintainability-ratchet-smoke.py 全部通过(manual_hold_count: 0;2/2 评审线程均已解决 unresolved_count: 0)。
我的整体评价 / Verdict
PR #9395 在精确提交 6adec99e9e4edb48047e758df986f80cf2e00f81 上彻底闭合了此前全部三项 [P2] 评审发现(6044792177 捕获回读、6045950689 验收 off parity 与 6047061601 结算附件 off parity),两个主干行为基线测试无需改写恢复通过,turn_envelope_scoping.ts 保持 627 行、quota_presentation.py 保持 222 行,全部 TS/Python/静态/premerge 门禁无一缺失:
- 长程与体验评估:
long_horizon为improved(捕获首读瘦身且历史快照防篡改可溯源,无捕获与关闭投递零隐性字段丢失),user_experience为preserved(显式--context-delivery off全量内联、跨目录命令直接可用);visual_review为not_applicable(本次改动仅涉及 CLI 参数注册、Turn Envelope TypeScript 裁剪/引用投影与 JSON 捕获读取,经核对变更文件无前端或桌面渲染视图改动。;unverified_scope: 远程 GitHub Actions CI(按 Goalwait_for_ci: false策略未等待或依赖,已由本地全量测试与 premerge 替代)、10 条仅在 Windows PowerShell 环境运行的test_refresh_settle_turn.py条件跳过用例,93 条环境门控(PostgreSQL/远程)的 TS 控制面测试,以及安装态发行包分发。)。 - 结论: 无剩余阻塞问题,2/2 评审线程已解决(
unresolved_count: 0),批准精确提交6adec99e9e4edb48047e758df986f80cf2e00f81;按维护者工作流保留OPEN状态待人工/授权合并。
English verdict: APPROVE at 6adec99. Independent File and SQLite CLI verification confirms all fixes hold cleanly: explicit --context-delivery off (both uncaptured and --decision-output-dir) retains all 14 Explore attachment fields (surviving later explore_mode="off") and all 9 inline goal_acceptance outcomes without deferred_settlement_details bloat, while captured turn_scoped_v0 runs preserve immutable admission goal_acceptance + optional_attachments in signed decision.json, strip required-context.json, recover exact admission revisions across workspace boundaries via capture_read_command, fail closed (rc=1) on capture tampering, restore baseline attachment/projection tests unmodified, and pass 90/90 scoped TS tests, 6,806 full TS tests (93 env skips), 8/8 + 2,482 (10 Windows skips) Python tests, 18/18 canary premerge checks (passed), and valid cqr_e325833ef95dd5d91d50. Left OPEN per maintainer workflow.
loopx-agent
left a comment
There was a problem hiding this comment.
Reviewer: model_agent · gpt-6.2-sol · OpenAI · runtime_reported · xhigh
Approval conclusion (author-owned PR; GitHub blocks formal self-approval)
动机 / Motivation
长期运行的 Goal 每次准入都可能重复投递历史验收和结算材料,CLI 宿主需要精简首读并保留原始依据。 常规有捕获的 Turn 先读当前任务所需的验收,再从同一捕获补读。没有捕获或显式关闭投递时,初始响应保留完整材料。 File 与 SQLite 的目标基线和当前头在 off 无捕获及 off 带目录时,都交付完整的 9 项验收、14 个 Explore 附件字段和 11 个 Vision 字段,保留所观测的同轮结算身份。 从渐进首读拿到的原捕获索引可以读回完整附件。关闭 Explore 后,实时命令显示关闭,原捕获仍返回准入时的原附件。 本次范围是 CLI 首读、原捕获与本轮结算。
上一头已经恢复 off 下的验收正文,但仍把 Explore 结算附件缩成摘要。本头补齐了附件在显式 off 与无捕获时的完整性。 Required Work Context
改动思路 / Approach
Python 入口只转送详情开关、原命令位置和捕获引用。TypeScript 保留当前 Todo、已知关联及不确定验收的正文,把其他历史项压成带原 revision 的摘要。宿主可用同一捕获索引读取冻结材料,另用现有 inspect 或 Explore 命令查询实时状态。裁剪以前置的原捕获为条件,实时补读和冻结附件有各自可验证的入口。 保留现有 TypeScript TurnEnvelope owner,只在常规有原捕获时裁剪验收与可选附件。
具体改动 / Changes
精确头 6adec99,GitHub 目标 5fceda0。整案 12 个文件,+2482/−15;相对于 5c3494f,6 个文件,+101/−88。
- CURRENT-OUTCOME-DETAIL。CLI quota 参数接入 goal_acceptance 详情选择,TurnEnvelope 从原选中项、关联和缺口中保留必要验收的正文。 范围判断
- CAPTURE-BASELINE。TurnEnvelope Python/TS 边界绑定原 CLI 环境并保留冻结正文。引用表向首读交付对应 reader,渐进投递移出冻结重复面并留下同捕获索引。 冻结依据 · 原索引
- BOUND-SETTLEMENT。可选 Explore 附件只有在可读回原捕获时才摘要化,完整 Vision 作者合同、原命令和结算身份延续。 附件条件
- DISABLED-DELIVERY-PARITY。显式 off 时两类详情全量,未捕获场景保留原返回。首读、refresh/settle、Explore、quota projection 和 CLI fixture 共同覆盖这些分支。 CLI 选项传递
对主干的风险 / Risks
File 与 SQLite 的目标基线和当前头在 off 无捕获及 off 带目录时,都交付完整的 9 项验收、14 个 Explore 附件字段和 11 个 Vision 字段,保留所观测的同轮结算身份。 从渐进首读拿到的原捕获索引可以读回完整附件。关闭 Explore 后,实时命令显示关闭,原捕获仍返回准入时的原附件。 Goal 验收更新后,原 reader 仍读回旧修订,实时详情读新修订。不同工作目录保持原 registry 和 runtime 路由,篡改原捕获会被拒绝。 8 项 File/SQLite CLI 测试与 90 项 TypeScript 测试通过;另完成两后端的 off 配对和配置改变后的原附件读回。 全 diff 格式和对已观察 main 的静态合并通过。当前测试证明了原捕获仍可达和关闭投递的兼容边界,冻结读回仍受原 digest 约束。
我的整体评价 / Verdict
批准此精确提交。两处 off 的历史问题已在 File 与 SQLite 验证,渐进投递仍从同一次捕获恢复原附件和验收。改动位于 CLI 与运行态交付,App 视图源码未变。验证为隔离 File 与 SQLite 源码 CLI。安装态、PostgreSQL、远端 CI 和模型实际 token 或任务收益未测。
English verdict: APPROVE at 6adec99. File and SQLite preserve full inline material with delivery off and recover the original attachment after live configuration changes. Eight scoped CLI and 90 TypeScript tests passed.
Signed-off-by: huangruiteng <huangrt01@163.com>
huangruiteng
left a comment
There was a problem hiding this comment.
Reviewer: model_agent · GPT-5 · OpenAI · self_reported
动机 / Motivation
长期运行本机 LoopX、通过 quota should-run 获取 TurnEnvelope 并由 Agent 宿主消费上下文的长程用户和操作者。
修复前,33-outcome 合成 Goal 的常规 captured Turn 完整内联全部成果和静态结算文案;修复后,仅保留当前 Todo、依赖邻域、当前代理未完成项、开放缺口和不确定项的全文,其余折叠为带 revision、摘要和两个明确读命令的索引。
成熟 captured routine Turn 的首读包络显著缩小;完整 admission-time goal_acceptance 与 Explore 附件仍存入同一签名捕获并可冷读恢复,实时 inspect 保留最新工作区状态,无 capture 或显式关闭交付时保持完整内联。
不改变 Goal acceptance 权威、Todo/lease、quota 决策、权限或远端 provider;不修改 SQLite schema,不迁移持久化格式,也不承诺未运行的真实模型轨迹获得确定的任务成功率提升。
改动思路 / Approach
策略集中在现有 TypeScript TurnEnvelope 下游的单一纯投影模块,复用现有状态、哈希、捕获和冷读 owner,且所有不确定路径回到全量。
只对具备原捕获、唯一内联载体的常规 normal_run 成熟 Goal 做作用域首读;不改变权威状态、schema、provider 或 replan/closeout 语义。
入口是 loopx quota should-run -> compose_quota_work_contract -> composeCompleteTurnDecision。权威输入为 已组合的 quota payload、选中 Todo 与 outcome navigation、canonical goal acceptance、settlement plan、原 capture reader、CLI registry/runtime 路由和显式详情开关。决定边界:TypeScript TurnEnvelope 组合完成后,由 scopeTurnGoalAcceptance 与 compactRoutineSettlementPlan 判断常规 captured projection 是否安全;CLI 只负责透传开关和路径。结果:只生成响应投影,并把完整准入材料保留在既有签名 Turn capture 中;不改写权威 Goal、Todo、lease、settlement 或 provider 状态。消费方:宿主消费 scoped TurnEnvelope;capture_read_command 恢复冻结历史,cold_read_command 查询当前实时材料。失败与重试:任一保守检查不成立时返回原 payload;progressive context 保留捕获元数据,既有 capture digest checker 拒绝篡改。
具体改动 / Changes
按 docs/reference/protocols/turn-envelope-v0.md 的 revision 2ab607597444ab027c78b18ce675834f1486956e 核对,complete-turn-entry / scoped-required-context / context-delivery-off-parity / capture-readback-integrity / fail-closed-projection 分别对应下面的行为与验证。
关键代码讲解
scopeTurnGoalAcceptance:保留当前 Todo、依赖、开放缺口、本代理未完成项和不确定项的完整正文,其余 outcome 折叠为带 revision 和读取命令的索引;成熟 captured routine Turn 不再内联全部历史 outcome;仅在唯一完整载体存在且没有不安全作用域事实时生效。compactRoutineSettlementPlan:仅压缩与已知结构完全相等且未触发的 Explore 附件样板,同时在捕获中保留结算身份和完整附件材料;captured routine Turn 用摘要和冷读命令替代重复静态 Explore 文案;触发、结构偏离、无 capture 或非 routine 路径保持完整。composeCompleteTurnDecision:在既有完整 envelope owner 中,先压缩常规 settlement,再执行既有引用共享,最后执行 scoped acceptance;同一签名 composer 接入详情开关、原 CLI 路由和 capture reader,形成单一有序投影管线,不产生并行 Python 决策 owner。compose_quota_work_contract:把显式详情、原 CLI 调用和已锚定 registry/runtime 路径传入 TypeScript composition;context-delivery off 会请求完整 Vision 与 goal_acceptance 材料,Python 不复制投影逻辑。
变更共 12,2482 additions、15 deletions。8 个生产文件新增一个 TypeScript 作用域/压缩 owner,并把它接入既有 TurnEnvelope composer;progressive context 保留摘要回读,Python 只透传详情与路由参数。其余 4 个文件提供行为与兼容性覆盖。
complete-turn-entry:Composed TurnEnvelope 必须保留完整、签名且可读回的决策来源,不能以展示压缩替代权威状态;当前为 implemented。scoped-required-context:首读保留当前工作所需验收,未展开历史材料必须能通过原始捕获或明确冷读命令恢复;当前为 implemented。context-delivery-off-parity:显式 context delivery off 保留原完整内联路径,详情开关可恢复完整验收和 Vision/Explore 附件;当前为 implemented。capture-readback-integrity:历史捕获取材必须绑定原 revision、摘要和 reader,实时冷读必须与历史回放明确分离;当前为 implemented。fail-closed-projection:小 Goal、replan、audit、closeout、多载体分歧、未知或缺失来源必须保持完整内联或拒绝裁剪;当前为 implemented。
对主干的风险 / Risks
最强回归场景:scoper 折叠了当前 Turn 仍需要的 outcome 或 settlement attachment,或调用者把实时 cold read 误当成准入时状态的精确回放。触发状态:相关 Todo 只通过尚未建模的关系相连、outcome 缺少 provenance、多载体分歧、capture 缺失或被篡改,或操作者混淆 cold_read_command 与 capture_read_command。修复边界:唯一载体校验、routine action guard、关系/缺口/ownership 保留、歧义回退、Explore 结构深相等、签名 deferred details、digest 校验和明确命令文案阻止不安全分支。影响范围:成熟 Goal 的 captured routine Turn context、验收回读和结算指引;权威 Goal、Todo、quota 与 provider 状态不在投影内。可观察性:projection_mode、outcome 计数、digest/revision、summary_only 行、两个 reader 命令、CLI 退出状态和 capture 篡改拒绝共同暴露结果。恢复路径:用 capture_read_command 或 --include-detail 取得完整材料,或用 --context-delivery off 回到原完整内联路径;无需数据迁移。
changed_invariant_positive=passed (90 passed, 0 failed, 0 skipped on the final head.);material_negative_or_failure=passed (Negative branches retained full outcomes or attachments and capture tampering was rejected.);scoped_cli_e2e=passed (8 passed on the final head before the latest-main merge; the merge did not change the scoped-envelope files.);related_runtime_suite=failed (2498 passed, 10 skipped, 2 failed; both failures reproduce with the same KeyError on unchanged main.);full_typescript_diagnostic=failed (The observed head failures are lease-renew/capacity baseline drift; the same three focused tests fail on unchanged main.);static_and_contract_checks=passed (Typecheck and Ruff passed; premerge passed 18/18 selected checks with 0 manual holds.);public_fixture_boundary=passed (public_boundary_scan ok=true, scanned_files=12, no public-boundary warnings.);repository_required_checks=passed (All direct checks, Python compile, 10 catalog canaries and 8 risk smokes passed.);remote_ci_diagnostic=unverified (Several jobs were failing or pending at observation time; no remote job is used as proof of the changed invariant.)。
- PASSED · Scoped acceptance, progressive first read and TurnEnvelope composition:90 passed, 0 failed, 0 skipped on the final head.
- PASSED · Unsafe, ambiguous, off, uncaptured and tampered cases fail closed or preserve full material:Negative branches retained full outcomes or attachments and capture tampering was rejected.
- PASSED · File and SQLite real CLI behavior, cross-workspace commands, off parity, capture recovery and detail flags:8 passed on the final head before the latest-main merge; the merge did not change the scoped-envelope files.
- FAILED · Quota projection, context first read, Explore settlement, refresh/settle, replan, acceptance references, architecture and maintainability:2498 passed, 10 skipped, 2 failed; both failures reproduce with the same KeyError on unchanged main.
- FAILED · Full TypeScript control-plane suite:The observed head failures are lease-renew/capacity baseline drift; the same three focused tests fail on unchanged main.
- PASSED · Typecheck, Ruff, diff hygiene, RFC bilingual, compile, catalog and risk smoke:Typecheck and Ruff passed; premerge passed 18/18 selected checks with 0 manual holds.
- PASSED · All 12 changed files remain public-safe:public_boundary_scan ok=true, scanned_files=12, no public-boundary warnings.
- PASSED · Repository premerge direct checks:All direct checks, Python compile, 10 catalog canaries and 8 risk smokes passed.
- UNVERIFIED · Remote GitHub Actions result:Several jobs were failing or pending at observation time; no remote job is used as proof of the changed invariant.
我的整体评价 / Verdict
长程效果判断为 improved:长程 Goal 的惯例执行 Turn 不再重复携带无关历史全文,同时当前依赖、开放缺口、原捕获和结算路径保持可验证。用户体验判断为 preserved:默认 CLI 路径变小,但显式关闭交付、详情开关、错误和读回命令继续可用,未改变交互步骤或权限。视觉界面检查不适用,因为本 PR 只改变 CLI/control-plane JSON 投影与测试。
最终 head 合入最新 main 后保留原 scoped envelope 行为;三个历史 P2 线程均已修复并解决,当前 head 的聚焦 TS、File/SQLite CLI、静态检查和 18/18 premerge 均通过。
English verdict: APPROVE at 0ffa253. Scoped routine Turn projection reduces mature-capture payloads while preserving current-work evidence, exact historical readback and live detail. The exact head passes 90 focused TypeScript tests, 8 File/SQLite CLI tests, typecheck, Ruff and 18/18 premerge; observed broad-suite failures reproduce unchanged on main.
Summary
Eliminates the primary per-Turn payload bloat in
loopx_turn_envelope_v1while preserving completegoal-acceptance inspect, replan, closeout, immutable Turn capture readback, fail-closed digest integrity, disabled-delivery parity, and downstream settlement semantics:Scoped per-Turn
goal_acceptanceoutcome projection (loopx/control_plane/quota/turn_envelope_scoping.ts):normal_runexecution turns (captureReferenceFilepresent) when current-lifetime outcomes exceedSCOPED_OUTCOME_THRESHOLD(6), retains full outcome bodies (requirements,sources,work) only for Turn-relevant outcomes:selected_todo.todo_idor its direct dependency / blocking peer neighborhood,agent_id,acceptance_gaps, andid,owner_agent_id,basis_digest,revision,todo_count,summary_only: true,capture_read_command,read_modes,cold_read_command).goal_objective,full_outcomes_sha256,projection_mode: "turn_scoped_v0",full_outcome_count,scoped_outcome_count, and authoritative contract provenance.goal_acceptanceinsidedeferred_settlement_details.goal_acceptancein signeddecision.jsoncaptures whencaptureReferenceFileis set, whileprogressive_context.tsstripsdeferred_settlement_detailsout ofrequired-context.json.--registry/--runtime-root/ CLI invocation flags intocold_read_command(goal-acceptance inspect) and clearly separates historicalcapture_read_command(quota context-read) from live workspacecold_read_command/--include-detail goal_acceptance.!captureReferenceFile), when--context-delivery offis passed (with or without--decision-output-dir), on small Goals (<= 6),goal-acceptance inspect, replan turns,vision_continuation_audit/vision_checkpoint.requiredturns, closeout turns,all_advancement/ criterion-based contracts, divergent multi-carrier payloads, and--include-detail goal_acceptance.Immutable Turn capture parity & bound explore cold-reads (
loopx/control_plane/quota/turn_envelope_scoping.ts,progressive_context.ts):vision_authoringcontract intact at its canonicalsettlement_plan.ordered_steps[].vision_authoringstep on both captured Turn decisions (decision.json) and--context-delivery offresponses, keepingprogressive_context.tsfirst-read trimming (schema_version,rule,continuation_review),reusableVisionAuthoring,recovery.commandreadback, and uncaptured callers fully compatible.captureReferenceFilepresent), compacts non-triggeredoptional_attachmentsprose and matching redundantexplore_turn_context.content.graphboilerplate while inheritingcli_argv,--registry,--runtime-root,--goal-id,--agent-id, and--todo-idintoexplore turn-contextcold-read commands and retaining complete originaloptional_attachmentsinside top-leveldeferred_settlement_detailsondecision.json(while deferringdeferred_settlement_detailsout ofrequired-context.jsonviaprogressiveContextPlan).result_writeback_guidance_refverbatim whenever uncaptured (!captureReferenceFile), when--context-delivery offis passed (with or without--decision-output-dir), when triggered, or when--include-detail visionis passed.Public
--include-detail goal_acceptance&--context-delivery offsupport (loopx/cli_commands/quota_request.py,quota_registration.py,quota_presentation.py):"goal_acceptance"toQUOTA_SHOULD_RUN_DETAIL_SECTIONSforquota should-run(rejected cleanly withQUOTA_VALIDATION_FAILEDon unsupported quota subcommands such asquota plan) and forwardsinclude_goal_acceptance_detailandinclude_vision_detail(enabled whendetail_sectionsrequests them or--context-delivery offis set) throughcompose_turn_decisioninto TypeScriptcomposeCompleteTurnDecision.Key Owners Changed (
12Files)loopx/control_plane/quota/turn_envelope_scoping.ts: single TypeScript owner (scopeTurnGoalAcceptance,compactRoutineSettlementPlan) reusingEffectiveAction,canonicalHash,shellQuote,exploreResultWritebackAffordance,quotaContextReadCommand,goalAcceptanceColdReadCommand, andOUTCOME_CONTEXT_NAVIGATION_SCHEMA.loopx/control_plane/quota/turn_envelope.ts: wires routine settlement compaction and scopedgoal_acceptanceincomposeCompleteTurnDecision, decodinginclude_goal_acceptance_detail,include_vision_detail,cli_argv,registry_path,runtime_root, andcapture_reference_file.loopx/control_plane/quota/turn_envelope_references.ts&progressive_context.ts: sharedsummaryOutcomeIndexRowhelper,--initial-readmetadata preservation forsummary_onlyentries (cold_read_command,capture_read_command,read_modes), anddeferred_settlement_detailsprogressive pruning.loopx/cli_commands/quota_request.py,quota_registration.py,quota_presentation.py, &loopx/control_plane/quota/turn_envelope.py: registers--include-detail goal_acceptance, enforces--context-delivery offinline acceptance and settlement attachment parity, and forwards detail flags,current_loopx_cli_argv(),registry_path,runtime_root, and capture reader reference path into TypeScript composition.4files):tests/control_plane_ts/turn_envelope_scoping.test.ts,tests/control_plane/test_scoped_turn_envelope_cli.py, and expectation updates intests/control_plane/test_context_first_read.pyandtests/control_plane/test_refresh_settle_turn.py(test_explore_settlement_attachment.pyandtest_quota_cli_projection.pystay unmodified at baseline parity).Review Fixes (
72d99a84df->ee616052cc->5c3494ff8e->6adec99e9e)72d99a84df([P2]review6042964603): Propagatedcli_argv,registry_path, andruntime_rootintogoalAcceptanceColdReadCommandacrossoutcome_requirements,summary_onlyrows,summaryOutcomeIndexRow, andprogressive_context.ts, adding cross-workspace File & SQLite CLI E2E regression tests.ee616052cc([P2]review6044792177, threadPRRT_kwDOStEbEs67hIxFresolved): Saved full admission-timegoal_acceptanceinsidedeferred_settlement_details.goal_acceptancein captureddecision.jsonwhile keepingrequired-context.jsoncompact, addedcapture_read_command+read_modesalongside bound livecold_read_command, clarified live vs. historical semantics incold_read_instruction&--include-detailhelp text, and added File & SQLite admission-recovery-after-Goal-advancement regression tests.5c3494ff8e([P2]review6045950689,DISABLED-DELIVERY-PARITY): GatedscopeTurnGoalAcceptancestrictly on non-emptycaptureReferenceFile, enabledinclude_goal_acceptance_detailwhen--context-delivery offis passed incompose_quota_work_contract, and added File, SQLite, and TypeScript regression tests verifying disabled-delivery and uncaptured full-inline acceptance parity.6adec99e9e([P2]review6047061601, threadPRRT_kwDOStEbEs67lP0jresolved,SETTLEMENT_INLINE_OFF): GatedcompactRoutineSettlementPlanstrictly on non-emptycaptureReferenceFile, enabledinclude_vision_detailwhen--context-delivery offis passed incompose_quota_work_contract, restored baselinetest_explore_settlement_attachment.py&test_quota_cli_projection.py, and verified File/SQLite 14-field Explore attachment retention with and without--decision-output-direven after Explore is disabled.Synthetic 33-Outcome A/B Benchmark (
50f911dbb3measurement vsorigin/main)Measured on the isolated synthetic 33-outcome multi-agent Goal fixture in
tests/control_plane/test_scoped_turn_envelope_cli.py(--context-delivery on, across both File and SQLite stores; public-safe fixture):origin/main)50f911dbb3)decision.jsonrequired-context.jsonwork_contextgoal_acceptancesourceoutcome_requirements.outcomes(33)settlement_plan(durable_writeback)optional_attachmentsvision_authoringdecision.jsonrequired-context.jsonwork_contextgoal_acceptancesourceoutcome_requirements.outcomes(33)settlement_plan(durable_writeback)optional_attachmentsvision_authoringVerification (
6adec99e9e4edb48047e758df986f80cf2e00f81)npm run -s typecheck:control-plane: passed (0errors).node --no-warnings --experimental-sqlite --experimental-strip-types --test tests/control_plane_ts/turn_envelope_scoping.test.ts tests/control_plane_ts/progressive_context.test.ts tests/control_plane_ts/turn_envelope.test.ts: 90 passed,0failed,0skipped.npm run -s test:control-plane: 6,808 passed,91skipped (environment-gated PostgreSQL/remote tests),0failed.pytest -v tests/control_plane/test_scoped_turn_envelope_cli.py: 8 passed,0failed,0skipped (File & SQLite E2E scoping, cross-workspacecold_read_commandbinding, post-advancementcapture_read_commandrecovery of admission-time baseline, disabled-delivery & uncaptured inline acceptance and 14-field Explore attachment parity,--include-detail goal_acceptance/vision, tampered-digest rejection).pytest -n 6(test_scoped_turn_envelope_cli.py,test_context_first_read.py,test_explore_settlement_attachment.py,test_quota_cli_projection.py,test_refresh_settle_turn.py,test_replan_staged_read.py,test_replan_host_context_projection.py,test_turn_envelope.py,test_maintainability_ratchet.py,tests/architecture/): 2,432 passed,10skipped (Windows PowerShell-only tests on macOS),0failed.ruff check(all 7.pyPR/baseline suites) & repomypy(17files) +mypy --follow-imports=silent(4changedloopx/.pyfiles): passed (0issues).scripts/check_rfc_bilingual.py --base f0ca9cef0e394b62d4a0f28c54beba16cb7aa29c --head HEAD: passed.loopx check --scan-pathon all12PR files (ok: true, errors: 0, warnings: 0, public boundary scan clean),git diffleak scan (0hits),git merge-tree(CLEAN),change-qualityreceipt (cqr_5e4746043d25d7af3416,status: valid,decision: pass,scope_fingerprint: 5e4746043d25d7af34167eaf45656543c2396acd21b658cb8d6fa5f78d83420e), andloopx canary premerge --from-git-diff --git-diff-base f0ca9cef0e394b62d4a0f28c54beba16cb7aa29c: passed (gate.status: "passed",merge_gate_passed: true,direct_checks: 4/4,python_compile: 1/1,catalog_run: 10/10,risk_profile_run: 8/8,manual_hold_count: 0).