Repository navigation
fix: allow plugin state writes after database inode reuse - #154176
Conversation
Reconcile cold database identity binding against surviving aliases so a new worker-created database keeps its captured admission. Revoke obsolete records without reviving retired callers or bypassing active file-exclusion seals. Prepare the Gateway status fixture through one real auth read before its measured connection and cleanup lifetimes. The client still reads fresh auth; all hello, stop, polling, and cleanup assertions retain their existing bounds. Schema, retention, configuration, and update behavior remain unchanged.
|
🦞👀 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 20, 2026, 8:03 PM ET / September 21, 2026, 00:03 UTC. ClawSweeper reviewWhat this changesThe PR repairs plugin-state writes when a deleted database’s inode is reused, extends admission regression coverage, and prepares real authentication storage before Gateway fixture timing begins. Merge readiness✅ Ready for maintainer review The fix remains necessary on fetched main, and no blocking defect was found in the introduced patch. It preserves live aliases, exclusion seals, and rejection of retired admissions. Priority: P2 Review scores
Verification
How this fits togetherThe shared SQLite lifecycle connects plugin-state operations to their database identity and controls whether captured operations remain valid. Its admission checks feed worker startup, writes, and database cleanup. flowchart TD
A[Plugin state operation] --> B[Capture database admission]
B --> C[Resolve physical identity]
C --> D{Recorded alias still live or sealed?}
D -->|Yes| E[Retain existing lifecycle record]
D -->|No| F[Revoke obsolete record and bind creation]
E --> G[Check current admission before worker operation]
F --> G
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +23, Tests +41. Total +64 across 3 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Keep identity reconciliation in the existing lifecycle owner, preserving valid first-creation admissions while permanently revoking obsolete records. Do we have a high-confidence way to reproduce the issue? Yes, from source: close and delete a recorded writer database, then create plugin state whose physical identity reuses that inode. The focused worker regression controls that allocator outcome; this review did not execute it. Is this the best way to solve the issue? Yes. Repairing cold identity reconciliation at the shared lifecycle owner addresses the collision without changing plugin APIs, persisted formats, configuration, or warm admission behavior. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 729c6b1cc3d0. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Merged via squash.
|
…aw#154176) Reconcile cold database identity binding against surviving aliases so a new worker-created database keeps its captured admission. Revoke obsolete records without reviving retired callers or bypassing active file-exclusion seals. Prepare the Gateway status fixture through one real auth read before its measured connection and cleanup lifetimes. The client still reads fresh auth; all hello, stop, polling, and cleanup assertions retain their existing bounds. Schema, retention, configuration, and update behavior remain unchanged.
What Problem This Solves
A first plugin-state write can fail when the filesystem reuses an inode from a closed and deleted state database. Task maintenance can then report that its database admission changed.
User Impact
New database operations retain valid admission without reviving retired callers or bypassing live aliases and file-exclusion seals. Schema, retention, configuration, and update behavior are unchanged.
Why This Change Was Made
The shared database lifecycle now checks whether a cold physical-identity match still belongs to a recorded alias before binding a new database. Obsolete records are revoked and removed; non-file aliases do not hide another live alias, and other lookup errors remain failures. Warm captures keep their existing path.
The original shard also exposed a Gateway test-fixture defect: native auth storage and its lazy command runtime could initialize inside the two-second hello deadline. The fixture now completes one real auth read before the measured body and discards that result. The challenged client still reads fresh auth. The real WebSocket exchange, two-second hello budget, one-second stop budget, fifteen-second polling deadline, and every cleanup assertion remain unchanged.
Evidence
The real plugin-worker regression fails before the inode fix. Controlled inode reuse reproduces the same admission boundary in three existing maintenance cases, and this exact repair makes them pass without changing assertions or guards. Historical CI did not record allocator identities, so those syscall outcomes are not claimed as directly observed.
The accepted composition passed twenty standalone task-registry runs (3,040 cases), twenty standalone Gateway fixture runs (140 cases), and three complete original-order shard runs (1,211 tests across 48 files each). All three file orders were verified against the original CI order; the final two disabled only Vitest's prior-results ordering cache. Owner sibling tests, scoped checks, and independent P0–P2 reviews passed. Those stability receipts remain attributed to their tested composition. After carrying unchanged source onto current main, 178 targeted lifecycle, admission, registry, Gateway, and newly worker-backed task/flow binding cases passed, with fresh scoped checks and review.
Current single-worker cost measurements on macOS/Node 24.21.0:
pnpm test src/state/openclaw-state-db-read-admission.test.ts --maxWorkers=1: six cases, 18.243s wall, 3.326s summed case durations.pnpm test test/helpers/gateway-status-acquisition.test.ts --maxWorkers=1: seven cases, 17.111s wall, 8.296s summed case durations. This fixture proves real client acquisition, WebSocket exchange, authentication readiness, and joined cleanup; replacing that path with a storage or transport mock would miss the observed failure. No timer, sleep, polling loop, serial configuration, or worker pin was added.Hosted CI results and reported case timings are recorded below. The earlier Linux diagnostic stopped during Testbox synchronization before tests; its lease was stopped. Failed actor-only preparation and the duration-reordered supplementary shard are retained as diagnostics and are not counted as qualification.
Hosted CI run 35546044977 passed on its first attempt for head
fcbdd29e976eb0b95df57741a9e7f04f5c1651d7, testing mergec2341abdf24dd4d71be7f4466a87afd67669db82against base84a5cf931ae68b8be6dd3668b0f730e072100a91(148 successful jobs, 15 skipped). On Linux/Node 24.19.0, admission's six cases summed to 1.455s in small-11, and Gateway's seven cases summed to 3.825s in small-14. These are reported test-case duration sums, not isolated file wall times. All 152 registry cases passed, including the three original maintenance entrypoints.The 20 registry standalone runs remain bound to tree
7e00771d8c7232a1bd2e7a5f0f1fe5e2978d4c56; the 20 Gateway standalone and three original-order shard runs remain bound to combined tree117f554b615b4c5eba43ddcd9a34fef066901749. The 178-case current-main validation remains bound to tree266bae807258f96f2024c6defbb348cbd32482c5. Current hosted coverage does not establish that the historical failures recorded the inode-reuse allocator event.