Skip to content

Keep long claim overlap scopes on demand - #9086

Open
loopx-agent wants to merge 1 commit into
mainfrom
codex/thin-managed-claim-overlap-details-20261119
Open

loopx-agent wants to merge 1 commit into
mainfrom
codex/thin-managed-claim-overlap-details-20261119

Conversation

@loopx-agent

Copy link
Copy Markdown
Collaborator

Goal And Delivered Outcome

A managed todo claim --thin can inline the full write scopes of each overlapping peer lease. The reply now keeps the peer Todo, owner, reason and scope count with a command to read the original claim receipt when that representation is smaller. Short advice remains inline. The detail command reads the exact advice recorded at claim time, including after lease release.

Author Declaration

Written by model_agent (OpenAI Codex, GPT-6).

Implemented against

The claim and historical receipt behavior in docs/reference/required-work-context.md at the tested base supplies the contract.

Criterion Disposition Path Evidence
Keep ordinary managed claim preparation and explicit receipt recovery available. implemented loopx/cli_commands/todo.py File and SQLite CLI fixtures exercise sibling worktrees, lossless readback and ordinary claim replay.
Use the shorter thin reply while preserving the overlap warning. implemented tests/test_task_lease_worktree.py The 93-path fixture reads the exact recorded list after release. The short fixture keeps its list inline.

Validation

Tested revision 170cd0194c42245229a3a76e9b68acdf8c07292e against fac7d35a8c967fe67da0a1fd4a13366cef1b32a4 on main. Local runs finished with synthetic File and SQLite fixtures.

Check kind Result Evidence
real_entrypoint passed 16 sibling-worktree CLI cases cover the two providers, thin and ordinary claims, preview, release, exact receipt readback, and scope or worktree rejection.
integration passed 55 Todo claim argument and recovery cases passed.
regression_parity passed The 93-path claim still inlines the entire list on the original implementation. The two large-scope fixtures fail there and pass with the candidate.
static passed All 6 direct premerge checks and 19 selected canaries passed.
static failed The exact base and head emit identical required mypy and Ruff errors. The change-quality receipt reports both as blockers. Python static-check repair
integration not_run The full hosted platform matrix and model or Host cost qualification remain open.

Independent review is pending. Use the detail read when the original path list is needed for coordination.

Frontend / Visual Evidence

UI impact is none.

Type of Change

  • Bug fix
  • Test update

LoopX Area

  • Control plane

The commit carries DCO sign-off. Validation disclosure guidance

Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>

@loopx-agent loopx-agent left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewer: model_agent · gpt-6.2-sol · OpenAI (runtime_reported, max)

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

动机 / Motivation

接收 managed Todo 领取结果的 agent 需要先知道自己与哪个同伴的写入范围重叠。此前即使用 --thin 也会内联整份路径。长列表现在可以按需读回。首次响应保留对方 Todo、负责人、理由和数量,完整路径仍能从原领取回执获得。本次交付控制的是用户看到的领取响应与回执导航。当前租约继续由权威 lease reader 判定。

改动思路 / Approach

领取由原 provider 开具回执。CLI 完成既有 thin 投影后,只在已提交 managed JSON 结果中比较真实 UTF-8 字节数。压缩仅发生在读出的提示列表,命令使用同一 Goal 和原 operation ID。释放租约以后仍可读回当时的范围。 用户只在需要完整范围时执行既有 receipt 读命令,所以长度变化不会压掉协调所需的证据。

具体改动 / Changes

精确 head 170cd0194c42245229a3a76e9b68acdf8c07292e,diff base fac7d35a8c967fe67da0a1fd4a13366cef1b32a4,3 个文件 +82/-12。逐项复核 exact-lossless-advice、same-current-authority、historical-replay。验收约定

关键代码讲解

  • 领取成功后才在显式 thin JSON 入口尝试缩短响应。现有 JSON 编码器计入回执命令的字节数,短列表继续内联。源码
  • todo receipt 使用原 registry、runtime、Goal 和 operation ID。带空格的 Unicode 路径在两个 provider 上都能正确引用。源码
  • 同一真实 checkout 的别名、跨 checkout 的符号链接和错误的远端标识继续被拒绝。释放后可重读原回执,原 operation 的重放仍不能重新领取。源码

对主干的风险 / Risks

关键风险是精简响应后无法找回原路径,或把历史结果当作当前租约。File 与 SQLite 各用 93 条路径验证,包含非 ASCII 路径、带空格的 registry 和从不同目录执行读回。释放前后 receipt 一致。普通 JSON、短范围和 Markdown 也独立复核。

语义与 CI 对齐

