Repository navigation
fix(sqlite): skip slow-lock diagnostic when busyTimeoutMs is zero - #115990
Conversation
|
Codex review: needs maintainer review before merge. Reviewed August 1, 2026, 11:29 AM ET / 15:29 UTC. ClawSweeper reviewWhat this changesThe PR changes SQLite slow-lock diagnostics so zero or negative busy timeouts use the normal 1000 ms warning threshold, with regression tests for fast and genuinely slow transactions. Merge readinessThe patch correctly fixes the shared SQLite diagnostic threshold and has focused regression coverage plus credible real-runtime proof. It should remain open for a maintainer to validate the clean merge result against current main and land it; no code-level finding remains. Priority: P2 Review scores
Verification
How this fits togetherSQLite transaction helpers acquire an immediate database lock, run a synchronous callback, and emit structured warnings for slow waits or lock failures. State and session write paths supply busy-timeout settings to that helper, so this threshold affects their operator diagnostics. flowchart LR
A[State or session write] --> B[SQLite transaction helper]
B --> C[Busy-timeout setting]
C --> D[Slow-wait threshold]
D --> E[Structured warning]
B --> F[Commit or lock failure]
Before merge
Agent review detailsSecurityNone. PR surfaceSource 0, Tests +54. Total +54 across 2 files. View PR surface stats
Review metricsNone. Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Validate the clean merge result on current main, then land the shared-helper repair and its focused regressions; no caller-specific suppression or new configuration surface is needed. Do we have a high-confidence way to reproduce the issue? Yes, from source: current main clamps Is this the best way to solve the issue? Yes. The shared threshold helper owns this diagnostic policy, so treating non-positive values as the default threshold repairs all callers without changing lock acquisition or lock-failure behavior. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 7bcbe743bd42. 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 (10 earlier review cycles; latest 8 shown)
|
|
PR body updated with real runtime evidence (proof.ts script exercising the actual
Plus 2 new regression tests in @clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
busyTimeoutMs: 0 means "do not wait for locks, fail immediately". The slow lock wait threshold should not collapse to 1ms in this case, causing false-positive WARN logs for normal successful transactions. Fixes openclaw#115972 Co-Authored-By: Claude <[email protected]>
The existing test suite did not cover busyTimeoutMs: 0, which caused
false-positive slow-lock warnings for zero-timeout lease transactions.
Added:
1. 'does not warn for busyTimeoutMs: 0 with fast transactions' —
verifies the regression is fixed (0 → uses 1000ms default threshold)
2. 'still warns for busyTimeoutMs: 0 when crossing 1000ms boundary' —
verifies genuinely slow transactions still trigger the diagnostic
Both tests pass on the patched code (12/12 total).
Co-Authored-By: Claude <[email protected]>
81c1f9a to
d00db37
Compare
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
Fixed the type-check failuresThe
@clawsweeper re-review |
|
The current-main merge is clean; the shared SQLite helper now preserves zero busy-wait behavior while using the normal slow-transaction warning threshold. Both shared-state and agent-state lease paths and existing lock-error diagnostics remain covered; no schema, config, or public API changes. |
* origin/main: fix(sqlite): skip slow-lock diagnostic when busyTimeoutMs is zero (#115990) fix(canvas): serve Content-Length on Canvas document HEAD responses (#117964) fix(workboard): diagnose archived cards still in an active status (#116359) (#117290) feat(diagnostics): configure OTEL metric name prefixes (#116687) fix(ui): respect UTC when filtering pending usage sessions (#118004)
…enclaw#115990) * [AI] fix(sqlite): skip slow-lock diagnostic when busyTimeoutMs is zero busyTimeoutMs: 0 means "do not wait for locks, fail immediately". The slow lock wait threshold should not collapse to 1ms in this case, causing false-positive WARN logs for normal successful transactions. Fixes openclaw#115972 Co-Authored-By: Claude <[email protected]> * test(sqlite): add regression tests for busyTimeoutMs: 0 threshold The existing test suite did not cover busyTimeoutMs: 0, which caused false-positive slow-lock warnings for zero-timeout lease transactions. Added: 1. 'does not warn for busyTimeoutMs: 0 with fast transactions' — verifies the regression is fixed (0 → uses 1000ms default threshold) 2. 'still warns for busyTimeoutMs: 0 when crossing 1000ms boundary' — verifies genuinely slow transactions still trigger the diagnostic Both tests pass on the patched code (12/12 total). Co-Authored-By: Claude <[email protected]> --------- Co-authored-by: Claude <[email protected]> Co-authored-by: Vincent Koc <[email protected]>
* origin/main: fix(sqlite): skip slow-lock diagnostic when busyTimeoutMs is zero (openclaw#115990) fix(canvas): serve Content-Length on Canvas document HEAD responses (openclaw#117964) fix(workboard): diagnose archived cards still in an active status (openclaw#116359) (openclaw#117290) feat(diagnostics): configure OTEL metric name prefixes (openclaw#116687) fix(ui): respect UTC when filtering pending usage sessions (openclaw#118004)
What Problem This Solves
busyTimeoutMs: 0makes a successful 1 ms SQLite commit log a WARN-level "slow SQLite transaction lock wait" false positive. The slow-lock diagnostic threshold collapses to 1 ms becauseMath.max(1, 0)= 1.Date.now()millisecond boundary.busyTimeoutMs <= 0(meaning "do not wait, fail immediately") the same asundefined— revert to the default 1000 ms slow-wait threshold.src/infra/sqlite-transaction.ts—slowBusyWaitThresholdMs()condition broadened;Math.max(1, ...)guard removed (now unreachable).SQLITE_BUSY/SQLITE_LOCKEDfailures still produce"SQLite transaction lock wait failed"via the existing catch path. All positivebusyTimeoutMsvalues behave identically.Change Type (select all)
Scope (select all)
Linked Issue/PR
Motivation
When
busyTimeoutMsis explicitly set to0, the caller expresses "do not wait for locks, fail immediately". The slow-lock diagnostic threshold should not collapse to 1 ms in this case — a normal successful transaction that crosses a millisecond boundary is not evidence of lock contention. On one reported host, 26 such false-positive warnings occurred in a single day with a maximum real duration of 5 ms and no actual lock failures.Evidence
Behavior addressed:
busyTimeoutMs: 0causes false-positive WARN "slow SQLite transaction lock wait" on normal 1 ms successful commits.Real environment tested: OpenClaw
main(c6dfee1 + this patch), Node 22, Linux x86_64Exact steps or command run after this patch:
Before/after threshold comparison:
Real runtime proof — using the same
runSqliteImmediateTransactionSynccode path as state-lease write transactions, exercising all four scenarios on a real SQLite database:Unit tests pass (2 new regression tests added for
busyTimeoutMs: 0):Evidence after fix: Matrix — all input variants and their threshold outcomes:
busyTimeoutMsundefined0205000Observed result after fix:
busyTimeoutMs: 0no longer collapses threshold to 1 ms — proven on real SQLite runtime with the same transaction helper used by state-lease writes.SQLITE_BUSY/SQLITE_LOCKEDfailures still produce"SQLite transaction lock wait failed"— preserved.busyTimeoutMs: 0(fast txn, slow txn, lock failure, positive timeout).Root Cause (if applicable)
slowBusyWaitThresholdMs()insrc/infra/sqlite-transaction.tsusesMath.max(1, options.busyTimeoutMs)to guard against non-positive values, but0is a legitimate value meaning "don't wait". This transformsbusyTimeoutMs: 0→ threshold 1 ms, producing false-positive warnings for normal successful transactions that cross a millisecond boundary.Provenance:
c5071e393aa"fix: harden sqlite compact and busy waits"b2aa21612d6"feat(ui): show PR status on Claude threads (feat(ui): show PR status on Claude threads #112180)"Regression Test Plan
busyTimeoutMs: 0fast (no warning) and slow (warning preserved).User-visible / Behavior Changes
None. The only observable difference is the absence of false-positive WARN "slow SQLite transaction lock wait" lines for zero-timeout lease transactions that complete normally.
Security Impact (required)
Human Verification (required)
busyTimeoutMsinput variants (undefined, 0, 20) produce correct threshold behavior on real SQLite runtime.busyTimeoutMs: 0no longer collapses to 1 ms; negative values (defensive) also fall back to default;SQLITE_BUSYlock-failure path confirmed intact.Compatibility / Migration
Best-fix Verdict
slowBusyWaitThresholdMs) so it applies to all callers uniformly. The alternative — fixing at each call site — would be fragile and miss future callers.withLeaseWriteTransactionor the state-lease caller level. Rejected because it would need to be replicated for everybusyTimeoutMs: 0caller.AI Assistance
Risks and Mitigations
None. The change only broadens the condition under which the default threshold is used. All existing
busyTimeoutMs > 0paths are unaffected, and real lock-failure diagnostics are unchanged.Fixes #115972