Skip to content

fix(anthropic): stabilize session catalog watcher arming - #154164

Merged
steipete merged 2 commits into
mainfrom
upd/flake-anthropic-session-catalog
Sep 21, 2026
Merged

steipete merged 2 commits into
mainfrom
upd/flake-anthropic-session-catalog

Conversation

@steipete

@steipete steipete commented Sep 20, 2026 •

Copy link
Copy Markdown
Contributor

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 against feb67eb205d is empty: extensions/anthropic/session-catalog-tree-watch.ts is 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.fetch directly. Their final X-search response mock survived into real Ollama and LM Studio HTTP tests. Five assignments now use vi.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 tree 809219a26ee4e607148b715fd023c9583582014f matches the published commit.

Proof Result
Original 73-file order, two workers, --isolate=false, before fetch-lifecycle repair 1,328 passed / 6 failed: five Ollama model-discovery/chat cases and one LM Studio model-list case
Same order and configuration after producer repair 1,334 passed / 0 failed; 43.562 s wall
Focused catalog tests 93 passed; 33.654 s command wall
node scripts/check-changed.mjs on Testbox Passed in 204.123 s, including typechecks, lint, line-cap ratchet, and selected guards
Final Codex P1 autoreview Scoped-clean; no accepted/actionable findings

The temporary ordered config explicitly selected test/non-isolated-runner.ts along 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 no models array 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 lstat calls 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.watch callbacks 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.

@clawsweeper

clawsweeper Bot commented Sep 20, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Sep 20, 2026
@clawsweeper

clawsweeper Bot commented Sep 20, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 20, 2026, 11:42 PM ET / September 21, 2026, 03:42 UTC (Revision 5).

ClawSweeper review

What this changes

The 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
Reviewed head: b4fdbb8502b4d982ba9466219c1e4488d6218c37

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused owner-level repair with useful before/after regression evidence, an explicit validation exception, and no actionable findings.
Proof confidence 🌊 off-meta tidepool Not applicable: The external-contributor proof gate does not apply to this maintainer-authored repair, and no authority boundary changes. Retained Testbox results cover watcher regressions, publication ordering, and shared-worker transport cleanup; they are not claimed as a live macOS notification fix.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The external-contributor proof gate does not apply to this maintainer-authored repair, and no authority boundary changes. Retained Testbox results cover watcher regressions, publication ordering, and shared-worker transport cleanup; they are not claimed as a live macOS notification fix.
Evidence reviewed 9 items Pinned introduced change: The merge-base-to-head diff changes the watcher’s elapsed-time subtraction to an absolute monotonic deadline, adds two fractional-clock regressions, awaits publication completion, and tracks five fetch replacements through Vitest.
Current-main necessity: Fetched main still compares performance.now() minus attachedAt against 250 ms. Its X-search tests also retain the five direct global.fetch assignments, so the proposed repairs remain distinct from merged fixture work.
Latest-release comparison: The supplied latest release, v2026.9.5, also contains the elapsed-time subtraction. The deadline repair is therefore not established as shipped.
Findings None None.
Security None None.

How this fits together

The 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
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source 0, Tests +19. Total +19 across 4 files.

View PR surface stats
Area Files Added Removed Net
Source 1 3 3 0
Tests 3 37 18 +19
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 4 40 21 +19

Review metrics

None.

Technical review

Best 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.

Labels

Label justifications:

  • P2: This is a bounded catalog-efficiency and test-lifecycle repair without evidence of an urgent user-facing outage.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The external-contributor proof gate does not apply to this maintainer-authored repair, and no authority boundary changes. Retained Testbox results cover watcher regressions, publication ordering, and shared-worker transport cleanup; they are not claimed as a live macOS notification fix.

Evidence

What I checked:

  • Pinned introduced change: The merge-base-to-head diff changes the watcher’s elapsed-time subtraction to an absolute monotonic deadline, adds two fractional-clock regressions, awaits publication completion, and tracks five fetch replacements through Vitest. (extensions/anthropic/session-catalog-tree-watch.ts:77, b4fdbb8502b4)
  • Current-main necessity: Fetched main still compares performance.now() minus attachedAt against 250 ms. Its X-search tests also retain the five direct global.fetch assignments, so the proposed repairs remain distinct from merged fixture work. (extensions/anthropic/session-catalog-tree-watch.ts:91, 652ff9a8dfdf)
  • Latest-release comparison: The supplied latest release, v2026.9.5, also contains the elapsed-time subtraction. The deadline repair is therefore not established as shipped. (extensions/anthropic/session-catalog-tree-watch.ts:91, ec9c1a13db89)
  • Existing publication and cleanup owners: The publication helper registers a promise that settles after onHost finishes; resolving the fixture’s deferred with that promise waits for publication before rejecting node inventory. Existing shared-worker teardown calls vi.unstubAllGlobals(), matching the new tracked fetch replacements. (src/plugin-sdk/session-catalog-paging.ts:14, b4fdbb8502b4)
  • Retained validation and explicit disposition: The captured PR body reports six failures before fetch restoration and 1,334 passes afterward in the same reconstructed 73-file order, plus 93 focused catalog passes. HEAD’s tree is 809219a26ee4e607148b715fd023c9583582014f, matching the reported tested tree. The body explicitly skips additional repetitions and per-file timing for this landing, preserves the missing historical worker assignments, and does not claim those checks ran. This addresses the previous review’s sole rank-up item; the deterministic failure mechanism and owner-level repair support accepting that exception. (b4fdbb8502b4)
  • Maintainer disposition authority: GitHub confirms steipete has repository admin permission. The recorded validation disposition is therefore maintainer context, rather than an unsupported external-contributor waiver.

Likely related people:

  • Peter Steinberger: Raw commit 1e08882 adds extensions/anthropic/session-catalog-tree-watch.ts:16 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 1e08882a4104; files: extensions/anthropic/session-catalog-tree-watch.ts)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (4 earlier review cycles)
  • reviewed 2026-09-20T23:43:12.063Z sha 4101517 :: needs real behavior proof before merge. :: none
  • reviewed 2026-09-21T01:49:04.181Z sha feb67eb205db45c3163c5f388afb3d1b07bcd9ee :: needs changes before merge. :: none
  • reviewed 2026-09-21T02:01:44.888Z sha feb67eb205db45c3163c5f388afb3d1b07bcd9ee :: blocked before merge. :: none
  • reviewed 2026-09-21T02:57:15.059Z sha b4fdbb8 :: needs changes before merge. :: none

@clawsweeper clawsweeper Bot added status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Sep 21, 2026
@steipete
steipete marked this pull request as ready for review September 21, 2026 01:53
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.
@openclaw-barnacle openclaw-barnacle Bot reopened this Sep 21, 2026
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.
@steipete
steipete force-pushed the upd/flake-anthropic-session-catalog branch from feb67eb to b4fdbb8 Compare September 21, 2026 02:46
@steipete
steipete merged commit 0ac0de3 into main Sep 21, 2026
107 checks passed
@steipete
steipete deleted the upd/flake-anthropic-session-catalog branch September 21, 2026 04:13
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 21, 2026
…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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

extensions: anthropic extensions: xai maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant