fix: map EACCES/EPERM to permission denied in pinned writes - #76
fix: map EACCES/EPERM to permission denied in pinned writes#76NanoRisk6 wants to merge 2 commits into
Conversation
normalizePinnedWriteError previously reported every unrecognized write error as "path is not a regular file under root", which misdiagnosed ordinary permission failures (openclaw/openclaw#115920). Map EACCES/EPERM/EROFS/ENOSPC/EISDIR/ENOENT to accurate FsSafeError kinds, and append errno codes on remaining fallbacks.
|
Codex review: needs changes before merge. Reviewed July 30, 2026, 9:37 AM ET / 13:37 UTC. ClawSweeper reviewWhat this changesThe branch maps pinned-write permission, read-only filesystem, space, directory, and missing-file OS errors to specific public Merge readinessThis PR addresses a real pinned-write diagnostic bug and includes credible after-fix local proof, but it still changes documented public error classifications without the required Unreleased compatibility note. Keep it open for that narrow repair before merge. Priority: P2 Review scores
Verification
How this fits togetherPinned writes operate on files whose location and identity were checked under a capability-style filesystem root. When the final operating-system write fails, the error normalizer selects the public error code and message that agents and operators use to diagnose the failure. flowchart LR
A[Caller pinned write] --> B[Root-confined file operation]
B --> C[Operating system write result]
C --> D[Error normalization]
D --> E[Public FsSafeError]
E --> F[Agent or operator diagnosis]
Before merge
Findings
Agent review detailsSecurityNone. Review metrics
Merge-risk optionsMaintainer options:
Copy recommended automerge instructionTechnical reviewBest possible solution: Retain the corrected operational mappings, add a concise Unreleased note describing the changed pinned-write error classifications, and keep the existing focused coverage and real filesystem proof as the regression record. Do we have a high-confidence way to reproduce the issue? Yes, at source level and with credible real-run evidence: a pinned write to an in-root file under a non-writable directory produces EACCES/EPERM and exercises this normalizer. The PR includes a redacted macOS transcript and a reproducible harness for the corrected result. Is this the best way to solve the issue? Mostly yes: distinguishing operational permission failures from path-validation failures is the narrow maintainable fix, and preserving Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against ab933820c089. LabelsLabel justifications:
EvidenceAcceptance criteria:
What 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
HistoryReview history (6 earlier review cycles)
|
After-fix real behavior proofPinned write to an in-root file under a non-writable workspace dir ( PR body updated with the same transcript + repro harness. @clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
denied-path is reserved for denyMutations policy (docs/errors.md). EACCES/EPERM/EROFS are operational I/O failures — same family as ENOSPC. Messages stay clear; codes stay honest.
Semantics fix + new proofCode contract correction (per prior ClawSweeper review):
After-fix real pinned writeWorkspace dir mode Tests: @clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Reporter of openclaw/openclaw#115920 here. This matches the failure we hit in production: an EACCES on an ordinary, in-root regular file (workspace ownership drift) was surfaced as "path is not a regular file under root", which sent our debugging in exactly the wrong direction for a while. The mapping table covers every case we have actually seen (EACCES/EPERM and EROFS in containerized workspaces), and appending the errno to the invalid-path fallback means even an unmapped code stays diagnosable. LGTM from the reporting side. |
What Problem This Solves
Pinned writes that fail with
EACCES/EPERMwere reported as “path is not a regular file under root”. Agents and operators then chase path/symlink bugs instead of fixing permissions. Fixes openclaw/openclaw#115920 (fs-safe error mapping).Why This Change Was Made
normalizePinnedWriteErrornow maps common permission errno values to a clear “permission denied” style message while leaving real path/root failures on their existing messages.User Impact
Permission failures surface as permission failures. Agents stop misdiagnosing ordinary ACL/ownership problems as “not a regular file”.
Evidence
EACCES/EPERMmapping on in-root regular files.Real behavior proof (after-fix)
Local macOS Node v26 — in-root pinned write against a non-writable workspace directory (mode
0555). Paths redacted.Harness (repro):
@clawsweeper re-review
Follow-up fix (semantics)
ClawSweeper correctly flagged that
denied-pathis policy (denyMutations), not OS permissions.Head now maps:
EACCES/EPERM→FsSafeError("helper-failed", "permission denied")·category: operationalEROFS→FsSafeError("helper-failed", "read-only filesystem")ENOSPCunchanged →helper-failedStill not
"path is not a regular file under root".Real behavior proof (after semantics fix)
Local macOS Node — in-root pinned write, workspace dir mode
0555. Paths redacted.Unit:
pnpm exec vitest run test/edge-coverage.test.ts— pass.@clawsweeper re-review