Repository navigation
fix(anthropic): stabilize session catalog watcher arming - #154164
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 20, 2026, 11:42 PM ET / September 21, 2026, 03:42 UTC (Revision 5). ClawSweeper reviewWhat this changesThe PR prevents unnecessary Claude session rescans at fractional-clock watcher deadlines and repairs catalog publication and shared-worker fetch cleanup in tests. Merge readiness✅ Ready for maintainer review Keep open as a useful, review-clean fix. Current main retains the boundary defect; no actionable correctness or security findings remain, and the previous validation follow-up now has an explicit maintainer disposition. Priority: P2 Review scores
Verification
How this fits togetherThe Anthropic plugin discovers local Claude sessions for OpenClaw’s session sidebar. Filesystem watchers tell its catalog cache when to reuse existing results or rescan changed directories. flowchart TD
A[Claude session files] --> B[Filesystem watcher]
C[Catalog refresh request] --> D{Watcher armed and coverage known?}
B --> D
D -->|No| E[Full directory scan]
D -->|Yes| F[Reuse cache or scan changed directories]
E --> G[Session catalog results]
F --> G
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource 0, Tests +19. Total +19 across 4 files. View PR surface stats
Review metricsNone. Technical reviewBest possible solution: Keep catalog freshness and test cleanup under their existing owners while preserving the full-scan fallback and publication-completion contracts. Do we have a high-confidence way to reproduce the issue? Yes, from source: fractional clock seeds 1000.1 and 65530.12 expose the subtraction boundary, and the new cases exercise arming, conservative scanning, and dirty-event draining. This review did not execute them. Is this the best way to solve the issue? Yes. The patch repairs the existing deadline and fixture lifecycle owners without changing the 250 ms interval, weakening assertions, or introducing another cleanup mechanism. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 652ff9a8dfdf. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (4 earlier review cycles)
|
Compare the absolute monotonic arming deadline and retain fractional-clock regressions. Await terminal publication completion before settling held node inventory. Preserve main's integer-clock and controlled metadata-event fixtures.
Track every X-search fetch replacement with Vitest so existing global teardown restores the native transport for later provider files. Keep terminal publication cleanup in explicit try/finally, with main metadata path values unchanged and no line-cap growth.
feb67eb to
b4fdbb8
Compare
|
Merged via squash.
|
…4164) * fix(anthropic): stabilize session catalog watcher deadlines Compare the absolute monotonic arming deadline and retain fractional-clock regressions. Await terminal publication completion before settling held node inventory. Preserve main's integer-clock and controlled metadata-event fixtures. * test: restore provider fixture cleanup across shared workers Track every X-search fetch replacement with Vitest so existing global teardown restores the native transport for later provider files. Keep terminal publication cleanup in explicit try/finally, with main metadata path values unchanged and no line-cap growth.
What Problem This Solves
Fixes unnecessary Claude catalog rescans at the watcher's fractional-clock arming boundary and a timing race in the terminal catalog publication fixture. Related: #153167.
User Impact
The catalog enters its watched state at the intended deadline. Provider tests also restore their fetch transport correctly when files share a worker.
Why This Change Was Made
Subtracting fractional clock readings can turn an exact 250 ms advance into
249.9999999999999. The production watcher now compares against an absolute monotonic deadline, preserving the 250 ms interval and conservative full read at arming. Two real-watcher boundary cases cover fractional starts.The terminal fixture awaits the registered publication completion before rejecting its deliberately held node inventory, and joins that inventory in
finally. This replaces the one-second polling race without weakening its publication assertion.Rebased onto
01050a71f21efd3a01283eb544e093e0af4ee19e. Main's integer-clock owner and regression from #153910, metadata-event fixture from #154098, and session/SQLite teardown owners are retained. Duplicate fixture repairs and the superseded metadata-cleanup commit were dropped. The production interdiff againstfeb67eb205dis empty:extensions/anthropic/session-catalog-tree-watch.tsis byte-identical, and its +3/-3 production patch is unchanged against the respective bases.The requested non-isolated run exposed another producer-owned leak: X-search tests assigned
global.fetchdirectly. Their final X-search response mock survived into real Ollama and LM Studio HTTP tests. Five assignments now usevi.stubGlobal, allowing the existing global teardown to restore native fetch. Consumer assertions and main's teardown logic remain intact.Evidence
Blacksmith Testbox run, lease
tbx_01m30vr4md62037eg7hevccrv4. The workflow identifies the hydrated machine; these are its SSH-command results. Final tested tree809219a26ee4e607148b715fd023c9583582014fmatches the published commit.--isolate=false, before fetch-lifecycle repairnode scripts/check-changed.mjson TestboxThe temporary ordered config explicitly selected
test/non-isolated-runner.tsalong with--isolate=false; the CLI flag alone would not select main's teardown owner from the normally isolated provider config. The sequencer verified all 73 dispatched paths against the reconstructed log order. Historical worker assignments were not logged.The pre-fix LM Studio error was
LM Studio model list: malformed JSON response; Ollama received nomodelsarray and returned an empty inventory. The existing six downstream failures are the regression proof for tracked fetch restoration. No retries, sleeps, weaker assertions, consumer state clearing, or lint suppressions were added.Original watcher proof remains valid: the pre-fix catalog case reproduced exactly three
lstatcalls to the same.claude/projects/-workspace/desktop.jsonl, and both fractional production-clock regressions failed before the deadline repair. Production is +3/-3 lines; test changes are +37/-18. The oversized catalog file has no counted-line growth.Separate previously observed host issue: a local Mac emitted zero native
fs.watchcallbacks during a 6.35-second probe outside Vitest. That host notification issue is not claimed fixed here; the native watcher test passes on Linux Testbox. Foundry's eviction-test cost is owned separately.ClawSweeper Rank-up disposition
For the September 21, 2026 02:57 UTC review of
b4fdbb8502b4d982ba9466219c1e4488d6218c37: additional repetition and per-file timing documentation skipped for this landing. The authorized landing scope explicitly prohibits reruns. The existing deterministic before/after evidence is retained: the same reconstructed 73-file order changed from six provider failures to 1,334 passing cases after fetch restoration, alongside 93 focused catalog passes and passing changed-file checks on Testbox. Twenty standalone repetitions and three additional shard repetitions were not performed and are not claimed. Per-file timing is not available in the recorded evidence; command wall times and the historical worker-assignment limitation remain documented above. ClawSweeper reported no actionable correctness or security findings.Release-note context: prevent unnecessary Claude session catalog rescans at fractional-clock watcher arming boundaries by comparing against an absolute monotonic deadline while preserving the existing 250 ms interval and conservative full scan.