Repository navigation
test(agents): coordinate settings lock contention - #146949
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. |
|
@clawsweeper review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
Codex review: needs maintainer review before merge. Reviewed September 13, 2026, 7:13 AM ET / 11:13 UTC (Revision 2). ClawSweeper reviewWhat this changesThe PR coordinates competing settings writers through the parent test process, releasing the first writer only after the second observes actual lock contention. Merge readiness✅ Ready for maintainer review This remains a useful, focused test stabilization absent from reviewed main. No actionable correctness or security findings remain, and the maintainer-authored PR is protected from automatic closure. Priority: P3 Review scores
Verification
How this fits togetherSettings storage serializes global and project settings updates through a filesystem lock. This regression test runs independent Node processes and verifies that both updates survive concurrent initial saves. flowchart TD
A[Parent test process] --> B[First settings writer]
B --> C[Hold settings lock]
A --> D[Competing settings writer]
D --> E[Observe exclusive acquisition failure]
E --> A
A --> F[Release first writer]
F --> G[Verify both saved settings]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceTests +31. Total +31 across 1 file. View PR surface stats
Review metricsNone. Technical reviewBest possible solution: Keep the existing cross-process regression test with contention-based coordination and unchanged saved-state assertions. Do we have a high-confidence way to reproduce the issue? No deterministic CI-timeout reproduction was established during this read-only review; the old timing dependency is visible in source, and the body links failing CI runs. Is this the best way to solve the issue? Yes. Observing the actual exclusive-lock failure strengthens the existing regression without adding production seams, increasing managed timeouts, or weakening the final state checks. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against e96f62c64330. 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)
|
6dd3c2a to
60c62a2
Compare
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Merged via squash.
|
* temp/pr-146799: (70 commits) test: reuse explicit fallback config fixtures (openclaw#146948) fix(computer): return fresh window observations after actions (openclaw#146822) refactor(feishu): remove unreachable requester topic selection (openclaw#146904) improve(gateway): reduce CPU spent listing agent-owned sessions (openclaw#137745) fix(ui): avoid recapturing chat drafts during UI updates (openclaw#146884) fix(ui): show system uptime in the debug overlay (openclaw#146960) fix(retry): honor waits beyond the native timer limit (openclaw#145718) fix(ui): keep chat history idle when run status changes (openclaw#146802) fix(ui): reuse persisted text during chat streaming (openclaw#146831) refactor(qa): share harness drift result construction (openclaw#146903) test(agents): coordinate settings lock contention (openclaw#146949) fix(worker): avoid repeatedly serializing screenshot history (openclaw#146907) fix(secrets): stop buffered upload writes after cancellation (openclaw#146840) perf(doctor): avoid unnecessary state runtime imports (openclaw#146926) improve: reduce compaction request estimation work (openclaw#146961) fix(ci): wait for forwarded avatar imports before assertions (openclaw#146729) perf(workers): skip configured Git author lookups (openclaw#146833) fix: admit borrowed memory writes through the agent database owner (openclaw#146760) fix(discord): prevent voice playback gaps and stale turn controls (openclaw#146798) improve: reduce worktree filesystem stalls and archive syncs (openclaw#146906) ...
* commit 'ccfd2377cd07d1ad3a583ba64d08e29a065f7061': (1587 commits) fix(ui): avoid recapturing chat drafts during UI updates (#146884) fix(ui): show system uptime in the debug overlay (#146960) fix(retry): honor waits beyond the native timer limit (#145718) fix(ui): keep chat history idle when run status changes (#146802) fix(ui): reuse persisted text during chat streaming (#146831) refactor(qa): share harness drift result construction (#146903) test(agents): coordinate settings lock contention (#146949) fix(worker): avoid repeatedly serializing screenshot history (#146907) fix(secrets): stop buffered upload writes after cancellation (#146840) perf(doctor): avoid unnecessary state runtime imports (#146926) improve: reduce compaction request estimation work (#146961) fix(ci): wait for forwarded avatar imports before assertions (#146729) perf(workers): skip configured Git author lookups (#146833) fix: admit borrowed memory writes through the agent database owner (#146760) fix(discord): prevent voice playback gaps and stale turn controls (#146798) improve: reduce worktree filesystem stalls and archive syncs (#146906) fix(ui): avoid extra chat rail work while replies stream (#146883) improve(ui): speed up populated Usage timelines (#146947) test(gateway): retain auth recovery failure diagnostics (#146925) fix(tests): create private temporary home directories (#146931) ... # Conflicts: # test/tsconfig/tsconfig.core.test.agents-other.json # test/tsconfig/tsconfig.core.test.agents-root.json
Fix spurious settings-lock CI failures when contender startup consumes the first writer's independent deadline. Both child writers now share the existing 20-second test deadline, with explicit abort and process-tree joining. The regression still verifies contention, release ordering, both persisted settings fields, and lock removal. Test-only; no user-visible behavior change. Delayed-start differential proof failed before and passed after the repair; disabling the file lock still fails both revised cases. The author recorded ten successful runs of all 15 settings-storage tests and passing changed checks. Refreshed exact-head CI run 34759062677 passed without reruns. Independent review and ClawSweeper found no actionable findings. Related: #146949 Refs #144558
Brings in: - openclaw#146949 (bc6b662) test(agents): coordinate settings lock contention - openclaw#147028 (d4d3d6c) fix(sessions): align the reclamation-memory test with the archive session owner - openclaw#147029 (1311b42) fix(test): avoid settings lock writer startup timeouts Required to clear the 4 failing CI checks on PR openclaw#144507; the PR's WhatsApp voice-note 16 kHz + WhatsApp-vendor fix is preserved intact (main did not touch the changed lines). Co-Authored-By: Claude Code <[email protected]>
Fix spurious settings-lock CI failures when contender startup consumes the first writer's independent deadline. Both child writers now share the existing 20-second test deadline, with explicit abort and process-tree joining. The regression still verifies contention, release ordering, both persisted settings fields, and lock removal. Test-only; no user-visible behavior change. Delayed-start differential proof failed before and passed after the repair; disabling the file lock still fails both revised cases. The author recorded ten successful runs of all 15 settings-storage tests and passing changed checks. Refreshed exact-head CI run 34759062677 passed without reruns. Independent review and ClawSweeper found no actionable findings. Related: openclaw#146949 Refs openclaw#144558
Keep real lock contention proof while excluding parent fixture scheduling from the bounded production retry loop. The parent releases and joins the first writer before allowing the contender to retry. Production lock limits and storage behavior are unchanged. Delayed-parent proof reproduces the original timeout and passes with this fixture. Bypassing locking still fails both concurrency cases. Full settings-storage tests pass with CI-like permissions; focused lint, format and independent review pass. Refs #146949, #147029
* fix: join outbound lease renewal before cancellation cleanup * test(agents): join the first settings writer before retrying Keep real lock contention proof while excluding parent fixture scheduling from the bounded production retry loop. The parent releases and joins the first writer before allowing the contender to retry. Production lock limits and storage behavior are unchanged. Delayed-parent proof reproduces the original timeout and passes with this fixture. Bypassing locking still fails both concurrency cases. Full settings-storage tests pass with CI-like permissions; focused lint, format and independent review pass. Refs #146949, #147029 --------- Co-authored-by: Jason (Json) <[email protected]>
…w#148390) * fix: join outbound lease renewal before cancellation cleanup * test(agents): join the first settings writer before retrying Keep real lock contention proof while excluding parent fixture scheduling from the bounded production retry loop. The parent releases and joins the first writer before allowing the contender to retry. Production lock limits and storage behavior are unchanged. Delayed-parent proof reproduces the original timeout and passes with this fixture. Bypassing locking still fails both concurrency cases. Full settings-storage tests pass with CI-like permissions; focused lint, format and independent review pass. Refs openclaw#146949, openclaw#147029 --------- Co-authored-by: Jason (Json) <[email protected]>
What Problem This Solves
Fixes: the shared settings-storage concurrent first-write test can time out in CI because one child process waits for a contender-created marker before the parent has confirmed that the contender reached the lock boundary.
User Impact
User impact: no user-visible behavior changes; maintainers get deterministic coverage for cross-process settings lock contention without increasing timeouts or weakening the final state assertion.
Why This Change Was Made
This maintainer-requested test stabilization makes the parent own the contention handshake. The first writer remains inside the lock until the contender has attempted exclusive acquisition of the exact settings lock and observed
EEXIST; the parent then verifies that the first writer is still pending and the lock still exists before releasing it. This guarantees the pre-fix missing-directory path cannot proceed as serialized first writes without failing the handshake. The managed 10-second child timeout, final two-field assertion, and cleanup remain unchanged.Evidence
Pre-fix CI failures:
Local proof:
60c62a2681bd3dd749c377ba20dc6a5a63de2fb9:node scripts/run-vitest.mjs src/agents/sessions/settings-storage.test.tspassed 15/15.src/plugin-sdk/file-lock.test.ts,src/infra/stale-lock-file.test.ts, and PID identity tests) passed 59/59.EEXISTobservation and reruns the focused and sibling gates above.coreTests. The selected gate passed 14 checks before the borrowed-worktree compiler boundary rejected external dependencies; the previously failingcheck-tsgo-core-boundary.mtssurface then passed from the matching physical owner checkout at basef3bdcc10d628ac914b5796554cefa28c6c50cab9.