Repository navigation
fix: avoid redundant database permission updates - #146492
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. Reviewed September 12, 2026, 5:53 PM ET / 21:53 UTC (Revision 2). ClawSweeper reviewWhat this changesThe branch avoids redundant POSIX permission updates for agent databases, adds transaction-level regression coverage, and carries the TLS shutdown registration correction. Merge readiness✅ Ready for maintainer review The permission optimization remains useful and is absent from current main and v2026.9.4. No actionable correctness or security defect was found; the TLS prerequisite is already merged. Priority: P2 Review scores
Verification
How this fits togetherOpenClaw’s per-agent SQLite databases hold sessions and other agent state. Their permission owner protects the database directory and sidecar files during opening and before transaction commit. flowchart TD
A[Database open or agent write] --> B[Existing permission owner]
B --> C[Check directory ownership policy]
C --> D[Read current POSIX mode]
D -->|Already correct| F[Continue database operation]
D -->|Mode differs| E[Apply private permissions]
B -->|Windows| E
E -->|Success or vanished sidecar| F
E -->|Permission error| G[Fail open or roll back write]
D -->|Read error| G
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +6, Tests +92. Total +98 across 3 files. View PR surface stats
Review metricsNone. Technical reviewBest possible solution: Keep permission checks fresh at the existing database owner while skipping metadata writes only when POSIX modes already match. Do we have a high-confidence way to reproduce the issue? Yes, from source: an ordinary outer agent write calls the permission sweep, and current main unconditionally reapplies matching modes. Runtime reproduction was not performed in this read-only review. Is this the best way to solve the issue? Yes. The guard stays in the existing permission owner, preserves failure and platform behavior, and needs no schema, configuration, or migration change. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 5270db64d8d0. 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)
|
dd53c05 to
fd91f2d
Compare
569ef25 to
b5df578
Compare
b5df578 to
24d55d5
Compare
|
Merged via squash.
|
* fix: avoid redundant database permission updates * test: exercise auth permission repair after mode drift
Related: #130741
What Problem This Solves
Agent database writes repeatedly rewrote filesystem permissions even when the database, sidecars, and private directory already had the required modes.
User Impact
Agent activity avoids redundant filesystem metadata writes while continuing to repair permission drift before committing database changes. Existing private modes, custom-directory ownership, and Windows behavior are preserved; no configuration or migration is required.
Why This Change Was Made
The existing permissions owner now reads current POSIX modes before applying changes. Permission-read or repair failures still roll back the transaction, and transient sidecars may disappear during the check without failing a valid write.
Evidence
The regression fails on the original implementation because an ordinary write makes four redundant permission changes; the updated owner makes none when modes already match. The tests also exercise special-bit and sidecar mode drift, rollback on permission errors, and disappearing sidecars.
Final focused tests passed: 20 permission, lease-owner, and incognito tests, plus three selected existing tests for custom directories, nested permission repair, and SQLite pragmas. One existing Windows-only test was skipped on macOS; the remaining tests in the large database suite were excluded by the explicit name filter. This slice establishes fewer metadata writes and unchanged permission behavior; it does not claim the full Swarm latency target.
The full canonical changed gate and independent P1 review pass. Existing permission-failure fixtures now create actual mode drift before injecting a repair failure; all rollback and runtime-publication assertions remain intact. Those original failures reproduced, then the repaired cases and four permission siblings passed. Exact-head CI passed before the patch-identical refresh onto current main; the native workflow will verify the final head before landing.