Skip to content

fix(claude): isolate capability probe from user MCP servers#4015

Merged
juliusmarminge merged 1 commit into
pingdotgg:mainfrom
jbbottoms:fix/claude-capability-probe-no-mcp
Jul 22, 2026
Merged

fix(claude): isolate capability probe from user MCP servers#4015
juliusmarminge merged 1 commit into
pingdotgg:mainfrom
jbbottoms:fix/claude-capability-probe-no-mcp

Conversation

@jbbottoms

@jbbottoms jbbottoms commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

What Changed

  • Claude capability probe (probeClaudeCapabilities) now passes empty mcpServers with strictMcpConfig: true, so the ~5 minute refresh loop does not boot user/project/local MCP servers.
  • Probe env sets ENABLE_CLAUDEAI_MCP_SERVERS=false to block claude.ai connectors on the same path.
  • Probe runs from ~/.t3/claude-capability-probe instead of inheriting the server process cwd (often $HOME).
  • Added unit coverage for the probe option builder.

Why

Fixes #3909. The capability probe loaded settingSources: ["user","project","local"] without MCP isolation. Every refresh spawned configured stdio MCP servers from the server cwd. A wedged MCP (e.g. serena scanning $HOME) accumulated orphans and froze the host (~46 GiB RSS in the report).

Real chat sessions are unchanged -- only the lightweight init probe is isolated.

Validation

  • pnpm exec vp test run src/provider/Layers/ClaudeCapabilitiesProbe.test.ts -> 2/2 passed

Notes

Note

Isolate probeClaudeCapabilities from user MCP server configuration

The capability probe was previously susceptible to user-configured MCP servers interfering with results. buildClaudeCapabilitiesProbeQueryOptions now constructs probe options with mcpServers={}, strictMcpConfig=true, and ENABLE_CLAUDEAI_MCP_SERVERS=false, while retaining user/project/local setting sources. Tests verify that probe invocations match these strict no-MCP expectations.

Macroscope summarized 33f8b50.

Summary by CodeRabbit

  • Bug Fixes

    • Improved Claude capability detection reliability by isolating probes from user and project MCP configurations.
    • Prevented capability checks from persisting sessions or invoking unintended tools.
    • Ensured probe data uses a stable working directory and avoids repeated side effects.
  • Tests

    • Added coverage for Claude probe configuration, environment handling, and working-directory resolution.

Note

Medium Risk
Changes only the periodic Claude init probe, but it alters how the Agent SDK is invoked (MCP isolation); misconfiguration could break provider verification without affecting normal sessions.

Overview
Fixes capability health checks repeatedly spawning user/project/local MCP servers (and claude.ai connectors), which could wedge the host during the ~5 minute refresh loop.

Introduces buildClaudeCapabilitiesProbeQueryOptions so probeClaudeCapabilities uses a single, explicit SDK options shape: mcpServers: {} with strictMcpConfig: true, allowedTools: [], unchanged settingSources (user, project, local) for slash-command discovery, and probe env ENABLE_CLAUDEAI_MCP_SERVERS=false even when the caller env has it enabled. Real chat sessions are untouched—only this lightweight init probe.

Adds ClaudeCapabilitiesProbe.test.ts for the builder assertions and a fake-Claude integration test that verifies strict no-MCP CLI flags while account/slash-command data still resolves.

Reviewed by Cursor Bugbot for commit 33f8b50. Bugbot is set up for automated code reviews on this repo. Configure here.

@coderabbitai

coderabbitai Bot commented Jul 15, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Claude capability probes now use exported configuration helpers that disable user MCP loading, prevent session persistence, and apply a stable working directory under ~/.t3. Tests cover query isolation and probe CWD resolution.

Changes

Claude probe isolation

Layer / File(s) Summary
Probe configuration helpers and tests
apps/server/src/provider/Layers/ClaudeProvider.ts, apps/server/src/provider/Layers/ClaudeCapabilitiesProbe.test.ts
Adds settings-source configuration, stable CWD resolution, isolated query options, and tests for MCP suppression, environment wiring, and path resolution.
Stable probe-directory execution
apps/server/src/provider/Layers/ClaudeProvider.ts
Creates the probe directory and passes its CWD and generated options into probeClaudeCapabilities.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Suggested reviewers: juliusmarminge, marve10s

