Skip to content

fix(mcp): retry and surface silent search_capabilities injection failures - #2773

Closed
reachjalil wants to merge 1 commit into
different-ai:devfrom
reachjalil:feature/cloud-mcp-tool-guard
Closed

reachjalil wants to merge 1 commit into
different-ai:devfrom
reachjalil:feature/cloud-mcp-tool-guard

Conversation

@reachjalil

@reachjalil reachjalil commented Jul 15, 2026 •

Copy link
Copy Markdown
Member

This PR prevents a Cloud MCP tool-injection problem from looking like search_capabilities simply disappeared after an app restart. If the search tool is not available for the active workspace, provider, and model, OpenWork now treats that as a real failure instead of silently marking maintenance as skipped: it retries automatically, keeps an actionable warning visible, and records the exact failure stage for diagnosis. This means the issue either self-recovers or becomes visible to the user and support team instead of leaving the assistant without search capabilities and no explanation.

What this changes

  • distinguish Cloud MCP readiness failures from intentional skipped states
  • retry transient session tool-restoration failures and surface persistent task-level notices when recovery does not complete
  • validate readiness against the active provider and model, not only generic endpoint health
  • preserve structured startup, reload, and reconcile failures in server logs instead of swallowing them
  • add regression coverage for a retryable injection failure that recovers on the third attempt

Why the search tool could disappear silently

Session MCP maintenance previously collapsed any unusable reconcile result into skipped, and caught maintenance errors without leaving a user-visible failure or durable diagnostic. The startup and engine-reload paths also discarded thrown synchronization errors. Because the selected provider and model were not included in the session health check, generic endpoint health could look ready while the active model still had no injected Cloud MCP tools.

Together, those behaviors made a registration, authentication, or model-projection failure look like the assistant had silently lost search_capabilities after restart.

The captured incident also exposed an important distinction: the live meta-MCP remained connected and returned both search_capabilities and execute_capability; the observed calls failed farther downstream because of invalid Microsoft provider aliases and a Microsoft Graph 401. This change does not misreport those provider failures as MCP transport loss. It makes actual tool-injection and readiness failures visible, diagnosable, and recoverable.

User impact

  • Transient restoration failures retry after 1 second and 3 seconds.
  • The task screen keeps a warning visible while automatic restoration is running and shows a persistent error if it cannot recover.
  • The notice links directly to Connect and clears after recovery.
  • Focus, online, and periodic maintenance can re-check readiness after the initial retry budget.
  • Explicitly disabled, removed, or signed-out Cloud MCP states remain quiet and are not automatically overridden.
  • Server logs now identify the workspace, trigger, failure code, and stage for startup/reload synchronization and reconcile failures.

Security and trust boundaries

  • Inspector events, toasts, and server logs do not include access tokens, authorization headers, or connector payloads.
  • User-facing diagnostics reuse the existing redacted Cloud MCP health code, stage, message, and recommended action.
  • The change does not alter Den credential ownership, tenant boundaries, or OAuth token handling.

Validation

  • pnpm --filter @openwork/app typecheck — passed
  • pnpm --filter openwork-server typecheck — passed
  • pnpm --filter @openwork/app exec bun test --isolate tests/session-mcp-maintenance.test.ts — 8 passed, 0 failed
  • pnpm --filter openwork-server exec bun test src/cloud-mcp-reconcile.e2e.test.ts src/mcp.engine-sync.e2e.test.ts — 34 passed, 0 failed

Remaining verification

The packaged desktop restart journey with a real organization and deliberate network/tool-injection fault has not yet been run. Windows/Linux coverage and visual evidence were also not collected. This PR is therefore opened as a draft until that final real-desktop failure-and-recovery journey is confirmed.

@vercel

vercel Bot commented Jul 15, 2026 •

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
openwork-landing Ready Ready Preview, Comment, Open in v0 Jul 15, 2026 2:04am
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
openwork-diagnostics Skipped Skipped Jul 15, 2026 2:04am

@vercel

vercel Bot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

@reachjalil is attempting to deploy a commit to the Different AI Team on Vercel.

A member of the Team first needs to authorize it.

@vercel
vercel Bot temporarily deployed to Preview – openwork-diagnostics July 15, 2026 02:03 Inactive
@reachjalil reachjalil changed the title fix(mcp): surface Cloud tool restoration failures fix(mcp): retry and surface silent search_capabilities injection failures Jul 15, 2026
@reachjalil
reachjalil marked this pull request as ready for review July 15, 2026 02:41
@reachjalil

Copy link
Copy Markdown
Member Author

Superseded by #2779, which combines this silent-failure fix with the graceful pre-send Cloud tool readiness gate, focused regression coverage, and validated end-to-end screenshot evidence.

@reachjalil reachjalil closed this Jul 15, 2026

This branch was successfully deployed

1 active and 1 inactive deployments
Preview – openwork-landing — 5b4fc97a Deployed Jul 15, 2026 by vercel[bot]
Preview – openwork-diagnostics — 5b4fc97a Deployed Jul 15, 2026 by vercel[bot]
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.

1 participant