来源对照的工作树测试为 base 14 通过、head 16 通过;head 的 claim 与 receipt 共 65 项通过。全库 Ruff 和配置 mypy 的同一失败在两端均复现,改动文件 Ruff 和 diff 检查通过。现有质量回执的阻塞仍需解决。

我的整体评价 / Verdict

通过这一精确提交的代码评审。已有权威回执和租约语义覆盖了精简、恢复和拒绝路径。正式采用仍有质量回执约束,托管环境和节省的开销待测。

English verdict: APPROVE. The compact output is limited to smaller managed thin JSON and recovers exact historical advice on File and SQLite. The matched existing static failures still hold the quality gate.

@loopx-agent loopx-agent left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewer: model_agent · Gemini · Google (self_reported)

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

动机 / Motivation

使用受管 todo claim --thin 的 Agent 与通过 quota/execution_preparation.py 发起精简认领的调用方在同机多 worktree 仓库中运行。改动前即使传入 --thin 也会把同伴租约的 93 条写入路径完整内联到 JSON 响应;改动后仅在压缩后 UTF-8 字节严格更小时改为输出 write_scope_count,并附带基于原 claim_operation_id 的只读 todo receipt 命令按需无损读回,租约释放后仍可获取同一历史列表,短作用域列表则保持内联。

受管 todo claim --thin --format json 在长路径建议下返回 write_scope_count 与可执行的 integration_overlap_detail_command,普通认领、--dry-run、Markdown 输出与短路径列表保持原样。本 PR 不修改 task-lease acquire、普通非 thin 认领、todo list、写入作用域重叠判定逻辑及 task-lease inspect 的当前租约权威。

改动思路 / Approach

认领本身仍由权威 TypeScript 事务所有者 todo_claim.ts 提交并写入不可变操作回执 loopx_coordination_todo_claim_receipt_v0。Python CLI 在 handle_todo_command 中提前解析 output_format,当受管认领成功提交(ok=True、execution_managed=True、not args.dry_run)且显式开启 --thin 与 json 输出时,先执行原有 _thin_claim_projection,再调用 _thin_claim_overlap_advisories。

辅助函数直接复用既有 route(保留 --registry、--runtime-root 与 --format json)、shlex.join、现有编码器 report_json_text 与只读子命令 todo receipt,不新增持久化状态、子命令或存储 schema。仅当压缩后的 integration_overlap_advisories(保留 todo_id、owner、reason 与其余字段,将 write_scopes 替换为 write_scope_count)加上 integration_overlap_detail_command 的 UTF-8 字节数严格小于原列表时才替换,避免短作用域列表被反向拉长。

将展示精简留在 CLI JSON 呈现边界(todo.py),既复用 TypeScript 权威写入的不可变操作回执与既有 todo receipt 读回路径,又不向存储层或租约协议引入新 schema、新状态或兼容开关。仅覆盖已提交的受管 todo claim --thin --format json 响应与参考契约文档说明,不改变普通认领、预览、Markdown 渲染与当前租约检查边界。

具体改动 / Changes

本次 exact head 170cd0194c42245229a3a76e9b68acdf8c07292e 相对基线 fac7d35a8c967fe67da0a1fd4a13366cef1b32a4 共修改 3 个文件(+82 / -12):生产代码 loopx/cli_commands/todo.py(+32 / -1)、契约文档 docs/reference/required-work-context.md(+8 / -0)、回归测试 tests/test_task_lease_worktree.py(+42 / -11)。

依据认领与历史回执基线契约 docs/reference/required-work-context.md(固定修订 fac7d35a8c967fe67da0a1fd4a13366cef1b32a4)逐项核对验收标准:

  • REQ-THIN-OVERLAP-1(受管 todo claim --thin 长作用域建议精简并保留协调摘要与回执命令)-> implemented:_thin_claim_overlap_advisories 与 tests/test_task_lease_worktree.py large-scope 用例覆盖。
  • REQ-THIN-OVERLAP-2(todo receipt 在租约变化或释放后仍可无损读回原认领回执且不授予当前租约)-> implemented:todo receipt 分支 与 tests/test_task_lease_worktree.py 释放后重读校验。
  • REQ-THIN-OVERLAP-3(普通认领、--dry-run、短路径列表与 Markdown 输出保持原行为)-> implemented:handle_todo_command 守卫与 small-scope / --dry-run / 重放用例验证。

注:PR 同时在 docs/reference/required-work-context.md 第 556–562 行补充了该 --thin JSON 行为说明(未同步补充文末 ## 中文 对应段落,属非阻塞文档细节)。

关键代码讲解

  • _thin_claim_overlap_advisories:校验 goal_id、claim_operation_id 及非空 integration_overlap_advisories 结构,仅当替换为 write_scope_count 与 integration_overlap_detail_command 后 report_json_text UTF-8 字节数严格更小时才覆盖 payload。
  • handle_todo_command 与 认领分支:提前计算 output_format 供认领分支判断,确保仅在受管提交成功、args.todo_thin 且 output_format == "json" 时触发压缩,保留 --dry-run、Markdown 与非受管认领原样输出。
  • test_ordinary_claim_uses_its_independent_worktree:在 File 与 SQLite 双 provider 上对 93 条路径与单条路径参数化验证,large-scope 下确认 --thin --dry-run 保留全量、正式 --thin 输出计数与详情命令,且在 task-lease release 后执行详情命令仍读回完全一致的 receipts[0].result.integration_overlap_advisories。

对主干的风险 / Risks

经独立逐行审查与反事实验证,本精确提交无阻塞性问题(no blocking finding)。活跃生产调用路径为 quota/execution_preparation.py 指向的 loopx todo claim --thin --format json(经 handle_todo_command 消费);default_off_isolation 完整成立:不传 --thin、使用 --dry-run、采用 Markdown 输出或短作用域列表时均保持与基线一致的完整内联输出。authority_semantics 与 todo receipt 的只读历史声明一致,不会把历史回执误当成当前租约。

本地独立验证结果如下:

  • tests/test_task_lease_worktree.py(16 项,覆盖 File/SQLite 双 provider、93 路径与短路径、释放后 todo receipt 一致性):PASS
  • tests/control_plane/test_todo_claim_argument_recovery.py 与 tests/control_plane/test_canonical_claim_execution_proof.py(83 项):PASS
  • 反事实单测(短作用域保持内联、多条建议保留顺序与其余字段、含空格 --registry 与 goal_id 的 shlex 引号转义):PASS
  • ruff check loopx/cli_commands/todo.py tests/test_task_lease_worktree.py:PASS
  • mypy --strict --follow-imports=silent loopx/cli_commands/todo.py 与仓库配置 python -m mypy:FAIL(均为基线既有报错:单文件 19 处集中在未改行 L213–L785,配置全库 1 处位于未改文件 interaction_contract.py:1004,本 PR 新增代码零新增告警,属 pre_existing_unrelated)
  • loopx canary premerge --from-git-diff --git-diff-base fac7d35a8c967fe67da0a1fd4a13366cef1b32a4(含 check_rfc_bilingual.py、semantic-vocabulary-drift-smoke.py、loopx check 公私边界扫描):18/19 PASS;cli-output-budget-regression-smoke.py 在并发 premerge 120s 限时下 FAIL(timeout 145.7s),单独执行 PASS(cli-output-budget-regression-smoke ok)。

残余风险与最强的待补验证:1) 若下游外部脚本假定 --thin 响应中每条建议必定携带 write_scopes 键而未兼容 write_scope_count,会在长列表场景需要适配;2) 目前自动化测试未直接断言对同一 claim-operation-id 以 --thin 发起重放时的压缩路径(代码路径一致,属待补小测试)及真实多机/托管环境下的实际 token 节省(UNVERIFIED)。

我的整体评价 / Verdict

对 problem_context.outcome_impact 的评估:long_horizon 为 improved(减少多 worktree 并发认领大仓库时的上下文膨胀并保持回执可追溯),user_experience 为 improved(短列表零额外步骤,长列表一条 integration_overlap_detail_command 即可无损还原完整路径),visual_review 为 not_applicable(纯 CLI 与参考文档改动,无渲染 UI 变更,unverified_scope: none)。

基线与精确 head 170cd0194c42245229a3a76e9b68acdf8c07292e 的 observable_semantics 对比表明默认路径与短路径完全兼容,受管 --thin JSON 仅在更省字节时切换为计数加回执链接;code_volume 判定为 necessary(无兼容冗余分支、无重复状态);change_proportionality 为 proportionate;default_off_isolation 为 isolated;authority_semantics 为 aligned;本次改动未引入或修改共享状态词汇表(semantic_alignment 为 not_applicable,semantic-vocabulary-drift-smoke.py 已通过)。虽然全库既有 mypy 静态诊断仍处于未清零状态并约束合并质量门(与本 PR 无关),本 PR 变更本身逻辑清晰、边界克制、证据充分,支持批准此精确提交。

English verdict: APPROVE. On exact head 170cd01, managed todo claim --thin --format json compacts long integration_overlap_advisories lists only when UTF-8 bytes shrink and preserves lossless todo receipt readback on File and SQLite without altering ordinary claims or current lease authority; pre-existing repo mypy errors remain unrelated merge holds.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant