Skip to content

fix: restore POSIX Root lock error normalization - #1081

Merged
steipete merged 3 commits into
mainfrom
fix/root-lock-error-normalization
Nov 8, 2026
Merged

steipete merged 3 commits into
mainfrom
fix/root-lock-error-normalization

Conversation

@steipete

@steipete steipete commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

Problem

The crash-safe sidecar publication path introduced in 0.28.0 bypasses the existing POSIX Root write-error normalizer. Root-backed lock acquisition therefore exposes raw EACCES/EIO errors where 0.27.1 and 0.27.2 return FsSafeError with the compatibility invalid-path code and the original error in cause. This breaks OpenClaw's lock acquisition failure handling and ownership tests.

Change

Route POSIX async Root sidecar failures through the existing normalizer. Keep Windows fallback error identity, raw and sync lock paths, classified policy errors, and post-publication verification behavior. This changes no public API, lock publication, ownership admission, or cleanup authority.

Regression tests cover exclusive-open and write failures through public Root/lock APIs, the established Windows and raw-lock contracts, directory persistence failure, and a combined persistence/cleanup failure that retains the cause graph and orphan stage without retrying acquisition.

Validation

  • Published-package bisect: 0.27.1 and 0.27.2 wrap the same injected errors; 0.28.0 returns them raw. The initial regression test failed on the two Root-lock cases before the source fix.
  • Focused lock/error suites: 151 tests passed; the added persistence/cleanup regression and directory suite passed 30 tests. The final publication suite passed 35 tests with 4 platform-specific skips.
  • Independent Codex autoreview of the full final change: clean through P2.
  • pnpm check completed build, WASM allocator and documentation checks; the full test run recorded 14,460 passes, 317 failures and 4,514 skips. Of the failures, 314 were temporary-workspace fixtures correctly rejecting a 0775 nonsticky ancestor on the selected external volume. Rerunning only the 31 failed files with macOS's normal private temporary directory left just the 3 obsolete raw-error assertions, which this change updates. The final affected publication file then passed. Native-specific cases are left to hosted CI; this source change is confined to the JavaScript fallback error path.
  • pnpm pack:check and git diff --check passed.

@clawsweeper

clawsweeper Bot commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@steipete
steipete marked this pull request as ready for review November 8, 2026 01:11
@steipete
steipete requested a review from a team as a code owner November 8, 2026 01:11
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 8, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-08T01:22:30.371049Z e4fb6ee New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P2 Normal priority bug or improvement with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 8, 2026
@clawsweeper

clawsweeper Bot commented Nov 8, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR restores normalized POSIX async Root lock errors while preserving Windows fallback error identity.

Example: On POSIX with native mode off, creating state.lock fails with EACCES.

  • Before: Root-backed acquisition exposes the raw EACCES error.
  • After: Acquisition throws FsSafeError with code invalid-path and the original EACCES error as cause.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) Focused, source-supported compatibility repair with meaningful regression coverage; available behavior evidence is harness-based and the Windows smoke failure remains unattributed.
Proof confidence 🦐 gold shrimp (3/6) The supplied host facts identify a maintainer-authored PR outside the ordinary proof gate; its reported validation exercises public Root and lock APIs with injected filesystem failures rather than a shipped-entry-point demonstration.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: POSIX Root lock callers receive raw filesystem errors instead of the established FsSafeError classification and cause.
Reason: This restores a documented compatibility contract and consumer failure handling through an existing shared normalizer; the supplied host facts establish maintainer direction.

Regression provenance

Possible regression — probable (reviewed change; known regression link). No predecessor PR is attributed.

Merge readiness

✅ Ready for maintainer review

Keep open: current main still bypasses the documented POSIX Root write-error contract, and this PR provides a focused repair with no concrete correctness or security finding.

Priority: P2
Reviewed head: e4fb6ee2bf059958caef92f4d0e288a251704bc9

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: Supplied validation uses public-API fault-injection tests; no shipped-package POSIX Root lock failure run is shown, although the body reports failing-before regression cases.
Agent review details

How this fits together

Root-backed lock acquisition sends an owner record through guarded sidecar publication; the Root write boundary classifies failures before returning them to the caller.

flowchart TD
  A[Lock caller] --> B[Sidecar acquisition]
  B --> C[Root create]
  C --> D[Guarded sidecar publication]
  D --> E[Root error boundary]
  E --> F[Caller receives classified failure]
Loading

Technical review

Best possible solution:

Land the existing platform-specific unwrap repair once the Windows package-smoke failure is understood and required checks are satisfied.

Do we have a high-confidence way to reproduce the issue?

Source directly shows fallback sidecar failures bypassing the documented normalizer on main; the PR reports failing-before Root-lock cases and published-version comparisons, but this read-only review executed no reproduction.

Is this the best way to solve the issue?

The repair is the smallest complete change: unwrap the sidecar failure, preserve Windows identity, and reuse the existing POSIX classification without changing publication, cleanup, or authority owners.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against f5ad136ac5b2.

Provenance checked

  • POSIX Root sidecar fallback error propagation changes intended behavior with a stated reason (87a3e6e: Crash-safe staged publication introduced the unconditional fallback unwrap; its stated purpose retained Root authority and ownership contracts.)
  • Publication and directory-persistence error assertions changes intended behavior with a stated reason (87a3e6e: Tests asserted direct error identity while proving cleanup and successor preservation; the PR explains restoring the older POSIX classification while preserving those filesystem outcomes.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit 87dd96b adds src/root-impl.ts:1099 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 87dd96bbca2b; files: src/root-impl.ts)

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Review metrics

Metric Value Why it matters
Change allocation Production +5/-1; tests +93/-3; changelog +2/-0 The small production repair reuses the established normalizer; test growth covers platform identity, error causes, and cleanup outcomes.

Labels

Label changes:

  • add P2: A released error-contract regression affects POSIX async Root lock failure handling, with a narrow trigger and repair.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P2: A released error-contract regression affects POSIX async Root lock failure handling, with a narrow trigger and repair.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Inspect the failed Windows platform-capability output and establish whether the failure also occurs on unchanged main.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed November 7, 2026, 8:34 PM ET / November 8, 2026, 01:34 UTC.

@steipete
steipete merged commit 3f9a7a6 into main Nov 8, 2026
101 of 103 checks passed
@steipete
steipete deleted the fix/root-lock-error-normalization branch November 8, 2026 01:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P2 Normal priority bug or improvement with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant