Skip to content

fix(macos): Mac node misses Claude Code sessions when CLAUDE_CONFIG_DIR is set - #163787

Merged
steipete merged 1 commit into
mainfrom
steipete/unruffled-ptolemy-e1ddea
Oct 2, 2026
Merged

steipete merged 1 commit into
mainfrom
steipete/unruffled-ptolemy-e1ddea

Conversation

@steipete

@steipete steipete commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes: a paired macOS app node shows no Claude Code sessions (and does not advertise the Claude session commands) when the user runs Claude Code with CLAUDE_CONFIG_DIR pointing somewhere other than ~/.claude.

User Impact

User impact: the Mac node now lists and opens Claude Code sessions from $CLAUDE_CONFIG_DIR/projects/, the same root the Gateway and headless TypeScript node already use. Behavior is unchanged when the variable is unset or blank. The macOS app reads its own process environment, so a Finder-launched app only sees CLAUDE_CONFIG_DIR when it is part of the app's launch environment.

Why This Change Was Made

The TypeScript scan (extensions/anthropic/session-catalog-scan.ts) resolves the projects root as trimmed CLAUDE_CONFIG_DIR, else HOME/.claude, following Claude Code's "respect CLAUDE_CONFIG_DIR everywhere" convention. The native catalog hardcoded ~/.claude/projects and recomputed it separately for list, read, read-lease store/lookup, and advertisement. It now resolves the root once per entry point with the same precedence and passes it down, so the existing root-containment and symlink checks apply to the resolved root and read pagination leases stay bound to it. Claude Desktop metadata stays HOME/Library-scoped, matching the TypeScript node commands. Tests now pass an explicit environment instead of inheriting the runner's.

Evidence

  • swift test --package-path apps/macos --build-system native --filter MacNodeClaudeSessionCatalogTests: 11/11 passed on this head's base. The new cases cover env set (whitespace-padded): custom root listed and readable, decoy in ~/.claude/projects excluded, an index entry escaping into ~/.claude rejected, Desktop title still applied, page two served from the lease without re-enumeration, advertisement following the custom root. They also cover unset, empty, and whitespace-only env falling back to ~/.claude/projects.
  • Regression probe: with env resolution forced off, the CLAUDE_CONFIG_DIR test fails with 5 issues while the fallback cases pass.
  • swift build --package-path apps/macos --build-system native --product OpenClaw: passed.
  • Changed-file swiftlint --strict --config config/swiftlint.yml, swiftformat --lint, oxfmt on the docs, and git diff --check: clean.
  • Codex autoreview: scoped-clean.

…IR is set

The native macOS node catalog (anthropic.claude.sessions.list.v1/read.v1)
always read ~/.claude/projects, while the TypeScript scan honors
CLAUDE_CONFIG_DIR. Resolve the projects root once per entry point with the
same precedence (trimmed CLAUDE_CONFIG_DIR, else HOME/.claude) and share it
across list, read, read-lease store/lookup, and advertisement, so the
existing root-containment checks apply to the resolved root. Claude Desktop
metadata stays HOME/Library-scoped, matching the TS node commands.

Tests now inject an explicit environment instead of inheriting the runner's.
@clawsweeper

clawsweeper Bot commented Oct 2, 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.

@steipete
steipete marked this pull request as ready for review October 2, 2026 21:08
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation app: macos App: macos extensions: anthropic size: S labels Oct 2, 2026
@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: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Oct 2, 2026
@clawsweeper

clawsweeper Bot commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed October 2, 2026, 5:14 PM ET / 21:14 UTC.

ClawSweeper review

What this changes

The macOS node honors CLAUDE_CONFIG_DIR when advertising, listing, and reading Claude Code sessions, with regression coverage and updated documentation.

Merge readiness

✅ Ready for maintainer review

This repair remains useful: current main still uses the default Claude directory. Codex found no introduced blocking defect.

Likely related people: steipete and vincentkoc, suggested from prior work on this catalog; routing confidence is low.

Priority: P2
Reviewed head: 4724327a36fa695a219df91e25c1f4a09cf6d493

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused repair with meaningful regression coverage and no blocking findings; native execution was reported rather than independently performed.
Proof confidence 🌊 off-meta tidepool Not applicable: Verified repository-admin authorship qualifies for the trusted-author exemption. Reported native tests cover the changed filesystem catalog, but do not establish a paired-app runtime demonstration; no stored-data format changes are introduced.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: Verified repository-admin authorship qualifies for the trusted-author exemption. Reported native tests cover the changed filesystem catalog, but do not establish a paired-app runtime demonstration; no stored-data format changes are introduced.
Evidence reviewed 8 items Pinned change and merge ownership: Inspected the merge-base-to-head patch. The verified test merge has the pinned base followed by the exact PR head as parents, and its changes remain confined to the four introduced paths.
Current main still needs the repair: Current main's advertisement, listing, and reading entrypoints still resolve through the hardcoded home Claude projects directory; they do not consume CLAUDE_CONFIG_DIR.
Existing resolution contract: The TypeScript catalog trims CLAUDE_CONFIG_DIR, resolves nonblank values, and keeps Desktop metadata home-scoped. The Swift repair follows this existing behavior without introducing a new setting.
Findings None None.
Security None None.

How this fits together

The macOS session catalog reads local Claude transcripts and exposes bounded listings and transcript pages to a paired Gateway. Those results populate OpenClaw's session browser.

flowchart LR
  A[App environment and home directory] --> B[Resolve Claude projects directory]
  B --> C[Discover eligible sessions]
  D[Claude Desktop metadata] --> C
  C --> E[Validate transcript paths and read leases]
  E --> F[Paired Gateway]
  F --> G[Session browser]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Docs +5, Other +94. Total +99 across 4 files.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 0 0 0 0
Docs 2 8 3 +5
Config 0 0 0 0
Generated 0 0 0 0
Other 2 121 27 +94
Total 4 129 30 +99

Review metrics

None.

Technical review

Best possible solution:

Keep native discovery and transcript reads aligned with the existing Claude configuration-directory contract while preserving home-scoped Desktop metadata.

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

Yes, from source: launch the macOS node with CLAUDE_CONFIG_DIR pointing to a populated custom projects directory while the default directory is absent; current main checks only the default directory. This review did not execute that scenario.

Is this the best way to solve the issue?

Yes. Resolving the root once per entrypoint and carrying it through discovery, containment checks, and leases is a focused repair consistent with the existing TypeScript catalog.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 887c62b8edac.

Labels

Label changes:

  • add P2: This fixes a bounded macOS session-discovery failure for users with a custom Claude configuration directory.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: Verified repository-admin authorship qualifies for the trusted-author exemption. Reported native tests cover the changed filesystem catalog, but do not establish a paired-app runtime demonstration; no stored-data format changes are introduced.

Label justifications:

  • P2: This fixes a bounded macOS session-discovery failure for users with a custom Claude configuration directory.
  • 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: Verified repository-admin authorship qualifies for the trusted-author exemption. Reported native tests cover the changed filesystem catalog, but do not establish a paired-app runtime demonstration; no stored-data format changes are introduced.

Evidence

What I checked:

  • Pinned change and merge ownership: Inspected the merge-base-to-head patch. The verified test merge has the pinned base followed by the exact PR head as parents, and its changes remain confined to the four introduced paths. (4724327a36fa)
  • Current main still needs the repair: Current main's advertisement, listing, and reading entrypoints still resolve through the hardcoded home Claude projects directory; they do not consume CLAUDE_CONFIG_DIR. (apps/macos/Sources/OpenClaw/NodeMode/MacNodeClaudeSessionCatalog.swift:258, 887c62b8edac)
  • Existing resolution contract: The TypeScript catalog trims CLAUDE_CONFIG_DIR, resolves nonblank values, and keeps Desktop metadata home-scoped. The Swift repair follows this existing behavior without introducing a new setting. (extensions/anthropic/session-catalog-scan.ts:415, 887c62b8edac)
  • Containment and lease safety: Read leases remain keyed by projects root and thread ID. Both lease reuse and discovery fallback revalidate containment and readability before opening the transcript. The new root comes from the app's environment rather than remote request parameters. (apps/macos/Sources/OpenClaw/NodeMode/MacNodeClaudeSessionCatalog.swift:525, 4724327a36fa)
  • Regression coverage: Read the complete test suite. New cases exercise custom-root discovery, outside-root rejection, transcript pagination, Desktop metadata, advertisement, and unset or blank fallback. The captured PR body reports 11 passing cases and a failing regression probe; these were not independently executed. (apps/macos/Tests/OpenClawIPCTests/MacNodeClaudeSessionCatalogTests.swift:165, 4724327a36fa)
  • Trusted author verification: The live pull endpoint reports CONTRIBUTOR, differing from the supplied MEMBER metadata. The repository permission endpoint independently confirms steipete has admin permission, supporting trusted-author treatment.

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • vincentkoc: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

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.

@steipete
steipete merged commit 1b4dbda into main Oct 2, 2026
131 of 134 checks passed
@steipete
steipete deleted the steipete/unruffled-ptolemy-e1ddea branch October 2, 2026 21:36
@steipete

steipete commented Oct 2, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 3, 2026
…IR is set (openclaw#163787)

The native macOS node catalog (anthropic.claude.sessions.list.v1/read.v1)
always read ~/.claude/projects, while the TypeScript scan honors
CLAUDE_CONFIG_DIR. Resolve the projects root once per entry point with the
same precedence (trimmed CLAUDE_CONFIG_DIR, else HOME/.claude) and share it
across list, read, read-lease store/lookup, and advertisement, so the
existing root-containment checks apply to the resolved root. Claude Desktop
metadata stays HOME/Library-scoped, matching the TS node commands.

Tests now inject an explicit environment instead of inheriting the runner's.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: macos App: macos docs Improvements or additions to documentation extensions: anthropic 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