Repository navigation
fix(paths): preserve identity across realpath failures - #130516
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 27, 2026, 3:22 AM ET / 07:22 UTC. ClawSweeper reviewWhat this changesThe branch extracts native-realpath ancestor walking into a shared helper used by agent-directory ownership and Gateway state locking, with tests for failed descendants and symlink or junction aliases. Merge readinessKeep open for human maintainer review. Current main already preserves the stated alias-convergence behavior in two duplicated implementations, so this exact head is a behavior-preserving deduplication and regression-test strengthening rather than a needed production bug fix; the member-authored, Priority: P3 Review scores
Verification
Live VerificationCommand: Result: PASS (completed) Assertions:
How this fits togetherConfigured agent and state-directory paths become canonical filesystem identities before ownership checks and Gateway lock paths are calculated. Both consumers must resolve an existing canonical ancestor and then rebuild any missing descendant path. flowchart LR
A[Configured directory path] --> B[Expand and make absolute]
B --> C[Walk toward existing ancestor]
C --> D[Canonical identity path]
D --> E[Agent ownership registry]
D --> F[Gateway state locks]
Decision needed
Why: The correctness need is already satisfied on main; choosing whether the reduced duplication is worth an additional internal helper is a maintainer scope decision. Before merge
Agent review detailsSecurityNone. PR surfaceSource -15, Tests +111. Total +96 across 6 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Copy recommended automerge instructionTechnical reviewBest possible solution: Merge only if maintainers want the canonical shared helper and its regression coverage; otherwise close this behavior-preserving refactor while retaining the already-correct current-main implementations. Do we have a high-confidence way to reproduce the issue? No current-main bug reproduction is supported: both current-main consumers already continue native-realpath attempts through ancestors and rebuild the missing suffix. The PR's new test guards against a transient branch regression rather than a current-main failure. Is this the best way to solve the issue? No as a production bug fix, because current main already implements the claimed behavior. As a cleanup, the shared helper is a clean way to prevent the two copies from drifting if maintainers choose to retain the refactor. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 5f3324587e40. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
History |
|
@clawsweeper re-review Exact repaired head: |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Merged via squash.
|
* refactor(paths): reuse existing ancestor resolution * fix(paths): preserve identity canonicalization
What Problem This Solves
Fixes an issue where agent-directory ownership and Gateway state locks could treat one aliased path as separate identities when native realpath failed below an existing canonical ancestor.
Why This Change Was Made
The two identity owners now share
resolveIdentityPathViaExistingAncestorSync, which preserves their historical contract: use native realpath, continue climbing after any failure, rebuild the missing suffix after a canonical ancestor resolves, and fall back lexically only after the filesystem root fails. The ordinary fs-safe existing-ancestor helper remains unchanged for all other callers.User Impact
Agent cleanup fencing and Gateway or maintenance locking continue to converge on one identity through symlink or junction aliases, including missing descendants and intermediate realpath failures.
Evidence
2f47db1fb1e09c116cd0cb2794344d7ba3f2d1922 failed, 5 passed).14/14acrosssrc/infra/boundary-path.test.ts,src/agents/agent-dir-registry.test.ts, andsrc/infra/gateway-lock.state-dir.test.ts.+26/-41(net-15); tests:+114/-3.mainhas zero touched-file drift; merge tree is clean, so no rebase is warranted.Linux Testbox
tbx_01m10ypqw4xkfw0xfnwbpqzj972f47db1fb1e09c116cd0cb2794344d7ba3f2d192; remote-fetch sync confirmed.node scripts/run-vitest.mjs src/infra/boundary-path.test.ts src/agents/agent-dir-registry.test.ts src/infra/gateway-lock.state-dir.test.ts3files,14tests,exitCode: 0,runStatus: succeeded.{"provider":"blacksmith-testbox","leaseId":"tbx_01m10ypqw4xkfw0xfnwbpqzj97","exitCode":0,"runStatus":"succeeded","label":"pr-130516-linux-exact"}The delegated command succeeded before Blacksmith stopped the one-shot lease. The backing Actions step may show cancellation during provider-owned teardown; the preserved Crabbox timing receipt is successful.
Native Windows Crabbox
cbx_216932440bdc2f47db1fb1e09c116cd0cb2794344d7ba3f2d192; remote-fetch sync confirmed.v24.20.0archive verified against Node's published SHA-256; repository-pinned pnpm11.22.0.node scripts/run-vitest.mjs src/infra/boundary-path.test.ts src/agents/agent-dir-registry.test.ts src/infra/gateway-lock.state-dir.test.ts3files,14tests,exitCode: 0,runStatus: succeeded.{"provider":"azure","leaseId":"cbx_216932440bdc","runId":"run_0a81329f1411","machineType":"Standard_D4ads_v6","exitCode":0,"runStatus":"succeeded","leaseStopped":true}Final Review
153successful,53skipped,1neutral, zero failed or pending checks.@openclaw/fs-safe0.5.6inspection and cross-platform proof.