Repository navigation
fix(proxy-capture): wrap deletePathBasedSessions DELETEs in transaction - #99482
chenyangjun-xy wants to merge 1 commit into
Conversation
deletePathBasedSessions executes DELETE FROM capture_events and DELETE FROM capture_sessions as separate auto-commit statements. A crash between them would leave the two tables inconsistent. The sibling method deleteSessions() already uses runSqliteImmediateTransactionSync. Wrap both DELETEs in deletePathBasedSessions the same way. Fixes openclaw#98959 Co-Authored-By: Claude <[email protected]>
|
Thanks for the context here. I swept through the related work, and this is now duplicate or superseded. Close: this PR duplicates an earlier open, mergeable, proof-positive PR for the same proxy-capture transaction fix, so keeping this second branch open would split review without adding unique behavior. Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Canonical path: Close this duplicate branch and focus maintainer review on #98852, then let the linked issue close when the canonical fix lands. So I’m closing this here and keeping the remaining discussion on #98852. Review detailsBest possible solution: Close this duplicate branch and focus maintainer review on #98852, then let the linked issue close when the canonical fix lands. Do we have a high-confidence way to reproduce the issue? Yes for source-level reproduction: current main still shows the path-based DELETE pair outside the transaction helper while the sibling shared-state delete path is transactional. I did not simulate a process crash between the two DELETE statements. Is this the best way to solve the issue? No for this PR as the landing path: the patch idea is plausible, but #98852 is the earlier open, mergeable, proof-positive branch for the same fix. Security review: Security review cleared: The diff only changes internal SQLite cleanup control flow and formatting in one source file; no security or supply-chain concern was found. AGENTS.md: found and applied where relevant. What I checked:
Likely related people:
Codex review notes: model internal, reasoning high; reviewed against 36dd9ee3c3c1. |
|
ClawSweeper applied the proposed close for this PR.
|
What Problem This Solves
Fixes #98959: In
src/proxy-capture/store.sqlite.ts,deletePathBasedSessionsexecutesDELETE FROM capture_eventsandDELETE FROM capture_sessionsas separate auto-commit statements. A crash between them would leave the two tables inconsistent.Root Cause
deletePathBasedSessions()at lines ~746-749 calls.run()on two DELETE statements sequentially without a transaction wrapper. The sibling methoddeleteSessions()(line 628) already wraps its DELETEs inrunSqliteImmediateTransactionSync. This inconsistency means the path-based code path lacks the atomicity guarantee that the non-path-based path provides.Why This Change Was Made
Without a transaction:
DELETE FROM capture_eventsbut beforeDELETE FROM capture_sessions, events rows are deleted but sessions remain — session count driftsdeleteSessions()is atomic;deletePathBasedSessions()is not — callers cannot assume consistencyChanges
src/proxy-capture/store.sqlite.ts: +3 lines −3 linesrunSqliteImmediateTransactionSync(this.db, () => { ... }), matching thedeleteSessions()patternEvidence
Verification environment
Regression tests — proxy-capture (7/7)
Real-process verification
User Impact
deleteSessions()path🤖 Generated with Claude Code