Skip to content

fix(desktop): re-enable mcp_command reconciliation and harden spawn site#909

Merged
wesbillman merged 1 commit into
mainfrom
brain/stale-mcp-command
Jun 8, 2026
Merged

fix(desktop): re-enable mcp_command reconciliation and harden spawn site#909
wesbillman merged 1 commit into
mainfrom
brain/stale-mcp-command

Conversation

@wesbillman

Copy link
Copy Markdown
Collaborator

Problem

Agents created before the sprout-mcp-server binary was removed (#850, shipped in 0.3.12) still have "mcp_command": "sprout-mcp-server" baked into agents/managed-agents.json. In spawn_agent_child, a non-empty mcp_command must resolve to a real binary on PATH or spawn fails hard — so these agents now show as stopped and can't re-spawn.

#850 added a reconcile that was meant to clear the stale value, but it only ran against app_data_dir, missing configs under worktree-style data dirs. That reconcile was then removed entirely in #877 (0.3.13), so nothing self-heals stale configs anymore.

The user-reported workaround (symlinking anything named sprout-mcp-server onto PATH) confirms the root cause: it satisfies resolve_command() and spawn succeeds again.

Fix

Add a targeted one-shot migration clear_stale_mcp_command that:

Wired into lib.rs setup alongside the existing migrations. No runtime.rs change is needed — the empty-string spawn path (is_empty()None) is already correct.

Tests

4 new unit tests: stale value cleared; custom / empty / absent values untouched.

just desktop-tauri-test434 passed, 0 failed (full desktop tauri suite).

@wesbillman wesbillman requested a review from a team as a code owner June 8, 2026 20:01
@wpfleger96 wpfleger96 force-pushed the brain/stale-mcp-command branch from 69274aa to 8ef8eac Compare June 8, 2026 20:25
@wesbillman wesbillman changed the title fix(desktop): clear stale sprout-mcp-server mcp_command fix(desktop): re-enable mcp_command reconciliation and harden spawn site Jun 8, 2026
Re-enable the generic `reconcile_provider_mcp_commands` migration that
was accidentally removed from the startup sequence in PR #877. This
reconciles `mcp_command` values in managed-agents.json against the
discovery table on every launch — fixing stale "sprout-mcp-server"
references and any future drift without a dedicated one-off function.

Extended to cover both `app_data_dir()` and `canonical_dev_data_dir`
so worktree instances are also healed.

Additionally, harden the spawn site in runtime.rs: if `mcp_command`
references a binary that cannot be resolved, log a warning and continue
spawning without MCP rather than hard-failing. This prevents this entire
class of breakage permanently, regardless of whether reconciliation ran.

Fixes the user-reported issue where agents created before v0.3.12 fail
to spawn because "sprout-mcp-server" no longer exists.

Co-authored-by: Brain <21994759fc7a6fa6b965551d35cfd7897d262f2495467f2d78694ddcfa6a5c7e@sprout-oss.stage.blox.sqprod.co>
Co-authored-by: Duncan <dcfd242e557282d7a1e2cf2e6877522682f1e5c6156dc92ca7d90eaedd3b0f95@sprout-oss.stage.blox.sqprod.co>
Signed-off-by: Wes <wesbillman@users.noreply.github.com>
@wesbillman wesbillman force-pushed the brain/stale-mcp-command branch from 8ef8eac to 02cc882 Compare June 8, 2026 20:39
@wesbillman wesbillman merged commit 15f610d into main Jun 8, 2026
15 checks passed
@wesbillman wesbillman deleted the brain/stale-mcp-command branch June 8, 2026 20:54
tlongwell-block pushed a commit that referenced this pull request Jun 9, 2026
* origin/main: (32 commits)
  docs: add NIP-ER event reminders (#875)
  feat(acp): pass slash commands through to ACP connectors (#919)
  fix(sdk): resolve multi-word display names and add NIP-27 nostr:npub mention extraction (#905)
  fix(desktop): re-enable mcp_command reconciliation and harden spawn site (#909)
  Fix desktop DM and sidebar UI polish (#908)
  Animate reaction counts (#904)
  Mobile custom emoji + settings redesign (#906)
  Renew TTL when unarchiving ephemeral channels (#902)
  chore(release): release version 0.3.13 (#903)
  Collapse channel header actions (#901)
  sprout-agent: make Databricks defaults env-only (#868)
  Restyle settings sections (#894)
  Add emoji reaction particles (#890)
  Move settings into the app shell (#893)
  Tune chat text sizing (#891)
  Style channel header navigation (#889)
  fix: rename missed known_acp_provider_exact → known_acp_runtime_exact (#900)
  chore(deps): update radix-ui-primitives monorepo (#898)
  chore(deps): update actions/checkout digest to df4cb1c (#897)
  refactor: rename ACP "provider" to "runtime" across the codebase (#783)
  ...

# Conflicts:
#	desktop/src/features/agents/ui/CreateAgentDialog.tsx
tlongwell-block pushed a commit that referenced this pull request Jun 9, 2026
* origin/main: (32 commits)
  docs: add NIP-ER event reminders (#875)
  feat(acp): pass slash commands through to ACP connectors (#919)
  fix(sdk): resolve multi-word display names and add NIP-27 nostr:npub mention extraction (#905)
  fix(desktop): re-enable mcp_command reconciliation and harden spawn site (#909)
  Fix desktop DM and sidebar UI polish (#908)
  Animate reaction counts (#904)
  Mobile custom emoji + settings redesign (#906)
  Renew TTL when unarchiving ephemeral channels (#902)
  chore(release): release version 0.3.13 (#903)
  Collapse channel header actions (#901)
  sprout-agent: make Databricks defaults env-only (#868)
  Restyle settings sections (#894)
  Add emoji reaction particles (#890)
  Move settings into the app shell (#893)
  Tune chat text sizing (#891)
  Style channel header navigation (#889)
  fix: rename missed known_acp_provider_exact → known_acp_runtime_exact (#900)
  chore(deps): update radix-ui-primitives monorepo (#898)
  chore(deps): update actions/checkout digest to df4cb1c (#897)
  refactor: rename ACP "provider" to "runtime" across the codebase (#783)
  ...

Signed-off-by: npub1qyvc0c5kl4gqv2fd97fsk46tu378sqgy35vc83rvgfwne90sel7s0ed67d <011987e296fd5006292d2f930b574be47c7801048d1983c46c425d3c95f0cffd@sprout-oss.stage.blox.sqprod.co>

# Conflicts:
#	desktop/src/features/agents/ui/CreateAgentDialog.tsx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants