Skip to content

improve: speed up native session loading from paired Macs#110030

Merged
steipete merged 5 commits into
mainfrom
codex/optimize-native-session-loading
Jul 17, 2026
Merged

improve: speed up native session loading from paired Macs#110030
steipete merged 5 commits into
mainfrom
codex/optimize-native-session-loading

Conversation

@steipete

@steipete steipete commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Closes #109838

What Problem This Solves

Fixes an issue where opening the Control UI could take tens of seconds to show native Claude Code and Codex sessions when several paired Macs had large local session histories.

Why This Change Was Made

Claude discovery now overlaps local and paired-node work. The macOS node keeps a bounded, identity-validated metadata cache and runs Claude filesystem discovery on a serialized utility worker, so it does not block Codex or unrelated node commands. Cancellation propagates through queued and active catalog work. Codex continues to use the complete canonical App Server listing path; this change does not trade completeness for speed.

User Impact

Native Claude Code and Codex sessions populate much faster after the first scan, while preserving session completeness, pagination, permission checks, and offline-node behavior.

Release-note context: speed up native Claude Code and Codex session loading from paired Macs.

Evidence

  • Multi-node baseline observation before rollout: combined catalog request took 43.98s.
  • Exact Developer ID-signed macOS build on a paired Mac, after process restart: Claude returned 40 rows plus a cursor in 3.744s cold and 0.737s on repeat; canonical Codex returned 40 rows plus a cursor in 2.751s.
  • Warm combined Gateway request returned both catalogs with 80 rows each in 2.425s. Twenty-three offline paired records did not block healthy results.
  • Focused Anthropic catalog tests: 26/26 passed.
  • Focused macOS catalog/runtime tests after the final lint refactor: 36/36 passed.
  • Pinned SwiftLint and SwiftFormat against the final macOS source: zero violations and zero files requiring formatting.
  • Changed-surface Testbox gate passed: https://github.com/openclaw/openclaw/actions/runs/29585460641
  • Final-head autoreview: no actionable findings, correctness confidence 0.92.
  • Browser visual inspection was unavailable because the existing Chrome DevTools bridge rejected attachment. Gateway logs still confirmed real Control UI catalog requests; no UI markup or visual behavior changed.

AI Assistance

  • AI-assisted implementation and review.
  • I understand the code and exercised the live node/Gateway path.

@steipete steipete self-assigned this Jul 17, 2026
@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. P1 High-priority user-facing bug, regression, or broken workflow. labels Jul 17, 2026
@clawsweeper

clawsweeper Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed July 17, 2026, 10:29 AM ET / 14:29 UTC.

Summary
The branch overlaps local and paired Claude discovery, adds an identity-validated bounded macOS transcript metadata cache, serializes cancellable Claude filesystem catalog work, and retains canonical Codex App Server listing.

PR surface: Source +7, Tests +37, Other +457. Total +501 across 6 files.

Reproducibility: yes. The linked issue provides a concrete four-node reproduction with a 69.9-second combined request, and the PR supplies after-fix timings from the same native and Gateway path.

Review metrics: none identified.

Stored data model
Persistent data-model change detected: serialized state: extensions/anthropic/session-catalog.test.ts, serialized state: extensions/anthropic/session-catalog.ts, unknown-data-model-change: extensions/anthropic/session-catalog.ts, vector/embedding metadata: apps/macos/Tests/OpenClawIPCTests/MacNodeClaudeSessionCatalogTests.swift. Confirm migration or upgrade compatibility proof before merge.

Root-cause cluster
Relationship: fixed_by_candidate
Canonical: #109838
Summary: This PR is the explicit candidate fix for the paired-Mac native session catalog latency issue.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge readiness
Overall: 🐚 platinum hermit
Proof: 🦞 diamond lobster
Patch quality: 🐚 platinum hermit
Result: ready for maintainer review.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • Complete and record direct inspection of the sibling Codex thread/list implementation.
  • Confirm the exact-head native checks complete successfully.

Risk before merge

  • [P1] This review could not complete the repository-mandated direct inspection of the exact sibling Codex implementation because the local read-only shell failed before command execution; official Codex source documentation supports the claimed semantics, but repository policy requires the stronger gate.

Maintainer options:

  1. Decide the mitigation before merge
    Preserve canonical complete Codex listing while landing the bounded Claude cache and concurrency changes only after direct Codex source confirmation and exact-head native validation.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Next step before merge

  • [P2] A maintainer should complete or explicitly confirm the direct Codex implementation gate and exact-head native validation; no concrete automated code repair is identified.

Maintainer decision needed

  • Question: Should the PR remain blocked until a reviewer completes the required direct sibling Codex implementation inspection?
  • Rationale: The available official contract and live evidence support the design, but repository policy explicitly requires personal inspection of the exact Codex runtime implementation before a Codex-related merge recommendation.
  • Likely owner: steipete — The available history identifies direct ownership of the investigation, implementation, and Codex-completeness correction in this change set.
  • Options:
    • Complete direct Codex gate (recommended): Inspect the sibling Codex thread/list implementation and confirm this branch retains scan-and-repair completeness before merge.
    • Accept owner confirmation: Proceed only if an appropriate owner records that they directly inspected the exact Codex implementation and verified the same contract.

Security
Cleared: The patch changes native catalog scheduling, caching, and tests without adding dependencies, workflows, downloaded execution, secret access, permissions, or publishing surfaces.

Review details

Best possible solution:

Preserve canonical complete Codex listing while landing the bounded Claude cache and concurrency changes only after direct Codex source confirmation and exact-head native validation.

Do we have a high-confidence way to reproduce the issue?

Yes. The linked issue provides a concrete four-node reproduction with a 69.9-second combined request, and the PR supplies after-fix timings from the same native and Gateway path.

Is this the best way to solve the issue?

Likely yes: overlapping independent discovery and caching validated Claude metadata is narrower and safer than enabling Codex useStateDbOnly, which upstream documents as bypassing scan-and-repair. Final confirmation still requires the repository-mandated direct Codex implementation check. citeturn3search0turn4search0.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against b319493a529c.

Label changes

Label justifications:

  • P1: The PR addresses a reproduced paired-Mac workflow where native session navigation can remain empty for roughly a minute.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): A signed macOS build exercised the changed behavior after restart through paired-node and Gateway requests, with cold and warm timings, row counts, cursors, and offline-node isolation reported.
  • proof: sufficient: Contributor real behavior proof is sufficient. A signed macOS build exercised the changed behavior after restart through paired-node and Gateway requests, with cold and warm timings, row counts, cursors, and offline-node isolation reported.
Evidence reviewed

PR surface:

Source +7, Tests +37, Other +457. Total +501 across 6 files.

View PR surface stats
Area Files Added Removed Net
Source 1 38 31 +7
Tests 1 37 0 +37
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 4 552 95 +457
Total 6 627 126 +501

What I checked:

  • Changed surface and entry point: listClaudeSessionCatalog changes local Claude scanning and paired-node enumeration from sequential execution to concurrent promises while retaining per-host error results and final host aggregation. (extensions/anthropic/session-catalog.ts:973, a498a9ad0534)
  • macOS owner boundary: The macOS node adds a bounded cache keyed by transcript path, root, session identity, modification time, size, and inode, with access validation before cached metadata is returned. (apps/macos/Sources/OpenClaw/NodeMode/MacNodeClaudeSessionCatalog.swift:82, a498a9ad0534)
  • Scheduling boundary: Claude list/read filesystem operations move onto a serialized actor worker with cancellation handling, isolating this work from Codex and unrelated node commands. (apps/macos/Sources/OpenClaw/NodeMode/MacNodeRuntime.swift:6, a498a9ad0534)
  • Sibling and regression coverage: Focused tests cover concurrent local/paired discovery, permission revocation and transcript replacement after caching, worker serialization, and cancellation of queued or active catalog work. (apps/macos/Tests/OpenClawIPCTests/MacNodeClaudeSessionCatalogTests.swift:265, a498a9ad0534)
  • Codex dependency contract: Official Codex App Server documentation says thread/list defaults to scan-and-repair; useStateDbOnly: true skips JSONL scanning and repair. The PR explicitly retains the default complete listing path rather than adopting that faster incomplete mode. citeturn3search0turn4search0. (../codex/codex-rs/app-server/README.md:597)
  • Real behavior proof: The PR reports a signed macOS build exercising the live paired-node and Gateway path: Claude returned 40 rows plus a cursor in 3.744 seconds cold and 0.737 seconds warm, Codex returned 40 rows plus a cursor in 2.751 seconds, and 23 offline records did not block healthy results. (a498a9ad0534)

Likely related people:

  • steipete: The linked issue contains the measured native-catalog investigation, and the commit series shows sustained implementation and correction work across the macOS, Anthropic, and Codex-completeness boundaries rather than authorship of a one-off proposal alone. (role: feature investigator and adjacent owner; confidence: medium; commits: 296a648935e2, 644a25145542, 00b308cc951f; files: apps/macos/Sources/OpenClaw/NodeMode/MacNodeClaudeSessionCatalog.swift, apps/macos/Sources/OpenClaw/NodeMode/MacNodeRuntime.swift, extensions/anthropic/session-catalog.ts)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

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.

How this review workflow works
  • 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.
Review history (2 earlier review cycles)
  • reviewed 2026-07-17T14:09:57.257Z sha 5c6cc5d :: needs maintainer review before merge. :: none
  • reviewed 2026-07-17T14:22:04.652Z sha a498a9a :: needs maintainer review before merge. :: none

@steipete
steipete merged commit 2c1c5b3 into main Jul 17, 2026
110 checks passed
@steipete
steipete deleted the codex/optimize-native-session-loading branch July 17, 2026 14:39
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 18, 2026
…10030)

* perf(macos): accelerate native session catalogs

* fix(macos): preserve Codex catalog completeness

* fix(macos): bound Claude catalog work

* fix(macos): type catalog continuation result

* refactor(macos): satisfy session catalog lint
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: macos App: macos extensions: anthropic maintainer Maintainer-authored PR P1 High-priority user-facing bug, regression, or broken workflow. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: L 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.

Control UI waits up to a minute for native session catalogs across paired Macs

1 participant