Repository navigation
fix: reject hard-linked files in code-edit worktree leases - #9386
loopx-agent merged 2 commits into
Conversation
loopx-agent
left a comment
There was a problem hiding this comment.
Reviewer: model_agent · gpt-6.2-sol · OpenAI · runtime_reported · xhigh
动机 / Motivation
从独立 Git worktree 领取代码待办的 Agent 需要确认工作目录里的文件确实彼此独立。此前租约检查确认了 checkout 的物理身份,范围内的普通文件仍可能共享底层文件。新头会在观察工作树时拒绝共享文件,并提示使用独立副本。范围涉及工作树绑定的领取和恢复预览。
改动思路 / Approach
链接数检查放在已有的工作树观察器,无需新增租约状态或另一套权限判断。普通文件和直接软链接目标经过同一条单链接要求,随后仍由原有租约入口与规范存储决定是否授予执行权。范围涉及工作树绑定的领取和恢复预览。普通领取会自动发现工作目录,所以它也应在文档中列为受影响的入口。
具体改动 / Changes
核对准确头 9cfa3410b8d8c36f2f3cc3d58d469065dc80d9a2 相对主干合并基线 3c1bb335a09472d29de6c362f02a73797d132f1a 的完整 4 文件,+92/-3。验收项「物理隔离」通过针对观察器的本地验证。「可恢复领取范围」仍有文档偏差。两个租约入口沿用工作树身份的既有存储形状,无浏览器页面变化。 现行工作树租约约定
关键代码讲解
observeLeaseWorktree遍历重叠范围的物理条目,包含 Git 忽略的文件。新判断在创建规范租约前拒绝链接数大于一的普通文件。 工作树观察器requireInternalFileLink保留直接文件软链接的既有规则,读取目标的链接数并单独检查路径约束。 直接软链接观察claimWorkspaceObserver将工作树检查作为普通 managed claim 与恢复入口共享的回调。调用方不必先手动执行独立的租约获取命令。 共享回调
对主干的风险 / Risks
[P2] 中英文恢复说明遗漏了普通 managed claim。 文档将单链接要求限定为显式 task-lease acquire --write-worktree。普通的 todo claim 也会从当前工作目录自动发现候选 worktree,将它送给同一个观察器。带原 claim 引用的过期执行恢复预览也复用此检查。升级后的调用者即使一直使用普通领取,也可能收到新的拒绝,并按当前说明误判适用范围。建议保留共同隔离门,将双语说明改为「所有需要观察代码编辑工作树的领取和恢复预览」,独立命令的错误码限定在该入口。 普通领取自动发现 · 恢复预览调用
语义与 CI 对齐
本地观察器实例验证了不合规文件被拒,替换独立副本后恢复,通过的对照还覆盖窄范围以及合法直接软链接。当前头的 File/SQLite 工作树入口与恢复用例共 16 项通过。 本地 quick premerge 的直接检查通过。维护性 canary 超时,运行器随后在确认进程组退出时失败,原因尚未归因到本 PR。 普通领取和过期预览的链接数分支来自源码调用链核对。尚未单独实跑这两个入口上的新拒绝条件。没有查询远端 CI,Windows、PostgreSQL 和已安装版本也未在本轮验证。
我的整体评价 / Verdict
请求修正双语说明。保留共享观察器和获取时的拒绝行为,同时准确告诉使用普通领取与重试的 Agent 哪些工作树会受影响、遇到拒绝时如何恢复。当前证据支持拒绝规则和独立副本恢复。
English verdict: REQUEST_CHANGES at 9cfa341. The new filesystem check is also used by ordinary managed claims and expired-claim recovery previews. Correct the bilingual recovery instructions so they cover these existing callers.
9cfa341 to
41fe126
Compare
loopx-agent
left a comment
There was a problem hiding this comment.
Reviewer: model_agent · gpt-6.2-sol · OpenAI · runtime_reported · xhigh
动机 / Motivation
使用独立 Git worktree 领取代码任务或恢复过期执行的 Agent,以及需要确认原任务状态的维护者。 原准入验证工作目录、仓库和写入范围的身份。工作目录彼此独立时,仍可能包含共享底层文件,导致独立任务的产物相互影响。
候选在三条需要观察 worktree 的路径上采用同一文件检查。遇到范围内的多链接文件,领取或恢复预览返回拒绝。改用独立文件后,同一任务可按原流程继续。 File 和 SQLite 的显式租约、普通自动发现领取、过期更新与完成恢复在独立文件条件下继续通过。仅请求基础 Todo 租约的旧入口不增加 worktree 字段。 两种本地后端均在领取或恢复前拒绝范围内的多链接文件。普通拒绝不领取任务,过期预览前后读取的 Todo 和两条租约相同,重新领取后才接受原操作重试。
本地源码和隔离 Git 夹具。Windows、真实 PostgreSQL、安装态和远端 CI 未验证。检查只发生于既有观察入口,持续监控和操作系统隔离仍由各自边界负责。 现行工作树租约契约
改动思路 / Approach
同一物理文件不应被当成可独立编辑的两份文件。观察器已有实际文件的 stat 结果,在这里校验链接数可以让各入口采用同一拒绝和恢复要求。 保留一个共享 worktree 观察器,由既有领取和恢复调用它。记录仍由各自的规范提供者写入,恢复预览继续只读。 显式获取继续使用原错误码。普通领取和恢复继续返回各自的原有回执,由原操作者完成修复并重试。相较于分别修改三个入口,这个共享检查覆盖它们的共同条件且无须新增状态。
具体改动 / Changes
核对精确提交 41fe12675567c3b445e44d6006b27e44058e5e4c 相对分叉基线 c82e96141a039d1ab83c0693e8aa274e550d51ff 的完整四文件,+120/-3。原 双语说明问题 已修。当前说明列出普通托管领取和过期恢复预览,并明确只有独立 acquire 使用 invalid_worktree_lease_request。
关键代码讲解
observeLeaseWorktree在已有写入范围内验证普通文件。拒绝发生在领取提交之前。 观察器requireInternalFileLink保留现有直接文件软链接边界,并用相同约束检查目标。 目标检查claimWorkspaceObserver为普通领取与恢复提供同一观察结果,预览仍不能领取任务。 共享回调- cooperative-worktree-isolation。现有物理工作树隔离继续由观察与原租约层共同保证。 定义
- managed-claim-recovery。拒绝后由原 agent 修正工作树,显式获得执行权后重试。 实路径验证
对主干的风险 / Risks
同头复核未发现阻断问题。 同一 checkout 内的多个硬链接也会被拒绝。链接数无法表明其他链接的位置,调用者可换用独立文件后重试。检查在准入时生效,文档明确了这个时间边界。低权限、不同仓库与同一物理 checkout 的原有拒绝仍由现行租约入口决定。
语义与 CI 对齐
File/SQLite 现头 16 项与分叉基线 16 项通过,同一基线测试在候选源码补跑 4 项通过。Node 相关检查最终 107 项通过、4 项 PostgreSQL 跳过,TypeScript 类型与 Ruff 检查通过。 标准预合入首次有两项达到 120 秒运行上限。按准确四文件重跑相同检查,单项执行上限设为 300 秒,5 项直接检查和 15 项所选检查全部通过。保留首次超时记录。当前目标预合入静态合并检查通过。
我的整体评价 / Verdict
APPROVE。 同头复核未发现阻断问题。 拒绝发生在规范记录写入前,申请人可以修正工作区并继续同一个 Todo。拒绝时不会改变 peer 的租约,恢复预览也不会替申请人执行领取。 普通领取和过期恢复原有入口都继续可用。拒绝后的修复动作已写入中英文说明,用户可在同一任务重试。 改变的是 CLI 准入与参考文档,未改变任何渲染页面。 本地源码和隔离 Git 夹具。Windows、真实 PostgreSQL、安装态和远端 CI 未验证。检查只发生于既有观察入口,持续监控和操作系统隔离仍由各自边界负责。
English verdict: APPROVE at 41fe126. The existing worktree observer rejects multiply linked files before a claim is granted. The original claim and recovery paths continue after an independent copy is restored, and the bilingual reference now covers all three callers.
41fe126 to
b91433e
Compare
|
Rebased the author branch onto main Validation at this head passed: 16 real File/SQLite CLI worktree cases, control-plane TypeScript typecheck, and standard diff-scoped premerge with a 300-second per-check limit. The worktree is clean, and no lockfile is included. The previous head's browser, Chat-bundle browser and dashboard browser failures all stopped at the same Current-head CI and renewed exact-head review remain required. The earlier approval belongs to |
b91433e to
f88902b
Compare
|
Synchronized the author branch with target main Current-head validation passed: 16 real File/SQLite CLI worktree cases, 18 TypeScript observer/content-digest cases, control-plane typecheck, Ruff, bilingual diff check and standard diff-scoped premerge. Premerge executed all 6 catalog canaries and 8 selected risk-profile smokes, plus public-boundary and direct checks. The worktree is clean and no lockfile is included. The preceding head's TypeScript CI failed because the pinned content-digest consumer list still named The PR description now names this tested head and preserves these failures. Published prior-head approval does not qualify the rebased head. Renewed exact-head review and applicable validation remain separate gates; no merge has been performed by this follow-up. |
|
Follow-up at unchanged head Independently ran Target main has advanced to #9437 remains open, but this run skipped browser checks under the current CI selection. Its historical browser failure is therefore not the failing job in this run. Renewed exact-head review, the shared kernel validation repair and current merge readiness remain unresolved; no approval, merge or gate bypass was performed in this follow-up. |
Signed-off-by: Duang777 <duangjl007@gmail.com>
Signed-off-by: Duang777 <duangjl007@gmail.com>
f88902b to
6ebc564
Compare
There was a problem hiding this comment.
Reviewer: model_agent · deepseek-flash · DeepSeek · runtime_reported · high
Approval conclusion (author-owned PR; GitHub blocks formal self-approval)
Exact head: 6ebc56477533161ae2ee74574b6e068a31ebfab0
动机 / Motivation
使用独立 Git worktree 领取代码任务或恢复过期执行的 Agent,以及需要确认原任务状态的维护者。 原准入验证工作目录、仓库和写入范围的身份。工作目录彼此独立时,仍可能包含共享底层文件,导致独立任务的产物相互影响。
候选在三条需要观察 worktree 的路径上采用同一文件检查。遇到范围内的多链接文件,领取或恢复预览返回拒绝。改用独立文件后,同一任务可按原流程继续。 File 和 SQLite 的显式租约、普通自动发现领取、过期更新与完成恢复在独立文件条件下继续通过。仅请求基础 Todo 租约的旧入口不增加 worktree 字段。 两种本地后端均在领取或恢复前拒绝范围内的多链接文件。普通拒绝不领取任务,过期预览前后读取的 Todo 和两条租约相同,重新领取后才接受原操作重试。
本地源码和隔离 Git 夹具。Windows、真实 PostgreSQL、安装态和远端 CI 未验证。检查只发生于既有观察入口,持续监控和操作系统隔离仍由各自边界负责。 现行工作树租约契约
改动思路 / Approach
同一物理文件不应被当成可独立编辑的两份文件。观察器已有实际文件的 stat 结果,在这里校验链接数可以让各入口采用同一拒绝和恢复要求。 保留一个共享 worktree 观察器,由既有领取和恢复调用它。记录仍由各自的规范提供者写入,恢复预览继续只读。 显式获取继续使用原错误码。普通领取和恢复继续返回各自的原有回执,由原操作者完成修复并重试。相较于分别修改三个入口,这个共享检查覆盖它们的共同条件且无须新增状态。
具体改动 / Changes
核对精确提交 41fe12675567c3b445e44d6006b27e44058e5e4c 相对分叉基线 c82e96141a039d1ab83c0693e8aa274e550d51ff 的完整四文件,+120/-3。原 双语说明问题 已修。当前说明列出普通托管领取和过期恢复预览,并明确只有独立 acquire 使用 invalid_worktree_lease_request。
关键代码讲解
observeLeaseWorktree在已有写入范围内验证普通文件。拒绝发生在领取提交之前。 观察器requireInternalFileLink保留现有直接文件软链接边界,并用相同约束检查目标。 目标检查claimWorkspaceObserver为普通领取与恢复提供同一观察结果,预览仍不能领取任务。 共享回调- cooperative-worktree-isolation。现有物理工作树隔离继续由观察与原租约层共同保证。 定义
- managed-claim-recovery。拒绝后由原 agent 修正工作树,显式获得执行权后重试。 实路径验证
对主干的风险 / Risks
同头复核未发现阻断问题。 同一 checkout 内的多个硬链接也会被拒绝。链接数无法表明其他链接的位置,调用者可换用独立文件后重试。检查在准入时生效,文档明确了这个时间边界。低权限、不同仓库与同一物理 checkout 的原有拒绝仍由现行租约入口决定。
语义与 CI 对齐
File/SQLite 现头 16 项与分叉基线 16 项通过,同一基线测试在候选源码补跑 4 项通过。Node 相关检查最终 107 项通过、4 项 PostgreSQL 跳过,TypeScript 类型与 Ruff 检查通过。 标准预合入首次有两项达到 120 秒运行上限。按准确四文件重跑相同检查,单项执行上限设为 300 秒,5 项直接检查和 15 项所选检查全部通过。保留首次超时记录。当前目标预合入静态合并检查通过。
当前 exact head 复核 / Rebased-head validation
PR #9386 已无冲突 rebase 到 origin/main 2302e42d9cad35a8a4150e24496ffecfbfdce8cb,当前精确头为 6ebc56477533161ae2ee74574b6e068a31ebfab0。本轮在新 base 上重新执行定向测试、静态检查和 diff 级 premerge。
最终 exact head 复核:16 项 Python worktree lease 测试与 18 项 TypeScript hardlink/content-digest 测试通过;控制面 TS typecheck、Ruff、diff 检查和标准 premerge 的 15 项选定检查全部通过。该 PR 的 fork head 已无冲突变基到最新 main,文件共享 inode 时拒绝、私有复制后恢复的负例均保留。
我的整体评价 / Verdict
APPROVE。 同头复核未发现阻断问题。 拒绝发生在规范记录写入前,申请人可以修正工作区并继续同一个 Todo。拒绝时不会改变 peer 的租约,恢复预览也不会替申请人执行领取。 普通领取和过期恢复原有入口都继续可用。拒绝后的修复动作已写入中英文说明,用户可在同一任务重试。 改变的是 CLI 准入与参考文档,未改变任何渲染页面。 本地源码和隔离 Git 夹具。Windows、真实 PostgreSQL、安装态和远端 CI 未验证。检查只发生于既有观察入口,持续监控和操作系统隔离仍由各自边界负责。
English verdict: APPROVE at 6ebc564. The existing worktree observer rejects multiply linked files before a claim is granted. The original claim and recovery paths continue after an independent copy is restored, and the bilingual reference now covers all three callers.
Superseded by the rebased exact head 6ebc564 and fresh exact-head validation.
loopx-agent
left a comment
There was a problem hiding this comment.
Reviewer: model_agent · deepseek-flash · DeepSeek · runtime_reported · high
Approval conclusion (author-owned PR; GitHub blocks formal self-approval)
Exact head: 6ebc56477533161ae2ee74574b6e068a31ebfab0
动机 / Motivation
使用独立 Git worktree 领取代码任务或恢复过期执行的 Agent,以及需要确认原任务状态的维护者。 原准入验证工作目录、仓库和写入范围的身份。工作目录彼此独立时,仍可能包含共享底层文件,导致独立任务的产物相互影响。
候选在三条需要观察 worktree 的路径上采用同一文件检查。遇到范围内的多链接文件,领取或恢复预览返回拒绝。改用独立文件后,同一任务可按原流程继续。 File 和 SQLite 的显式租约、普通自动发现领取、过期更新与完成恢复在独立文件条件下继续通过。仅请求基础 Todo 租约的旧入口不增加 worktree 字段。 两种本地后端均在领取或恢复前拒绝范围内的多链接文件。普通拒绝不领取任务,过期预览前后读取的 Todo 和两条租约相同,重新领取后才接受原操作重试。
本地源码和隔离 Git 夹具。Windows、真实 PostgreSQL、安装态和远端 CI 未验证。检查只发生于既有观察入口,持续监控和操作系统隔离仍由各自边界负责。 现行工作树租约契约
改动思路 / Approach
同一物理文件不应被当成可独立编辑的两份文件。观察器已有实际文件的 stat 结果,在这里校验链接数可以让各入口采用同一拒绝和恢复要求。 保留一个共享 worktree 观察器,由既有领取和恢复调用它。记录仍由各自的规范提供者写入,恢复预览继续只读。 显式获取继续使用原错误码。普通领取和恢复继续返回各自的原有回执,由原操作者完成修复并重试。相较于分别修改三个入口,这个共享检查覆盖它们的共同条件且无须新增状态。
具体改动 / Changes
核对精确提交 41fe12675567c3b445e44d6006b27e44058e5e4c 相对分叉基线 c82e96141a039d1ab83c0693e8aa274e550d51ff 的完整四文件,+120/-3。原 双语说明问题 已修。当前说明列出普通托管领取和过期恢复预览,并明确只有独立 acquire 使用 invalid_worktree_lease_request。
关键代码讲解
observeLeaseWorktree在已有写入范围内验证普通文件。拒绝发生在领取提交之前。 观察器requireInternalFileLink保留现有直接文件软链接边界,并用相同约束检查目标。 目标检查claimWorkspaceObserver为普通领取与恢复提供同一观察结果,预览仍不能领取任务。 共享回调- cooperative-worktree-isolation。现有物理工作树隔离继续由观察与原租约层共同保证。 定义
- managed-claim-recovery。拒绝后由原 agent 修正工作树,显式获得执行权后重试。 实路径验证
对主干的风险 / Risks
同头复核未发现阻断问题。 同一 checkout 内的多个硬链接也会被拒绝。链接数无法表明其他链接的位置,调用者可换用独立文件后重试。检查在准入时生效,文档明确了这个时间边界。低权限、不同仓库与同一物理 checkout 的原有拒绝仍由现行租约入口决定。
语义与 CI 对齐
File/SQLite 现头 16 项与分叉基线 16 项通过,同一基线测试在候选源码补跑 4 项通过。Node 相关检查最终 107 项通过、4 项 PostgreSQL 跳过,TypeScript 类型与 Ruff 检查通过。 标准预合入首次有两项达到 120 秒运行上限。按准确四文件重跑相同检查,单项执行上限设为 300 秒,5 项直接检查和 15 项所选检查全部通过。保留首次超时记录。当前目标预合入静态合并检查通过。
当前 exact head 复核 / Rebased-head validation
PR #9386 已无冲突 rebase 到 origin/main 2302e42d9cad35a8a4150e24496ffecfbfdce8cb,当前精确头为 6ebc56477533161ae2ee74574b6e068a31ebfab0。本轮在新 base 上重新执行定向测试、静态检查和 diff 级 premerge。
最终 exact head 复核:16 项 Python worktree lease 测试与 18 项 TypeScript hardlink/content-digest 测试通过;控制面 TS typecheck、Ruff、diff 检查和标准 premerge 的 15 项选定检查全部通过。该 PR 的 fork head 已无冲突变基到最新 main,文件共享 inode 时拒绝、私有复制后恢复的负例均保留。
我的整体评价 / Verdict
APPROVE。 同头复核未发现阻断问题。 拒绝发生在规范记录写入前,申请人可以修正工作区并继续同一个 Todo。拒绝时不会改变 peer 的租约,恢复预览也不会替申请人执行领取。 普通领取和过期恢复原有入口都继续可用。拒绝后的修复动作已写入中英文说明,用户可在同一任务重试。 改变的是 CLI 准入与参考文档,未改变任何渲染页面。 本地源码和隔离 Git 夹具。Windows、真实 PostgreSQL、安装态和远端 CI 未验证。检查只发生于既有观察入口,持续监控和操作系统隔离仍由各自边界负责。
English verdict: APPROVE at 6ebc564. The existing worktree observer rejects multiply linked files before a claim is granted. The original claim and recovery paths continue after an independent copy is restored, and the bilingual reference now covers all three callers.
Two independent Git worktrees can contain hard links to the same file. Worktree admission previously accepted these files as isolated even though an ordinary write in one checkout changed the other checkout's bytes.
The existing TypeScript observer now rejects multiply linked regular files within declared write scopes, including direct symlink targets. This covers standalone
task-lease acquire --write-worktree, ordinary managedtodo claimwith automatic worktree discovery and expired-claim recovery previews. Standalone acquisition returnsinvalid_worktree_lease_request; claim and recovery retain their existing rejection responses. Replacing the hard link with an independent copy restores admission. The bilingual lease reference describes all three entrypoints and recovery.The owning boundary is cooperative code-edit worktree isolation. The check runs during admission and does not prevent later filesystem changes. It conservatively rejects hard links whose aliases are entirely inside the checkout too. Out-of-scope hard links, single-link files and permitted direct file symlinks remain accepted. Standalone acquisition without
--write-worktree, provider defaults and persisted schemas retain their existing behavior.The author branch is synchronized with target main
2d6e80a76791951071d82e9e6e7c205d9d853b7a. Headf88902b854f29b403d8f31a07ba9e24634dad5b4retains the same four-file repair and both DCO sign-offs. It incorporates main's latest lease recovery guidance and TTL defaults without introducing either change in this PR.Validation at this head:
Historical evidence: before the fix, the two-worktree regression demonstrated shared inode identity and cross-checkout mutation, then failed because admission did not reject the link. The File CLI regression also failed because acquisition unexpectedly succeeded. Earlier lease validation passed 107 TypeScript cases with 4 PostgreSQL cases skipped, plus standard premerge.
The preceding head's browser CI still failed at the obsolete deferred-reason label in
chat-recovery. The existing fix is #9437, which has not merged. Applying only that fix to an isolated main checkout previously made the complete packaged scenario pass. The same head's kernel-contract job reported 52 Python typing errors in 7 files outside this PR's diff. A diagnostic rerun ofpython -m mypyat the new head reported 3939 errors in 392 files while traversing imports from the configured 17 source files. This broader result is not a reproduction of the old error count or evidence about the new CI job selection. No Python production module is changed by this PR. These failures remain recorded rather than counted as passing validation.This is a source-tested proposal. Windows and installed-product behavior were not exercised locally. The published approval predates this rebased head and does not qualify it. Maintainer review and current-head validation remain separate from merge authorization.
Current-head CI follow-up: all three TypeScript shards and coverage passed.
kernel-contractsfailed with 3939 typing errors in 392 files, causing aggregate checks and merge-gate failures. Fresh, independentpython -m mypy --no-incrementalruns on clean target baseline2d6e80a76and candidatef88902b85produced byte-for-byte identical diagnostics. This confirms the shared baseline failure without attributing it to this repair. Browser checks were skipped in this run; #9437 remains an open historical browser repair. Latest target main06941016ehas no overlapping changed paths, and a merge-tree preview combines it with this head without conflicts. The combined tree has not been independently validated.