Repository navigation
refactor(infra): share path existence policy - #134630
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 31, 2026, 10:22 PM ET / September 1, 2026, 02:22 UTC. ClawSweeper reviewWhat this changesThe PR consolidates repeated synchronous filesystem path probes into a shared infrastructure helper while retaining each migration and uninstall owner’s surrounding policy. Merge readinessKeep open for normal maintainer review. Current main still contains the duplicated predicate bodies, while the introduced helper preserves their Priority: P3 Review scores
Verification
How this fits togetherLegacy-state migration guards, device identity initialization, Web Push setup, and plugin uninstall planning probe local paths before acting. The shared helper supplies the conservative presence result, and each owning flow decides whether to block, migrate, or continue. flowchart LR
A[Legacy state or plugin path] --> B[Shared path probe]
B --> C{Definite ENOENT?}
C -->|Yes| D[Continue owner flow]
C -->|No or uncertain| E[Owner safety or migration guard]
E --> F[Doctor guidance or protected action]
Before merge
Agent review detailsSecurityNone. PR surfaceSource -50, Tests +24, Other -4. Total -30 across 12 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Technical reviewBest possible solution: Retain one canonical conservative probe and land it after normal maintainer review and exact-head CI complete successfully. Do we have a high-confidence way to reproduce the issue? Not applicable: this PR refactors an existing internal predicate rather than addressing a separately reported user failure. Is this the best way to solve the issue? Yes. A narrow shared helper preserves the exact current predicate while owner-specific source/claim and authorization logic remains at its existing boundaries. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 7779a09c23c4. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
|
Merged via squash.
|
What Problem This Solves
Several runtime, Doctor, Web Push, workspace, device identity, and plugin uninstall paths independently implemented the same conservative filesystem-existence rule. Keeping seven copies made a security-sensitive fail-closed policy easy to drift.
Why This Change Was Made
This consolidates the exact shipped rule in one private infrastructure helper:
lstatSyncsuccess means present, onlyENOENTmeans absent, and every other error remains potentially present. Existing migration and uninstall policy wrappers remain with their owners; no SDK, barrel, config, package, or SQLite surface was added.@openclaw/fs-safewas not reused because its existence helper follows links withstatSyncand treats every error as absence, which would change dangling-symlink andENOTDIRbehavior.User Impact
No intended user-visible behavior change. Operators keep the same fail-closed handling for inaccessible or ambiguous retired state, with one canonical policy instead of seven copies.
Evidence
ENOENT, dangling symlink, and explicitENOTDIR.pathOrClaimExists,legacyMigrationSourceOrClaimMayExist, andpluginUninstallTargetExistsremain as owner policy wrappers.pnpm check:changedandpnpm buildreached the unchanged omittedui/config/*inputs; the clean full-checkout Linux Testbox supersedes those local sparse-only failures.tbx_01m1dasyh85xcdg357tpw3zq5qpassedpnpm buildandpnpm check:changedat exact head5fd6e62d3acde8432d240d3699eb6c04aef78d68: https://github.com/openclaw/openclaw/actions/runs/33460538479. The first changed-file attempt exposed a depth-1origin/maingraft; aftergit fetch --deepen=512 origin mainrestored merge-base131215a34bf4599b7b7b2b858f7ea05948d34774, the unchanged command passed.../codex/codex-rs/cli/src/main.rs:220-245and:2840-2870; unrelated to this filesystem policy.