Repository navigation
fix(sessions): honor file-lock cancellation - #117446
Conversation
|
Codex review: needs maintainer review before merge. Reviewed August 1, 2026, 10:56 AM ET / 14:56 UTC. ClawSweeper reviewWhat this changesThe PR fences session file-lock acquisition after the dependency returns, releases a newly acquired lock if cancellation won the race, and adds contention and lifecycle regression coverage. Merge readinessCurrent Priority: P2 Review scores
Verification
How this fits togetherThe plugin SDK adapts session-file writes to a sidecar lock while SQLite-backed session-key locking uses the shared session-lock owner. Callers request an acquisition with timeout and cancellation; the adapter returns a release handle or surfaces the canonical abort/lock error. flowchart LR
A[Session write caller] --> B[Plugin SDK lock adapter]
B --> C[File lock manager]
C --> D[Sidecar lock acquisition]
D --> E{Signal cancelled?}
E -->|No| F[Release handle to caller]
E -->|Yes| G[Release newly acquired sidecar]
G --> H[Throw caller abort reason]
Decision needed
Why: The code-level race and repair are clear, but the dependency source required to validate the release-handle ownership contract is unavailable in this read-only checkout and could not be retrieved over GitHub DNS. Before merge
Agent review detailsSecurityNone. PR surfaceSource +6, Tests +197. Total +203 across 3 files. View PR surface stats
Review metricsNone. Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Verify the Do we have a high-confidence way to reproduce the issue? Yes, from source: hold a real file sidecar, begin an infinite-timeout acquisition with an abort signal, cancel while the dependency retries, then release the holder; current main can return the acquired handle because it has no post-success abort check. The proposed regression test encodes this order, but it was not executed in this read-only review. Is this the best way to solve the issue? Yes, conditional on the direct dependency contract: the adapter owns cancellation admission around the dependency-owned retry loop, so releasing only its newly acquired handle and throwing the original abort reason is narrower than changing shared lock-manager semantics or polling callers. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 5ad7c969b820. LabelsLabel 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
HistoryReview history (1 earlier review cycle)
|
|
Merged via squash.
|
Summary
@openclaw/fs-safeacquires after its retry waitRoot cause
The SDK checked the abort signal before entering the dependency-owned retry loop and again only after dependency errors. If cancellation arrived while
@openclaw/fs-safewas waiting, and the current owner then released the sidecar, acquisition could succeed and be returned after the caller had already cancelled.The adapter now checks cancellation immediately after successful acquisition. A cancelled admission best-effort releases that exact dependency handle, then throws through the canonical abort helper so the original signal reason wins.
Dependency contract
The installed
@openclaw/fs-safe0.5.0 implementation was inspected directly indist/sidecar-lock.js,dist/sidecar-lock-reclaim.js, anddist/file-lock.js. It owns the bounded retry loop and returns an exact-entry fenced release handle after acquisition. The adapter therefore owns the post-success cancellation fence and can safely release only the newly acquired handle without disturbing a successor.Proof
src/plugin-sdk/session-write-lock-runtime.test.tssrc/agents/session-write-lock.test.tspnpm check:changed: passedtbx_01kyys9kgbmwg6xvk3455gbt1z(jade-crayfish-5b9e)openclaw/ci-gatepassed at692580dc8258837ea7d823a13baf3c1e001437b6Scope
Production delta: +6 LOC. No public API, config, schema, dependency, default, or environment surface changes.