Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): thread cwd through Claude capability probe (#2048) #2124

Mergedmvanhorn(GitHub profile, opens in a new tab)merged 3 commits intomain fromrefs/pull/2124/headmerged by juliusmarminge View on GitHub

Summary

probeClaudeCapabilities enables settingSources: ["user", "project", "local"] but never passed a cwd to the Claude Agent SDK, so the SDK resolved the "project" and "local" sources against the T3 server process cwd rather than the user's active project. Project-level .claude/skills/ was invisible in composer autocomplete even though those skills still executed when typed manually (#2048).

Why this matters

From #2048 (@r3xsean, area: apps/server):

Project-level skills from .claude/skills/ are not discovered in the composer autocomplete when using the Claude provider. User-level skills from ~/.claude/skills/ appear correctly. Skills execute fine when typed manually - only the autocomplete/discovery is broken.

probeClaudeCapabilities enables settingSources: ["user", "project", "local"] but does not pass cwd, so the SDK resolves project/local sources relative to the T3 server process cwd.

Tested on 0.0.17-nightly.20260415.45 with 40+ project-level skills.

Changes

apps/server/src/provider/Layers/ClaudeProvider.ts:

  • probeClaudeCapabilities(binaryPath, cwd?) now takes an optional cwd and spreads { cwd } into the claudeQuery options when set. When cwd is undefined the SDK keeps its previous behavior.
  • subscriptionProbeCache key becomes ${binaryPath}|${cwd ?? ""}. Capacity bumped from 1 to 8 so switching between projects doesn't force a re-probe each time (the probe talks to the SDK's init path, which is not free).
  • Cache lookup parses the composite key back into (binaryPath, cwd) before calling the probe.
  • Added a short comment on the probe explaining the cwd contract so future edits don't regress.

What this PR does NOT do

The two arrow functions at lines 781-789 that feed subscriptionType and slashCommands into checkClaudeProviderStatus still receive binaryPath only. The final wire-up threads session.cwd from ProviderService (which already has it on hand at apps/server/src/provider/Layers/ProviderService.ts:110) into those lookups.

I'm happy to follow up with that caller change as a separate PR once this one lands and you confirm the shape of the probe is what you want. Keeping this PR tight to the probe layer so the diff is easy to review. If you'd prefer the wire-up in one PR, let me know and I'll expand.

Testing

cd apps/server && bun run typecheck passes with exit 0.

No behavior change when the caller still passes undefined for cwd - the probe keeps its current fallback path.

Request

@r3xsean on the thread has a 40-skill .claude/skills/ setup and reproduced the bug cleanly. Once the caller is wired, they're a good candidate for verification.

Fixes #2048 (probe layer only - caller wire-up to follow).

This contribution was developed with AI assistance (Claude Code).


Note

Low Risk Scoped to Claude provider status/capability probing and caching; no auth or session execution path changes in this diff, with undefined cwd preserving prior SDK behavior.

Overview Fixes broken composer autocomplete for project-level Claude skills when the capability probe used settingSources: ["user", "project", "local"] without a working directory—the SDK was resolving project and local config relative to the server process cwd, not the user's workspace.

probeClaudeCapabilities accepts an optional cwd and forwards it to claudeQuery when set. ClaudeDriver reads cwd from ServerConfig, passes it into the probe, and extends makeClaudeCapabilitiesCacheKey with a third segment (binaryPath, resolved Claude HOME, cwd) so cached probe results (slash commands, account metadata) are not reused across different workspace roots.

Tests cover the updated cache key shape and assert distinct keys for different cwd values.

Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit d40ac3cb5dae442609ed9bbcd394053d0bcf3acb. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).

Note

Thread cwd through Claude capability probe and cache key

  • probeClaudeCapabilities in ClaudeProvider.ts now accepts an optional cwd and passes it to the Claude subprocess, so project-level settings are respected during probing.
  • makeClaudeCapabilitiesCacheKey in ClaudeHome.ts appends a NUL-delimited cwd segment to the cache key, scoping cached capability results per working directory.
  • ClaudeDriver.ts reads cwd from ServerConfig and passes it to both functions.
  • Behavioral Change: existing cached capability entries keyed without cwd will no longer match the new key format, causing a one-time re-probe on first use.
Macroscope summarized 707a250.
    1. coderabbitai[bot](GitHub profile, opens in a new tab)commented

      Important

      Review skipped

      Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

      ⚙️ Run configuration

      Configuration used: Repository UI

      Review profile: CHILL

      Plan: Pro

      Run ID: 9515d4ef-dcd1-46d3-9013-5dc8bbe3c439

      You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

      Use the checkbox below for a quick retry:

      • 🔍 Trigger review
      ✨ Finishing Touches
      🧪 Generate unit tests (beta)
      • Create PR with unit tests

      Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

      ❤️ Share
      Comment `@coderabbitai help` to get the list of available commands.
    2. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched

    3. macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      🟢 Low Layers/ClaudeProvider.ts:791

      The probeKey function includes cwd in the cache key format ${binaryPath}|${cwd ?? ""}, but the resolve callbacks in checkClaudeProviderStatus only receive binaryPath and never pass cwd. This means cwd is always undefined, the cache key is always ${binaryPath}|, and the SDK never receives the project directory for resolving .claude/skills/ commands despite the comment explaining this is the purpose (#2048).

      ✅ Resolved in 614529d5fa48fa8ae0693c030f5dada639bbce74

    4. macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      Approvability

      Verdict: Approved

      Straightforward bug fix that threads cwd through capability probing to ensure cache keys are unique per working directory. The changes are mechanical parameter passing with clear intent and appropriate test coverage.

      You can customize Macroscope's approvability policy. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    5. Good catch. Fixed in 614529d5.

      ClaudeProviderLive now resolves cwd from ServerConfig at layer construction and threads it into both Cache.get calls, so the cache key actually reflects the active workspace instead of always being ${binaryPath}|. ServerConfig.cwd is the same value serverRuntimeStartup treats as workspaceRoot (serverRuntimeStartup.ts:199), so no new service surface was needed.

      Added three unit tests for the per-cwd key contract (distinct cwds, undefined/empty equivalence, distinct binaries).

    6. juliusmarminge merged this4e3f2f0

    7. juliusmarminge closed this

    8. Thanks for taking this, @juliusmarminge - the capability probe respecting cwd fixes the confusing failures from #2048.

Sign in to join this conversation.