Sequence Diagram(s)

sequenceDiagram
  participant CapabilityProbe
  participant ProbeDirectory
  participant ClaudeQuery
  CapabilityProbe->>ProbeDirectory: create ~/.t3/claude-capability-probe
  CapabilityProbe->>ClaudeQuery: provide isolated MCP options and probe cwd
  ClaudeQuery-->>CapabilityProbe: execute capability probe
Loading

Poem

I’m a rabbit with a tidy new trail,
No MCP servers leap through the veil.
A quiet CWD, a cautious query,
Keeps each probe small, calm, and cheery.
Hop hop—safe checks prevail!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The changes satisfy #3909 by disabling MCP loading for probes and using a dedicated probe cwd.
Out of Scope Changes check ✅ Passed The added helper extraction, environment flag, and tests all support the linked probe-isolation fix.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Title check ✅ Passed The title is concise and accurately summarizes the main change: isolating the Claude capability probe from user MCP servers.
Description check ✅ Passed The description covers What Changed, Why, and Validation, and is mostly complete despite omitting the checklist section.
✨ 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.

@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:M 30-99 changed lines (additions + deletions). labels Jul 15, 2026
@jbbottoms

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 15, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Comment thread apps/server/src/provider/Layers/ClaudeProvider.ts Outdated
@macroscopeapp

macroscopeapp Bot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved

This is a well-scoped bug fix that isolates the Claude capability probe from user-configured MCP servers. The change extracts existing options into a testable helper and adds isolation flags to prevent MCP servers from interfering with health checks. Comprehensive tests validate the new behavior.

You can customize Macroscope's approvability policy. Learn more.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@apps/server/src/provider/Layers/ClaudeProvider.ts`:
- Around line 647-650: Remove the `.pipe(Effect.orDie)` from the
`Effect.tryPromise` handling `NodeFS.promises.mkdir` in the probe flow, allowing
directory creation failures to remain in the expected error channel and be
mapped to `undefined` capabilities by the existing downstream handling.
- Line 646: Update the call to resolveClaudeCapabilitiesProbeCwd in the Claude
provider probe flow to pass the configured HOME from claudeEnvironment, ensuring
account-specific or isolated environments use their intended probe directory
instead of the default system home.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: de151275-5b58-47e2-ae0c-690bb9ac5625

📥 Commits

Reviewing files that changed from the base of the PR and between ecb35f7 and 1baa467.

📒 Files selected for processing (2)
  • apps/server/src/provider/Layers/ClaudeCapabilitiesProbe.test.ts
  • apps/server/src/provider/Layers/ClaudeProvider.ts

Comment thread apps/server/src/provider/Layers/ClaudeProvider.ts Outdated
Comment thread apps/server/src/provider/Layers/ClaudeProvider.ts Outdated
Comment thread apps/server/src/provider/Layers/ClaudeProvider.ts Outdated
macroscopeapp[bot]
macroscopeapp Bot previously approved these changes Jul 15, 2026
@macroscopeapp
macroscopeapp Bot dismissed their stale review July 15, 2026 19:35

Dismissing prior approval to re-evaluate fe6c6b4

Comment thread apps/server/src/provider/Layers/ClaudeProvider.ts Outdated
macroscopeapp[bot]
macroscopeapp Bot previously approved these changes Jul 15, 2026
@juliusmarminge

Copy link
Copy Markdown
Member

Probe runs from ~/.t3/claude-capability-probe instead of inheriting the server process cwd (often $HOME).

doesn't this mean we miss skills/commands?

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 56aa4cc. Configure here.

Comment thread apps/server/src/provider/Layers/ClaudeProvider.ts
Preserve workspace cwd and command discovery while preventing periodic capability checks from loading configured MCP servers or claude.ai connectors.

Co-authored-by: codex <codex@users.noreply.github.com>
@juliusmarminge
juliusmarminge force-pushed the fix/claude-capability-probe-no-mcp branch from 56aa4cc to 33f8b50 Compare July 22, 2026 13:21
@macroscopeapp
macroscopeapp Bot dismissed their stale review July 22, 2026 13:21

Dismissing prior approval to re-evaluate 33f8b50

@juliusmarminge
juliusmarminge merged commit aa5ec80 into pingdotgg:main Jul 22, 2026
16 checks passed
UNN-Devotek pushed a commit to unn-corp/t3code that referenced this pull request Jul 23, 2026
…g#4015)

Co-authored-by: codex <codex@users.noreply.github.com>
AnanduB13 pushed a commit to AnanduB13/t3code that referenced this pull request Jul 23, 2026
…g#4015)

Co-authored-by: codex <codex@users.noreply.github.com>
cursor Bot pushed a commit to aaditagrawal/t3code that referenced this pull request Jul 25, 2026
…g#4015)

Co-authored-by: codex <codex@users.noreply.github.com>
(cherry picked from commit aa5ec80)
cursor Bot pushed a commit to aaditagrawal/t3code that referenced this pull request Jul 25, 2026
…g#4015)

Co-authored-by: codex <codex@users.noreply.github.com>
(cherry picked from commit aa5ec80)
cursor Bot pushed a commit to aaditagrawal/t3code that referenced this pull request Jul 25, 2026
…g#4015)

Co-authored-by: codex <codex@users.noreply.github.com>
(cherry picked from commit aa5ec80)
cursor Bot pushed a commit to aaditagrawal/t3code that referenced this pull request Jul 25, 2026
…g#4015)

Co-authored-by: codex <codex@users.noreply.github.com>
(cherry picked from commit aa5ec80)
cursor Bot pushed a commit to aaditagrawal/t3code that referenced this pull request Jul 25, 2026
…g#4015)

Co-authored-by: codex <codex@users.noreply.github.com>
(cherry picked from commit aa5ec80)
cursor Bot pushed a commit to aaditagrawal/t3code that referenced this pull request Jul 25, 2026
…g#4015)

Co-authored-by: codex <codex@users.noreply.github.com>
(cherry picked from commit aa5ec80)
cursor Bot pushed a commit to aaditagrawal/t3code that referenced this pull request Jul 25, 2026
…g#4015)

Co-authored-by: codex <codex@users.noreply.github.com>
(cherry picked from commit aa5ec80)
cursor Bot pushed a commit to aaditagrawal/t3code that referenced this pull request Jul 25, 2026
…g#4015)

Co-authored-by: codex <codex@users.noreply.github.com>
(cherry picked from commit aa5ec80)
cursor Bot pushed a commit to aaditagrawal/t3code that referenced this pull request Jul 25, 2026
…g#4015)

Co-authored-by: codex <codex@users.noreply.github.com>
(cherry picked from commit aa5ec80)
cursor Bot pushed a commit to aaditagrawal/t3code that referenced this pull request Jul 25, 2026
…g#4015)

Co-authored-by: codex <codex@users.noreply.github.com>
(cherry picked from commit aa5ec80)
cursor Bot pushed a commit to aaditagrawal/t3code that referenced this pull request Jul 25, 2026
…g#4015)

Co-authored-by: codex <codex@users.noreply.github.com>
(cherry picked from commit aa5ec80)
cursor Bot pushed a commit to aaditagrawal/t3code that referenced this pull request Jul 25, 2026
…g#4015)

Co-authored-by: codex <codex@users.noreply.github.com>
(cherry picked from commit aa5ec80)
cursor Bot pushed a commit to aaditagrawal/t3code that referenced this pull request Jul 25, 2026
…dotgg#2284) (#184)

* Sidebar v2 beta: flat thread list with a server-backed settled lifecycle (pingdotgg#4026)

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Co-authored-by: maria-rcks <maria@kuuro.net>
(cherry picked from commit 32c6012)

* fix(settings): validate the add-provider wizard step before advancing (pingdotgg#2813) (pingdotgg#3100)

Co-authored-by: Julius Marminge <julius0216@outlook.com>
Co-authored-by: codex <codex@users.noreply.github.com>
(cherry picked from commit 282ecb3)

* fix(claude): isolate capability probe from user MCP servers (pingdotgg#4015)

Co-authored-by: codex <codex@users.noreply.github.com>
(cherry picked from commit aa5ec80)

* Preserve connecting status while a turn starts (pingdotgg#4101)

Co-authored-by: codex <codex@users.noreply.github.com>
(cherry picked from commit 783692a)

* fix(server): stop restoring stale OpenCode models (pingdotgg#4095)

Co-authored-by: codex <codex@users.noreply.github.com>
(cherry picked from commit 4e09cdd)

* [codex] keep scoped package references as text (pingdotgg#4167)

Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: Julius Marminge <julius0216@outlook.com>
(cherry picked from commit c7b21ff)

* fix(web): default provider selection for users without Codex (pingdotgg#4117)

Co-authored-by: Julius Marminge <julius0216@outlook.com>
Co-authored-by: codex <codex@users.noreply.github.com>
(cherry picked from commit b6e1b39)

* Unify temporary worktree branch naming (pingdotgg#4278)

(cherry picked from commit 571a8b4)

* fix(web): use message-square icon for settled icon-less project threads in sidebar v2 (pingdotgg#4279)

(cherry picked from commit 020179c)

* Stabilize sidebar settling animations (pingdotgg#4280)

(cherry picked from commit 18b4688)

* Restore Copy Link in chat link context menu (pingdotgg#4161)

Co-authored-by: Julius Marminge <julius0216@outlook.com>
(cherry picked from commit e5fba26)

* fix(desktop): handle EPIPE errors on stdout/stderr to prevent crash dialog (pingdotgg#4213)

(cherry picked from commit f74eb62)

* Preserve draft thread highlighting during promotion (pingdotgg#4283)

Co-authored-by: codex <codex@users.noreply.github.com>
(cherry picked from commit 18fa89c)

* Move mobile working timer into the thread timeline (pingdotgg#4285)

(cherry picked from commit 7e2bb47)

* Stabilize PR status lookups and provider session lifecycle (pingdotgg#4281)

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
(cherry picked from commit 376c149)

* fix: open command palette instead of custom dialog for new thread picker in SidebarV2 (pingdotgg#4269)

(cherry picked from commit 9fe4832)

* fix(server): don't drop sticky PR fallback when remote URL can't be resolved (pingdotgg#4289)

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
(cherry picked from commit 9a0a071)

* feat(web): copy branch name via right-click in the branch selector (pingdotgg#4275)

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
(cherry picked from commit 78a0ea5)

* Add remote server updates and standalone service management (pingdotgg#4286)

Co-authored-by: codex <codex@users.noreply.github.com>
(cherry picked from commit ab4a883)

* Refine light-mode sidebar surfaces (pingdotgg#4268)

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Co-authored-by: codex <codex@users.noreply.github.com>
(cherry picked from commit 593289c)

* fix(mobile): don't mark Android VPN/Tailscale as offline when connected (pingdotgg#3949)

(cherry picked from commit bc9428a)

* improve and prevent silent thread branch drift and PR fetching (pingdotgg#2284)

Co-authored-by: Julius Marminge <julius0216@outlook.com>
Co-authored-by: codex <codex@users.noreply.github.com>
(cherry picked from commit 2d31cb0)

* fix(sync): restore fork migration IDs under Sidebar v2 settled

Upstream pingdotgg#4026 replaced Migrations.ts with linear upstream numbering and
dropped fork-only migrations (NormalizeLegacyProviderKinds,
RepairProposedPlanColumns, BackfillForkProviderInstanceIds). Restore the
fork registry and append ProjectionThreadsSettled as ID 36.

Co-authored-by: aaditagrawal <aaditagrawal@users.noreply.github.com>

---------

Co-authored-by: Theo Browne <me@t3.gg>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Co-authored-by: maria-rcks <maria@kuuro.net>
Co-authored-by: Leonel Rivas <encriptandost@gmail.com>
Co-authored-by: Julius Marminge <julius0216@outlook.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: Jaret Bottoms <jaretbottoms@gmail.com>
Co-authored-by: Ishan <ishansachu1@gmail.com>
Co-authored-by: Yukun Shan <92423096+nateEc@users.noreply.github.com>
Co-authored-by: Maxwell Young <maxtheyoung@gmail.com>
Co-authored-by: Miklós Fazekas <mfazekas@szemafor.com>
Co-authored-by: Utkarsh Patil <73941998+UtkarshUsername@users.noreply.github.com>
Co-authored-by: Henry Zhang <113233555+caezium@users.noreply.github.com>
Co-authored-by: Rushikesh Gaikwad <81632222+Wraient@users.noreply.github.com>
Co-authored-by: legs <145564979+justsomelegs@users.noreply.github.com>
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: aaditagrawal <aaditagrawal@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M 30-99 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

2 participants