Repository navigation
fix(control-plane): stabilize v2.4.0 quota, turn-envelope, and capabilities slice (Slice B1) - #9154
Conversation
loopx-agent
left a comment
There was a problem hiding this comment.
Reviewer: model_agent, Gemini, Google (self_reported)
Request changes conclusion (author-owned PR; GitHub blocks formal self-review)
针对精确头 9154@dc949e699dbbc497b73b7b347936f8f2fdaf9ccd(base main 3144369890eb4be55e0f0c0275825c163c9d8a0c)的独立代码审查与本地实跑验证发现 2 个阻断性 P1 缺陷,均位于新引入的 attachCompleteTurnContext / attach_complete_turn_context 后置封签路径中:在缺少稀疏数值 token 的决策上会生成无法通过 requireCompleteTurnDecision 的损坏信封,且 Python 侧增量附着会把 1.0 浮点与大整数经 JS 数值圆整后破坏签名一致性。其余 4 项生产修复及 18 份测试/smoke 对齐经实测边界合理且未发现回退。
动机 / Motivation
- 受影响对象与触发任务:启用
reward_memory或anti_entropy上下文钩子的 LoopX Host / Codex App 调度调用方、未声明--turn-envelope的 JSONquota should-run自动化调用方,以及处于scoped_user_gate_fallback或request_subject委托路由下的 Turn 执行与结算链路。 - 前后场景与实际代价:以开启
reward_memory召回并消费完整 Turn 契约的quota should-run调用方为例:主干上记忆上下文钩子在compose_quota_work_contract之前挂载,可能与签章后的loopx_turn_envelope_v1投影错位;本 PR 将钩子后移并通过attachCompleteTurnContext重新封签,同时统一未声明 JSON 调用方谓词、补齐部分argparse.Namespace默认值、透传iteration_context_policy/session_scope与delegationRequestDecision清理,并放行已准入的scoped_user_gate_fallback硬租约准备与 closeout 读回。 - 可观测结果与缺陷:4 项外围修复(未声明 JSON 保持
quota_packet、部分 Namespace 校验不抛AttributeError、current_turn_host_launch_decision与delegationRequestDecision作用域对齐、scoped_user_gate_fallback准备/closeout 准入)及 18 个测试/smoke 对齐均已验证通过;但核心修复attachCompleteTurnContext/attach_complete_turn_context在空source_number_tokens载荷或context_additions含浮点1.0/ 大整数时会破坏loopx_turn_envelope_v1内容哈希一致性,导致下游验签直接失败。 - 非目标边界:本 PR 仅处理 Slice B1 范围内的控制面/CLI 回归修复与对应测试/smoke 对齐,不修改
tests/extensions/*、tests/presentation/*及其他未纳入本批的测试模块,也不扩展新的协议版本或外部存储后端。
由于旧测试集中 quota.compute 恰好为 1.0(携带了一条非空 source_number_tokens),且测试未对空 token 或 context_additions 含精确浮点/大整数的场景调用 attach_complete_turn_context,上述缺陷在现有门禁中均未被捕获。
改动思路 / Approach
本 PR 将改动收敛在五个既存边界内,未新增平行状态机或兼容协议版本:
- 后置封签(Post-composition context sealing):从
composeCompleteTurnDecision抽取sealCompleteTurnDecision,新增attachCompleteTurnContext(TS)与attach_complete_turn_context(Python),在quota_result_delivery.py的compose_quota_work_contract之后执行attach_reward_memory_recall_after_should_run,保留pre_contract_decision供 recall 查询并尝试重新封签loopx_turn_envelope_v1。 - 未声明 JSON 谓词单一归属:将判定抽为
quota_presentation.py::is_undeclared_json_quota_caller,并在quota_should_run.py的dispatch_quota_turn_start_hooks(model_read)与execute_quota_should_run(complete_context)共用,确保普通--format json不会请求Complete Turn上下文。 - 局部 Namespace 兼容校验:
quota_context.py与quota_request.py将可选参数读取改用getattr,仅放行缺省可选字段而不吞没缺失--goal-id、--agent-id等必选校验错误。 - Host / Delegation 作用域对齐:
turn_decision.py补齐iteration_context_policy与session_scope透传以对齐turn.py;delegation.ts清除agent_channel上残留的selection_required、action_portfolio_ref、suggested_action_count。 - Scoped Fallback 准备与 Closeout:
execution_preparation.py与settlement_cli.py仅在obligation["delivery_allowed"] is True且closeout_required为真时允许scoped_user_gate_fallback准备及落盘租约回执字段。
- 架构判断:各项修复均复用现有 typed owner:
turn_envelope.ts的sealCompleteTurnDecision统一封签边界、quota_presentation.py::is_undeclared_json_quota_caller统一未声明 JSON 谓词、turn_decision.py与delegation.ts保持单向作用域投影、execution_preparation.py与settlement_cli.py仅在delivery_allowed is True时准入准备和租约回执;架构归属合理,但attachCompleteTurnContext的边界细节存在实现缺陷。 - 当前 PR 边界:仅修复 PR #9154 已覆盖的 5 个控制面/CLI 回归点及 18 个受影响测试/smoke 文件;修复
attachCompleteTurnContext与attach_complete_turn_context的空 token 哈希与数值透传缺陷后即可独立合入。
具体改动 / Changes
- 生产代码(13 个文件):
loopx/control_plane/quota/turn_envelope.ts、turn_envelope.py、execution_preparation.py、settlement_cli.py、loopx/control_plane/collaboration/delegation.ts,以及loopx/cli_commands/下quota.py、quota_context.py、quota_presentation.py、quota_request.py、quota_result_delivery.py、quota_reward_memory.py、quota_should_run.py、turn_decision.py。 - 测试与公开 Smoke(18 个文件):3 份公开 smoke(
todo-durability-fixture-smoke.py、explore-result-layer-smoke.py、issue-fix-validated-memory-writeback-smoke.py)与 15 份 pytest 测试,用于对齐loopx_turn_envelope_v1、quota spend-slot结算、Goal 停用注册表迁移及 detached HEAD 隔离克隆。 - 规格基准:本次 PR 为多模块 v2.4.0 稳定化修复批次,无单一统一书面规格;涉及
loopx_turn_envelope_v1的签名与完整性约束依据主干既有协议文档docs/reference/protocols/turn-envelope-v0.md(baseline3144369890eb4be55e0f0c0275825c163c9d8a0c)及turn_envelope.ts既有校验逻辑核验。
关键代码讲解
attachCompleteTurnContext(loopx/control_plane/quota/turn_envelope.ts)[P1 缺陷点]:先用requireCompleteTurnDecision验证原包并禁止覆写已有键或系统保留字段,再拼接source_number_tokens与context_addition_tokens。但第 2161–2164 行传入combinedTokens.length > 0 ? combinedTokens : undefined给contextSourceIdentity;当combinedTokens为空时,contextSourceIdentity(source, undefined)生成不含[, []]包装的哈希输入,与composeCompleteTurnDecision(?? [])及requireCompleteTurnDecision(?? [])不一致,必现complete Turn decision content integrity mismatch。attach_complete_turn_context(loopx/control_plane/quota/turn_envelope.py)[P1 缺陷点]:调用_turn_envelope_result("attach_complete_turn_context", payload=source, context_additions=additions, source_edits=True)后执行_apply_context_projection_changes(source, result)。由于source尚未包含additions,TS 侧contextProjectionChanges(request.payload, result)会把additions中全部字段作为value补丁发回 Python,导致1.0(float)被 JSJSON.parse变为整数1、大整数2**80被圆整为1.2089258196146292e+24,从而丢失addition_tokens原始数值语义并直接触发下游assert_complete_turn_decision验签失败。is_undeclared_json_quota_caller(loopx/cli_commands/quota_presentation.py):集中定义UNDECLARED_JSON_COMPLETE_TURN_OPTIONS并在quota_should_run.py两处与compose_quota_work_contract复用,经实跑对照:未声明--format json维持schema_version=None的公开quota_packet,传入--turn-envelope或--codex-app时切换至loopx_turn_envelope_v1。- **
current_turn_host_launch_decision(loopx/cli_commands/turn_decision.py)**与delegationRequestDecision(loopx/control_plane/collaboration/delegation.ts):分别补齐与turn.py一致的iteration_context_policy/session_scope计算(request_subject在 Codex 会话宿主固定"agent")及清除agent_channel过期选单字段,防止启动前重校验或委托通道残余选单信息。 apply_selected_todo_execution_preparation与quota_rollout_details(execution_preparation.py/settlement_cli.py):严格限定仅在scoped_user_gate_fallback且obligation["delivery_allowed"] is True(以及closeout_required为真)时执行硬租约准备和回执字段输出;当delivery_allowed=False(如agent_workspace_repair)时仍保持拒绝且不泄露租约准备态。
对主干的风险 / Risks
- [P1 阻断] 空
source_number_tokens下attachCompleteTurnContext产生自相矛盾的loopx_turn_envelope_v1:- Problem:
turn_envelope.ts第 2161–2164 行在combinedTokens为空时将undefined传给contextSourceIdentity,导致计算source_decision_hash/content_hash时使用无[]后缀的编码,而requireCompleteTurnDecision(第 1780 行)始终传入numberTokens ?? []。 - Evidence:在 exact head
dc949e699dbbc497b73b7b347936f8f2fdaf9ccd上直接验证:(1)Node 实跑composeCompleteTurnDecision后接attachCompleteTurnContext(无浮点 token),requireCompleteTurnDecision(attached)抛出EffectRuntimeRequestError: complete Turn decision content integrity mismatch;(2)端到端 CLI 实跑quota should-run --codex-app(置quota.compute = 0.5使tokens=[]且开启reward_memory召回),默认配置下会先落盘heartbeat_receipt,随后在递送阶段返回rc=1、error_code="quota_decision_transport_failed",导致已提交 Turn 无法呈现或消费。 - Fix:在
loopx/control_plane/quota/turn_envelope.ts将combinedTokens.length > 0 ? combinedTokens : undefined改为直接传入combinedTokens(空数组[]与composeCompleteTurnDecision、requireCompleteTurnDecision完全一致),并补充 TS/Python 空 token 单测与 CLI 回归用例。
- Problem:
- [P1 阻断]
attach_complete_turn_context通过contextProjectionChanges经 JS 圆整覆盖新增 Python 数值:- Problem:
turn_envelope.py第 345–351 行传入不含context_additions的source与source_edits=True,turn_envelope.ts第 2675–2676 行对比request.payload与合并后的result,将整块context_additions经 JS 数值解码回写 Python。 - Evidence:在 exact head
dc949e699dbbc497b73b7b347936f8f2fdaf9ccd上即使基包带有非空source_number_tokens([['quota', 'compute'], '1.0']),执行attach_complete_turn_context(raw, {"post_attach_recall": {"val": 1.0, "big": 2**80}})后,返回值中val被篡改为int(1)、big被圆整为float(1.2089258196146292e+24),source_number_tokens丢失'1.0',随后assert_complete_turn_decision立即抛出EffectRuntimeRejected: complete Turn decision content integrity mismatch。 - Fix:在 TS
evaluateTurnEnvelope的attach_complete_turn_context分支中以{...request.payload, ...additions}作为contextProjectionChanges的基对象(或仅投影contract_binding变更),并在 Pythonattach_complete_turn_context中以base={**source, **additions}应用变更,保留原始 Python 对象与稀疏数值拼写;同时补全含1.0与2**80的往返单测。
- Problem:
- 其余 4 项修复边界核验:
is_undeclared_json_quota_caller的default_off_isolation对照、部分 Namespace 校验错误保留(turn-scoped缺失--agent-id、should-run缺失--goal-id与非法--turn-envelope均仍抛QuotaCommandValidationError)、delegationRequestDecision清除agent_channel选单字段、scoped_user_gate_fallback在delivery_allowed=False下的负例隔离均已实测通过;全部 31 个改动文件loopx check公私边界扫描 0 错误(public_boundary_scan.ok=true)。
我的整体评价 / Verdict
- 交付与用户体验影响:尽管本 PR 中 4 项独立回归修复与 18 份测试/smoke 对齐工作良好(
npm run typecheck:control-plane、npm run test:control-plane6688 passed / 93 skipped / 0 failed、ruff、mypy、check_rfc_bilingual.py、loopx check31 文件 0 错误、canary premerge19 项 selected 检查 0 失败、4 份 smoke 及聚焦 17 模块 pytest534 passed, 1 skipped (tests/control_plane/test_cli_output_budget.py:2013: Native temp namespace cannot fit the qualified depth-12 layout), 0 failed均已独立复核通过;本批未涉及渲染 UI,visual_review为not_applicable,本次改动仅涉及 CLI、控制面 TypeScript/Python 契约与测试/smoke 脚本,不涉及任何前端渲染页面或 UI 视图。),但核心修复attachCompleteTurnContext/attach_complete_turn_context在真实场景(空source_number_tokens或context_additions含浮点1.0/ 大整数)下会直接破坏loopx_turn_envelope_v1内容哈希并在已落盘heartbeat_receipt后阻断递送(long_horizon与user_experience均判定为regression)。 - 代码体量与语义对齐:
code_volume为necessary(兼容边界retain),change_proportionality为proportionate;语义上完全复用现有词表(reuse_existing,未新增公开状态枚举或 schema 版本,无需修改注册表或 RFC)。 - 复审要求:请修复上述 2 个 P1 缺陷并在
turn_envelope.test.ts与test_quota_memory_context.py补齐无source_number_tokens、含1.0浮点及大整数context_additions的端到端验签测试,重跑上述校验后再次提交复审。
English verdict: REQUEST_CHANGES — Head dc949e6 has two confirmed P1 integrity bugs in attachCompleteTurnContext / attach_complete_turn_context that fail requireCompleteTurnDecision on tokenless payloads or float/large-int context additions.
…lities slice Signed-off-by: LoopX Agent <[email protected]>
…tach_complete_turn_context Signed-off-by: LoopX Agent <[email protected]>
dc949e6 to
5b5449e
Compare
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)
针对 Round 2 精确头 9154@5b5449e8ca7e7628bb25299409be629d078cbfc1(rebased on main 2049e40cf827c7cfd09ed8c1b464cafaf3ebfc05)的独立复审与全量实跑验证表明:Round 1 提出的 2 个 P1 阻断性完整性缺陷已在最新提交 5b5449e8ca 彻底修复,空 source_number_tokens 往返及 1.0 浮点 / 2**80 大整数保留均已通过直接复现与新增单测/CLI 集成测试验证,原有 4 项生产修复及 20 份测试/smoke 对齐均无回退。
动机 / Motivation
- 受影响对象与触发任务:启用
reward_memory或anti_entropy上下文钩子的 LoopX Host / Codex App 调度调用方、未声明--turn-envelope的 JSONquota should-run自动化调用方,以及处于scoped_user_gate_fallback或request_subject委托路由下的 Turn 执行与结算链路。 - 前后场景与实际代价:以开启
reward_memory召回并消费完整 Turn 契约的quota should-run调用方为例:此前记忆上下文钩子在compose_quota_work_contract之前挂载,可能与签章后的loopx_turn_envelope_v1投影错位;本 PR 将钩子后移并通过attachCompleteTurnContext/attach_complete_turn_context重新封签,在最新头节点修复了空source_number_tokens哈希前缀不一致及source_edits=True下 JS 数值圆整覆写1.0浮点/大整数的两个 P1 缺陷,同时统一未声明 JSON 调用方谓词、补齐部分argparse.Namespace默认值、透传iteration_context_policy/session_scope与delegationRequestDecision选单清理,并放行已准入的scoped_user_gate_fallback硬租约准备与 closeout 读回。 - 可观测结果:精确头
5b5449e8ca实测全部通过:空 token 负载经attachCompleteTurnContext(TS 与 Python RPC)以及 CLI--context-delivery off/auto端到端链路均顺利通过requireCompleteTurnDecision/assert_complete_turn_decision验签;context_additions中的float(1.0)与2**80精确保留原始 Python 数值类型且在篡改1.0 -> 1或2**80 -> 2**80+1时立即触发完整性拒绝;其余 4 项生产修复及 20 份测试/smoke 对齐全部验证无回退。 - 非目标边界:本 PR 仅处理 Slice B1 范围内的控制面/CLI 回归修复与对应测试/smoke 对齐,不修改
tests/extensions/*、tests/presentation/*及其他未纳入本批的测试模块(Slice B2 已另行处理并合入基线),也不扩展新的协议版本或外部存储后端。
相比 Round 1(dc949e699d),最新提交 5b5449e8ca 补齐了此前因基线测试携带 quota.compute=1.0 而掩盖的两类稀疏数值与空 token 边界用例,并在 tests/control_plane_ts/turn_envelope.test.ts 与 tests/control_plane/test_quota_memory_context.py 固化了端到端防回归测试。
改动思路 / Approach
- 后置封签与双 P1 修复(
turn_envelope.ts/turn_envelope.py):attachCompleteTurnContext(turn_envelope.ts:2161)改为直接向contextSourceIdentity(source, combinedTokens)传入数组combinedTokens(为空时传[]而非undefined),使计算source_decision_hash/content_hash时的编码与composeCompleteTurnDecision(:2086)和requireCompleteTurnDecision(:1780)完全一致。evaluateTurnEnvelope(turn_envelope.ts:2670-2676)在source_edits === true时以{...payload, ...additions}作为contextProjectionChanges的基对象,Pythonattach_complete_turn_context(turn_envelope.py:351)对应以base={**source, **additions}应用变更并携带context_addition_tokens(:113-116),使新增字段不再经由 JS JSON 数值解码回写覆盖,float(1.0)与2**80均原样保留且仍受assert_complete_turn_decision严格校验。
- 其余 4 项修复边界复用与核验:
quota_presentation.py::is_undeclared_json_quota_caller统一未声明 JSON 谓词并由quota_should_run.py复用;quota_context.py与quota_request.py对可选 CLI 字段改用getattr默认值而不吞没缺失--goal-id/--agent-id/ 非法参数组合错误;turn_decision.py与delegation.ts对齐iteration_context_policy/session_scope透传并清除agent_channel过期选单字段;execution_preparation.py与settlement_cli.py严格仅在obligation["delivery_allowed"] is True(及closeout_required)时允许scoped_user_gate_fallback准备与租约 closeout 字段。
- 架构判断:全部改动均复用现有 typed owner:
turn_envelope.ts抽取sealCompleteTurnDecision并统一让attachCompleteTurnContext与composeCompleteTurnDecision/requireCompleteTurnDecision共用数组形式的contextSourceIdentity、diff 基对象{...payload, ...additions},Python 侧对应复用_apply_context_projection_changes({**source, **additions}, result);quota_presentation.py::is_undeclared_json_quota_caller统一未声明 JSON 谓词;turn_decision.py与delegation.ts保持单向作用域投影;execution_preparation.py与settlement_cli.py仅在delivery_allowed is True时准入准备和租约回执。无冗余状态层或平行策略。 - 当前 PR 边界:仅包含 PR #9154 覆盖的 5 个控制面/CLI 回归点、Round 2 的两项 P1 完整性修复及对应 20 个测试/smoke 文件(总计 33 个文件),范围收敛、可独立合入与回滚。
具体改动 / Changes
- 生产代码(13 个文件,+219/-50):
loopx/control_plane/quota/turn_envelope.ts、turn_envelope.py、execution_preparation.py、settlement_cli.py、loopx/control_plane/collaboration/delegation.ts,以及loopx/cli_commands/下quota.py、quota_context.py、quota_presentation.py、quota_request.py、quota_result_delivery.py、quota_reward_memory.py、quota_should_run.py、turn_decision.py。 - 测试与公开 Smoke(20 个文件,+340/-102):3 份公开 smoke(
todo-durability-fixture-smoke.py、explore-result-layer-smoke.py、issue-fix-validated-memory-writeback-smoke.py)与 17 份测试文件(较 Round 1 新增tests/control_plane_ts/turn_envelope.test.ts与tests/control_plane/test_quota_memory_context.py的空 token /float(1.0)/2**80/--context-delivery auto防回归用例)。 - 规格基准:多模块 v2.4.0 稳定化修复批次,无单一统一书面规格;
loopx_turn_envelope_v1完整性与稀疏数值签名契约对照主干既有协议文档docs/reference/protocols/turn-envelope-v0.md(baseline2049e40cf827c7cfd09ed8c1b464cafaf3ebfc05)及turn_envelope.ts既有校验逻辑核验。
关键代码讲解
attachCompleteTurnContext空 token 哈希一致性(loopx/control_plane/quota/turn_envelope.ts:2136-2163):先调用requireCompleteTurnDecision验证基础包并校验新增键不与保留字段/已有字段冲突,随后combinedTokens直接以数组形式传入contextSourceIdentity(source, combinedTokens)再交由sealCompleteTurnDecision重算双哈希,彻底消除空 token 场景下的[, []]编码分叉。evaluateTurnEnvelope与attach_complete_turn_context保真补丁(turn_envelope.ts:2670-2676、turn_envelope.py:113-116,338-351):TS 侧将{...payload, ...additions}作为contextProjectionChanges比较基准,仅向 Python 返回contract_binding变更;Python 侧_turn_envelope_result提取context_addition_tokens后以{**source, **additions}作为补丁基对象,既保证1.0(float)与2**80(int)不退化,又使任意后续篡改(例如将1.0改为int(1)或修改2**80)立即在assert_complete_turn_decision报错拦截。- Round 1 -> Round 2 增量与 Rebase 审计:
git range-diff确认基础提交8b8c50ec74与 Round 1dc949e699d改动完全一致(=),新基线2049e40cf8已包含 Slice B2 改动,第 2 提交5b5449e8ca仅包含针对两项 P1 的最小化修复与对应回归测试,无多余范围扩散。
对主干的风险 / Risks
- Turn 信封与篡改防御实测:在
5b5449e8ca上直接重跑此前失败的两组 P1 复现(TS 原生空 token 往返、Python 空 token RPC、CLI--context-delivery off/auto端到端召回,以及float(1.0)与2**80附着),全部一次通过且assert_complete_turn_decision仍能准确捕获1.0 -> int(1)与2**80 -> 2**80+1篡改。 - 边界与回归风险收敛:
is_undeclared_json_quota_caller(plain_json -> schema_version=Nonevs--turn-envelope -> loopx_turn_envelope_v1)、部分 Namespace 校验错误保留、delegationRequestDecision清理agent_channel选单字段、scoped_user_gate_fallback按delivery_allowed门控均已再次实测通过;全部 33 个改动文件loopx check公私边界扫描 0 错误(public_boundary_scan.ok=true)。 - 残留受限维度:Slice B1 范围以外的测试集(
tests/extensions/*、tests/presentation/*等,已于基线合并或独立跟踪)及需要独立外部 PostgreSQL 实例的 TS 集成测试(npm run test:control-plane中按环境条件跳过的条目)未在本地连接外部数据库执行,属环境预期边界而非本 PR 引入的风险。
我的整体评价 / Verdict
- 交付与用户体验影响:Round 1 指出的两个 P1 阻断缺陷已在
5b5449e8ca彻底闭环并由独立复现及新增防回归测试固化;5b5449e8ca上本地验证全部通过:npm run typecheck:control-plane通过,npm run test:control-plane:6691 passed, 93 skipped (host/optional-DB/gated integration specs), 0 failed (tests 6784);- 靶向 pytest(
test_quota_memory_context.py、test_quota_decision_capture.py、test_quota_turn_envelope_validation_failure.py):134 passed, 0 failed; - 4 份公开 smoke(
todo-durability-fixture-smoke.py、explore-result-layer-smoke.py、issue-fix-validated-memory-writeback-smoke.py、cli-output-budget-regression-smoke.py)全部通过; ruff check、mypy(17 files)、check_rfc_bilingual.py、loopx check(33 files, 0 errors)及canary premerge全部 19 项 selected 检查(含direct_checks 4/4、python_compile 1/1、catalog_canaries 10/10、risk_profile_smokes 8/8、public_boundary 1/1)0 失败。- 本批未涉及渲染 UI,
visual_review为not_applicable:本次改动仅涉及 CLI、控制面 TypeScript/Python 契约与测试/smoke 脚本(33 个文件中无任何前端/UI 视图路径),不涉及任何前端渲染页面或 UI 视图。(unverified_scope: none)。
- 代码体量与语义对齐:
code_volume为necessary(兼容边界retain),change_proportionality为proportionate,未新增状态枚举、协议版本或隐式权限。
English verdict: APPROVE — Head 5b5449e resolves both prior P1 attachCompleteTurnContext / attach_complete_turn_context integrity bugs with focused regression tests and passes all local control-plane TS, pytest, smoke, lint, typecheck, and public-boundary checks.
* fix(cli): preserve typed runtime diagnostics in Turn failures Signed-off-by: LoopX Agent <[email protected]> * feat(steward): support per-endpoint model preferences and Codex-to-Antigravity failover (#9141) Signed-off-by: LoopX Agent <[email protected]> * Keep the prepared Chat adapter available to a retry (#9134) A failed worker start can finish cleanup after a same-turn retry has selected the adapter. Keep its lifetime tied to the Session and let failed dispatch release its own worker registration. The regression asserts one upstream turn and explicit adapter closure with the Session. Port the fix from 4453e4bdd77486ec14b952f88ca893310b32e26c. (cherry picked from commit 173e42b4f051b885c3a3389e1cad9c5722f7b7dd) Signed-off-by: LoopX Agent <[email protected]> * fix(steward): recover zero-effect monitors and cleared-replan reports (#9143) Signed-off-by: LoopX Agent <[email protected]> * fix(steward): admit flexible_primary_available executor transitions in conversation_scope (#9145) Signed-off-by: LoopX Agent <[email protected]> * Verify quota gate scope through signed lane references (#9101) * test(quota): verify scoped gates through complete lane references Signed-off-by: LoopX Agent <[email protected]> * Test canonical quota gates in both public response modes Signed-off-by: LoopX Agent <[email protected]> --------- Signed-off-by: LoopX Agent <[email protected]> * Test C1 planning and Host input from the original quota capture (#9102) * Use recorded quota decisions in the no-Todo settlement regression Signed-off-by: LoopX Agent <[email protected]> * Exercise the complete Host prompt from the captured quota source Signed-off-by: LoopX Agent <[email protected]> --------- Signed-off-by: LoopX Agent <[email protected]> * Prepare the CLI budget baseline with a private Git index (#9103) Signed-off-by: LoopX Agent <[email protected]> * Exercise C1 Goal delivery and bound replan from the saved source (#9104) Signed-off-by: LoopX Agent <[email protected]> * Keep long claim overlap scopes on demand (#9086) * Link long thin-claim overlap lists to their receipts Signed-off-by: LoopX Agent <[email protected]> * Read claim overlap details without copying the lease Signed-off-by: LoopX Agent <[email protected]> --------- Signed-off-by: LoopX Agent <[email protected]> * fix(quota): preserve explicit Monitor Todo selection (#9099) Carry Todo selection provenance into quota admission. Preserve explicit secondary Monitor polling and recovery from previously admitted receipts. Signed-off-by: LoopX Agent <[email protected]> * Keep ready Todo scope details on the required context read (#9106) Signed-off-by: LoopX Agent <[email protected]> * Fix archive rollback with custom install directories (#9066) * refactor(core): defer benchmark implementations during capability discovery Preserve the benchmark toolkit public exports and static types while keeping execution and experiment implementations out of metadata discovery. Qualify source and installed Core paths, and reconcile the paired minimal/Standard RFC boundary without changing activation or authority defaults. Signed-off-by: cicolord <[email protected]> * Defer Yardstick evaluation until an enabled Explore read Signed-off-by: cicolord <[email protected]> * Omit empty Todo summary lanes from ordinary Worker context Signed-off-by: cicolord <[email protected]> * fix(update): honor configured archive directories during rollback Signed-off-by: LoopX Agent <[email protected]> * fix(lark): replay recall guard on current main Signed-off-by: huangruiteng <[email protected]> * docs: record the verified LoopX 2.3.0 release baseline Signed-off-by: LoopX Agent <[email protected]> * Preserve quota spend source when prepared work is admitted Signed-off-by: LoopX Agent <[email protected]> * test(quota): qualify native saved complete-Turn checkpoints Signed-off-by: LoopX Agent <[email protected]> * Retry cleanup of an owned file mutation marker Signed-off-by: LoopX Agent <[email protected]> * Keep synthetic Git-path test data outside the public source scan Signed-off-by: LoopX Agent <[email protected]> * fix(quota): share native preparation wait with readiness Signed-off-by: LoopX Agent <[email protected]> * fix(doctor): bind package update readback to its Python environment Signed-off-by: LoopX Agent <[email protected]> * Keep Doctor discovery separate from service activation Signed-off-by: LoopX Agent <[email protected]> * Verify the recorded Python launcher before Doctor probes it Signed-off-by: LoopX Agent <[email protected]> * fix(desktop): require runtime qualification for macOS preview updates Signed-off-by: LoopX Agent <[email protected]> * fix(quota): reuse replan projection owners during recovery Signed-off-by: LoopX Agent <[email protected]> * Qualify Codex 0.169 native context replay on main Signed-off-by: LoopX Agent <[email protected]> * Stop regenerating retired quota view aliases Signed-off-by: LoopX Agent <[email protected]> * fix: pin deferred native context reads to the original capture Signed-off-by: LoopX Agent <[email protected]> * Keep native capture navigation within small output budgets Signed-off-by: LoopX Agent <[email protected]> * Retire legacy heartbeat work prompt generation Signed-off-by: LoopX Agent <[email protected]> * Capture C1 composition failures as receipt diagnostics Signed-off-by: LoopX Agent <[email protected]> * Recover interrupted native Todo readiness from the original Turn Signed-off-by: LoopX Agent <[email protected]> * Revalidate the original lease before publishing resumed native context Signed-off-by: LoopX Agent <[email protected]> * Fence native readiness publication with the canonical lease writer Signed-off-by: LoopX Agent <[email protected]> * fix(scheduler): keep Codex fallback on the original C1 runtime Signed-off-by: LoopX Agent <[email protected]> * fix(scheduler): pin the originating fallback launchers Signed-off-by: LoopX Agent <[email protected]> * Retire the duplicate Codex App scheduler projection Signed-off-by: LoopX Agent <[email protected]> * Seed the recorded scheduler profile in the elapsed-backoff fixture Signed-off-by: LoopX Agent <[email protected]> * Verify canonical cadence on refused and settled Turns Signed-off-by: LoopX Agent <[email protected]> * Pin named Core commands in saved scheduler fallbacks Signed-off-by: LoopX Agent <[email protected]> * fix(research): preserve saved case addresses when a version cannot open Signed-off-by: LoopX Agent <[email protected]> * Preserve citation focus after a saved study refresh Signed-off-by: LoopX Agent <[email protected]> * Capture authenticated LoopX receipts for Research attention (#8790) * feat(research): capture authenticated LoopX attention receipts Signed-off-by: lusendong.6789 <[email protected]> Co-authored-by: TRAE CLI <[email protected]> * fix(research): tighten attention receipt provenance Signed-off-by: lusendong.6789 <[email protected]> Co-authored-by: TRAE CLI <[email protected]> * fix(research): publish attention captures after source validation Signed-off-by: huangruiteng <[email protected]> --------- Signed-off-by: lusendong.6789 <[email protected]> Signed-off-by: huangruiteng <[email protected]> Co-authored-by: TRAE CLI <[email protected]> Co-authored-by: huangruiteng <[email protected]> * Recover the original Session and Turn from a confirmed Chat task Signed-off-by: huangruiteng <[email protected]> * perf(lark,native_chat): eliminate redundant full-directory JSON reparsing in steward chat loops (#9041) * perf(lark,native_chat): avoid full directory reparsing in steward chat loops - Make LarkOwnerAttention._route iterate capture candidates lazily so matching stops at the newest valid p2p capture. - Reuse FileChatDiscovery in PrivateIngressObserver._records while preserving strict field validation and fail-closed errors. - Reuse FileChatDiscovery in ChatExternalConversations.pending so unchanged request journals skip redundant JSON reads and stay mutation-isolated. - Add regression and scan-efficiency tests in tests/test_lark_steward_directory_scan_perf.py. Signed-off-by: LoopX Agent <[email protected]> * fix(native-chat): project small recovery metadata fields to stop data_url memory growth Signed-off-by: LoopX Agent <[email protected]> --------- Signed-off-by: LoopX Agent <[email protected]> * Retire transitional smoke checks and duplicate execution (#9073) Signed-off-by: lusendong.6789 <[email protected]> Co-authored-by: TRAE CLI <[email protected]> * feat(steward): support probe-gated generic continuous_monitor todos with handoff and user actions (#9074) Signed-off-by: LoopX Agent <[email protected]> * Remove redundant defensive prose from prompts and comments (#9072) Remove redundant defensive prose while preserving published heartbeat wrappers and externally managed skill readiness. Validated with 197 related tests, independent historical wrapper migrations and negative cases, installed-skill readback, and current-main quick canary. Existing CI qualification and infrastructure limitations remain recorded in PR #9072. Signed-off-by: lusendong.6789 <[email protected]> Signed-off-by: Lusen Dong <[email protected]> * Keep original Chat retry errors visible during receipt refresh Signed-off-by: LoopX Agent <[email protected]> * fix(steward): tolerate report validator python drift and allow cancel of mid-turn failed reports (#9077) Signed-off-by: LoopX Agent <[email protected]> * feat(steward): add exact-head PR review signals and protected merge confirmation (#9081) Signed-off-by: LoopX Agent <[email protected]> * feat(steward): add isolated OpenViking long-term memory with per-speaker boundaries (#9083) Signed-off-by: LoopX Agent <[email protected]> * refactor(content-ops): slim surface module and eliminate Any (#8961) * refactor(content-ops): slim surface module and eliminate Any Signed-off-by: LoopX Agent <[email protected]> * fix(content-ops): reject malformed angle source_item_ids containers Signed-off-by: LoopX Agent <[email protected]> --------- Signed-off-by: LoopX Agent <[email protected]> * fix(collaboration): batch handoff query Goal lifetime guard lock per Goal (#9085) Signed-off-by: LoopX Agent <[email protected]> * fix(hosts): raise managed service startup readiness timeout to 45s (#9087) Signed-off-by: LoopX Agent <[email protected]> * perf(manager-context): memoize history_inspect lifecycle checks and scope runtime revision in handoffs query (#9088) Eliminate the remaining O(N) Effect runtime RPCs and uncached runtime fingerprinting inside tracking.query(): enter effect_runtime_request_scope() for the query, memoize pure history_inspect lifecycle decisions across entries sharing identical Goal refs while holding the Goal lifetime guard, lazily discover legacy ingress files only when external audience recovery needs them, and preserve entry scan order across Goal batches. Signed-off-by: LoopX Agent <[email protected]> * refactor(lark): slim private_conversations below 2000 lines with net LOC reduction (#8929) Signed-off-by: LoopX Agent <[email protected]> * perf(chat,hosts): skip frontend source re-hashing on immutable installed releases and extend readiness timeout to 90s (#9089) Signed-off-by: LoopX Agent <[email protected]> * refactor(control-plane): split and slim quota monitor_poll_commit (#8885) * refactor(control-plane): split and slim quota monitor_poll_commit Signed-off-by: LoopX Agent <[email protected]> * fix(control-plane): preserve legacy lane budget and observation diagnostic order Signed-off-by: LoopX Agent <[email protected]> --------- Signed-off-by: LoopX Agent <[email protected]> * refactor(quota): slim loopx/quota.py and tighten Any count to zero (#8939) Signed-off-by: LoopX Agent <[email protected]> * refactor(native-chat): slim external_conversations below 2k lines and retire ceiling (#8911) * refactor(native-chat): move steward commission mixin to steward_commands and retire external_conversations ceiling Signed-off-by: LoopX Agent <[email protected]> * fix(native-chat): respect include_raw_response in retained result recovery Signed-off-by: LoopX Agent <[email protected]> --------- Signed-off-by: LoopX Agent <[email protected]> * refactor(chat): slim chat_runtime below 1,500 lines, fix entry-point project_contexts guard, and retire ceiling (#8920) * refactor(chat): move session lifecycle mixin to session_open, deduplicate runtime helpers, and retire ceiling Signed-off-by: LoopX Agent <[email protected]> * fix(chat): drop turn_done_events slot before waking waiters on Thread.start failure Signed-off-by: LoopX Agent <[email protected]> --------- Signed-off-by: LoopX Agent <[email protected]> * fix(steward): paginate open PR signal GraphQL, allow signal-unavailable monitor recovery, and cache private delivery scans (#9093) Signed-off-by: LoopX Agent <[email protected]> * perf(lark,native_chat): back off noop recovery retries and cache recovery lookups (#9096) Signed-off-by: LoopX Agent <[email protected]> * perf(native_chat,lark): cache unchanged quota backlog health and interrupt observations (#9098) Signed-off-by: LoopX Agent <[email protected]> * perf(lark,native_chat): coalesce listener snapshots and cache recovery event summaries (#9100) Signed-off-by: LoopX Agent <[email protected]> --------- Signed-off-by: cicolord <[email protected]> Signed-off-by: LoopX Agent <[email protected]> Signed-off-by: huangruiteng <[email protected]> Signed-off-by: lusendong.6789 <[email protected]> Signed-off-by: Lusen Dong <[email protected]> Co-authored-by: cicolord <[email protected]> Co-authored-by: huangruiteng <[email protected]> Co-authored-by: Lusen Dong <[email protected]> Co-authored-by: TRAE CLI <[email protected]> * refactor(issue-fix): consolidate maintainer-correction admission and slim pr_lifecycle (#8897) Signed-off-by: LoopX Agent <[email protected]> * Fix truncated requests and responses in the Codex API relay (#8713) * fix(codex relay): fence incomplete model requests before drain Signed-off-by: LoopX Agent <[email protected]> * fix(codex relay): surface incomplete upstream responses Port the verified response framing fix to the request-admission branch. Original candidate 27bc3aee311cdfc6a00466ff9d3b58c7db36e01b. Signed-off-by: LoopX Agent <[email protected]> * Bound Codex relay writes to clients that stop reading Signed-off-by: LoopX Agent <[email protected]> * Reject upstream chunked responses missing the trailer terminator Signed-off-by: LoopX Agent <[email protected]> * Validate upstream chunk data delimiters before relay completion Signed-off-by: LoopX Agent <[email protected]> --------- Signed-off-by: LoopX Agent <[email protected]> * fix(release): repair dsh closeout test, antigravity failover alias, and release download retry (#9147) Signed-off-by: LoopX Agent <[email protected]> * docs(release): update v2.4.0 release notes and dsh-loopx-plugin 0.1.1-beta.7 README (#9149) Signed-off-by: LoopX Agent <[email protected]> * fix(chat): recover saved answers and diagnose lost workers (#9120) * fix(chat): recover saved answers and diagnose lost workers Signed-off-by: LoopX Agent <[email protected]> * style(lark): keep private_conversations within module line budget Signed-off-by: LoopX Agent <[email protected]> * fix(chat): retain execution_worker_exited in pending backlog count Signed-off-by: LoopX Agent <[email protected]> --------- Signed-off-by: LoopX Agent <[email protected]> * fix(chat): resume steward requests lost before dispatch (#9125) Signed-off-by: LoopX Agent <[email protected]> * fix(benchmark): restore frozen v1 archives and align checkpoint/runtime tests with C1 defaults (#9151) Signed-off-by: LoopX Agent <[email protected]> * fix(release): stabilize CLI help, architecture guards, onboarding gate, and public smokes (#9152) Signed-off-by: LoopX Agent <[email protected]> * fix(steward): recover report selection across python upgrades and prevent queue kill on observation monitors (#9155) Signed-off-by: LoopX Agent <[email protected]> * fix(release): align extensions, chat, presentation, and transport tests for v2.4.0 (#9156) Signed-off-by: LoopX Agent <[email protected]> * fix(control-plane): stabilize v2.4.0 quota, turn-envelope, and capabilities slice (Slice B1) (#9154) * fix(control-plane): stabilize v2.4.0 quota, turn-envelope, and capabilities slice Signed-off-by: LoopX Agent <[email protected]> * fix(quota): preserve tokenless identity and exact numeric types in attach_complete_turn_context Signed-off-by: LoopX Agent <[email protected]> --------- Signed-off-by: LoopX Agent <[email protected]> * fix(steward): recover frozen report contract failures and rebind resumed task leases (#9157) Signed-off-by: LoopX Agent <[email protected]> * fix(steward): recover pre-dispatch runtime failures across endpoints and stop receipt-unknown disk churn (#9159) Signed-off-by: LoopX Agent <[email protected]> * fix(control_plane): align lease recovery, settlement readback, and runtime fixtures (#9158) * fix(control_plane): align lease recovery, settlement readback, and runtime fixtures Signed-off-by: LoopX Agent <[email protected]> * fix(control_plane): forward record_capture in worker outage test and harden version type guard Signed-off-by: LoopX Agent <[email protected]> --------- Signed-off-by: LoopX Agent <[email protected]> * fix(control-plane): stabilize v2.4.0 explore, context, and checkpoint tail slice (Slice B4) (#9161) Signed-off-by: LoopX Agent <[email protected]> * fix(control-plane): stabilize v2.4.0 replan, monitor recovery, and staged-read slice (Slice B5) (#9160) Signed-off-by: LoopX Agent <[email protected]> * docs(release): reconcile final v2.4.0 stabilization PRs and boundary wording (#9162) * docs(release): reconcile final v2.4.0 stabilization PRs and boundary wording Signed-off-by: LoopX Agent <[email protected]> * docs(release): align #9158 and #9161 descriptions with verified commits Signed-off-by: LoopX Agent <[email protected]> --------- Signed-off-by: LoopX Agent <[email protected]> * fix(steward): tolerate minor JSON delimiter glitches and recover saved report candidates (#9164) Signed-off-by: LoopX Agent <[email protected]> * fix(control-plane): preserve bound yardstick reversals in native replan openings (#9165) Signed-off-by: LoopX Agent <[email protected]> * fix(native-chat): recover loopback relay 401 failures and isolate test auth (#9167) Signed-off-by: LoopX Agent <[email protected]> --------- Signed-off-by: LoopX Agent <[email protected]> Signed-off-by: cicolord <[email protected]> Signed-off-by: huangruiteng <[email protected]> Signed-off-by: lusendong.6789 <[email protected]> Signed-off-by: Lusen Dong <[email protected]> Co-authored-by: cicolord <[email protected]> Co-authored-by: huangruiteng <[email protected]> Co-authored-by: Lusen Dong <[email protected]> Co-authored-by: TRAE CLI <[email protected]>
Summary (v2.4.0 Control Plane, Capabilities, CLI & Smoke Stabilization — Slice B1)
Fixes genuine control-plane/CLI regressions and updates outdated suite/smoke expectations for shipped LoopX v2.4.0 contracts (
loopx_turn_envelope_v1,#9084undeclared JSON quota packet,#8794prior-turn closeout, and2f4c4e92c3hard-lease fencing), plus fixes both P1attachCompleteTurnContextfindings from exact-head review#pullrequestreview-5999390771.Core Production Fixes
loopx/control_plane/quota/turn_envelope.ts,loopx/control_plane/quota/turn_envelope.py,loopx/cli_commands/quota.py,loopx/cli_commands/quota_result_delivery.py,loopx/cli_commands/quota_reward_memory.py):sealCompleteTurnDecisioninturn_envelope.tsand addedattachCompleteTurnContext/attach_complete_turn_contextsoattach_reward_memory_recall_after_should_runattaches validated context fields cleanly aftercompose_quota_work_contractwithout corrupting sealedsource_decision_hash/content_hashsignatures.turn_envelope.ts): PasscombinedTokens(array[]when empty, neverundefined) tocontextSourceIdentity(source, combinedTokens)so tokenless decisions produce the same identity envelope ascomposeCompleteTurnDecisionandrequireCompleteTurnDecision(fixesquota should-run --context-delivery auto).turn_envelope.ts,turn_envelope.py): DiffcontextProjectionChangesagainst{...payload, ...additions}inevaluateTurnEnvelopeand apply edits on{**source, **additions}in Pythonattach_complete_turn_contextsocontext_additionsnever roundtrips through JS numbers (preserving exactfloat(1.0)and arbitrary-precisionintsuch as2**80).loopx/cli_commands/quota_presentation.py,loopx/cli_commands/quota_should_run.py):UNDECLARED_JSON_COMPLETE_TURN_OPTIONSandis_undeclared_json_quota_caller(args, scheduler_context)inquota_presentation.pyand applied the same predicate inquota_should_run.py(model_readandcomplete_context) so undeclared JSON callers stay on the public quota packet instead of requesting Complete Turn context.loopx/cli_commands/quota_context.py,loopx/cli_commands/quota_request.py):getattrdefaults for optional CLI flags so partialargparse.Namespaceinvocations validate cleanly withoutAttributeError.loopx/cli_commands/turn_decision.py,loopx/control_plane/collaboration/delegation.ts):iteration_context_policy/session_scopefor Codexrequest_subjecthost launches incurrent_turn_host_launch_decision.selection_required,action_portfolio_ref,suggested_action_count) when building delegation request packets indelegationRequestDecision.loopx/control_plane/quota/execution_preparation.py,loopx/control_plane/quota/settlement_cli.py):apply_selected_todo_execution_preparationandquota_rollout_details(delivery_admitted) when an activescoped_user_gate_fallbackis admitted viaobligation["delivery_allowed"] is True.Updated Tests & Public Smokes
tests/control_plane_ts/turn_envelope.test.ts&tests/control_plane/test_quota_memory_context.py: added regression tests covering tokenlessattach_complete_turn_contextroundtrip,float(1.0)+2**80numeric preservation onsource_edits: true, invalid/collision rejections, and livequota should-run --context-delivery auto.examples/control_plane/todo-durability-fixture-smoke.py,examples/explore-result-layer-smoke.py,examples/issue-fix-validated-memory-writeback-smoke.py: updated payload compaction schema expectation, Mermaid node ID assertion, and isolated detached-HEAD recovery fallback without mutating the source checkout.tests/capabilities/test_periodic_report_*.py(4 files) &tests/cli_commands/test_quota_turn_envelope_validation_failure.py: aligned Turn closeout (quota spend-slot), slot spend counts, and partial-namespace validation coverage.tests/control_plane/(10 modified test modules + 16 downstream modules verified green): alignedloopx_turn_envelope_v1shapes, cold-path--include-detail(complete_quota=False), lease-fencing order / proof passing onrefresh, and progressive acceptance references.Verification & Qualification (
HEAD:5b5449e8ca, rebased onorigin/main2049e40cf8)personal-loopx-maintenance):receipt_id=cqr_dd9ce114a7024449de5a,scope_fingerprint=dd9ce114a7024449de5aa72f1c9b9208e8a3d8d688091e85b188c26595ebb77f,decision=pass,receipt_valid=true(0blockers).loopx canary premerge --from-git-diff --git-diff-base origin/main --goal-id personal-loopx-maintenance:ok: true(19/19selected passed,0failures) (direct_checks 4/4,python_compile 1/1,catalog_canaries 10/10,risk_profile_smokes 8/8,public_boundary 1/1,receipt_valid=true).npm run typecheck:control-plane(tsc --project tsconfig.control-plane.json --noEmit): passed (exit 0).npm run test:control-plane(tests/control_plane_ts/*.test.ts):6693 passed, 91 skipped(live PostgreSQL tests skipped cleanly whenDATABASE_URLis absent),0 failed.mypy(pyproject.toml [tool.mypy]):Success: no issues found in 17 source files.ruff check tests loopx/canary loopx/control_plane loopx/domain_packs loopx/presentation loopx/cli_commands:All checks passed!.loopx checkpublic boundary scan across 33 changed files:ok: True,errors=0.5b5449e8ca:tests/control_plane/test_quota_memory_context.py,tests/control_plane/test_quota_decision_capture.py,tests/cli_commands/test_quota_turn_envelope_validation_failure.py:134 passed(0 failed).examples/smokes on5b5449e8ca:todo-durability-fixture-smoke.py,explore-result-layer-smoke.py,issue-fix-validated-memory-writeback-smoke.pyall passed (pluscli-output-budget-regression-smoke.pyinsidecanary premerge).3144369890before adding P1 fix toattachCompleteTurnContext):tests/capabilities/(6 modules incl.test_performance_diagnosis_cli.py) + alltests/cli_commands/:371 passed(0 failed).tests/control_plane/batch A (13 modules):496 passed(0 failed); batch B (13 modules):526 passed, 10 skipped(0 failed).Scope Boundary
tests/extensions/*,tests/presentation/*, roottests/test_*, and the remaining unverifiedtests/control_plane/*tail modules) are intentionally out of scope for Slice B1 and tracked for follow-up slices offorigin/main.