Skip to content

fix(den): attribute our own MCP lifecycle deadline to OpenWork - #3088

Merged
benjaminshafii merged 1 commit into
devfrom
cursor/den-mcp-lifecycle-deadline
Jul 24, 2026
Merged

fix(den): attribute our own MCP lifecycle deadline to OpenWork#3088
benjaminshafii merged 1 commit into
devfrom
cursor/den-mcp-lifecycle-deadline

Conversation

@benjaminshafii

Copy link
Copy Markdown
Member

What

A capability that outran OpenWork's bounded deadline was reported to the member as an unrecognized provider error, instructing them to "look up the provider-declared JSON-RPC error code with the provider" — for a timeout the provider never declared:

The provider rejected the call: provider error — The provider answered with a JSON-RPC error OpenWork does not recognize (code -32001). Provider-declared message (untrusted): "MCP error -32001: Error: Enterprise MCP tool-execution exceeded its lifecycle deadline."

That quoted "provider" message is our own abort text from packages/enterprise-mcp-client.

Why it happened

The lifecycle timer aborted with a plain Error. The MCP SDK rethrows an abort reason untouched only when it is already an McpError; anything else is collapsed into String(reason) on a fresh RequestTimeout (shared/protocol.js):

const error = reason instanceof McpError ? reason : new McpError(ErrorCode.RequestTimeout, String(reason));

So all structure was lost. Den's classifier saw code -32001 with no data.timeout, and its only remaining branch for that code was "provider-declared".

Change

  • Abort with an EnterpriseMcpLifecycleDeadlineError (an McpError subclass) carrying a marker on data, so the SDK passes it through intact.
  • Check that marker in classifyError before any JSON-RPC code is read as the provider's, classifying it as the existing retryable MCP_LIFECYCLE_DEADLINE.
  • Phase-aware wording: a tool call now reads "The capability did not finish within the time OpenWork allows a single tool call."

Detection is structural, not message-based — Den labels provider messages untrusted, so trust decisions must not depend on their text.

Tests

npx tsx --test test/*.test.ts in packages/enterprise-mcp-client59 pass, 0 fail (4 new: the abort is an McpError, the marker survives the SDK round trip, detection through a wrapped cause chain, and a provider's own RequestTimeout is not claimed as ours).

bun test test/external-mcp-diagnostics.test.ts in ee/apps/den-api61 pass, 19 fail, versus 59 pass, 19 fail on origin/dev at baseline (verified by stashing). The same 19 fail before and after; my 2 new tests pass. Typecheck clean for both touched packages.

No fraimz: this is hosted Den API classification with no desktop UI path of its own, and the 31s failure needs a provider that stalls past the deadline. The unit tests assert the exact member-visible message and that operatorAction no longer mentions a JSON-RPC code. Reviewer repro: the two new cases in external-mcp-diagnostics.test.ts.

Made with Cursor

A capability that outran the bounded deadline was reported as an
unrecognized provider error, telling the member to look up a JSON-RPC
code with a provider that never sent one.

The abort reason was a plain Error, and the SDK only rethrows an McpError
untouched -- everything else becomes String(reason) on a RequestTimeout,
so the deadline reached diagnostics indistinguishable from a
provider-declared -32001. Abort with a marked McpError instead and check
that marker before any JSON-RPC code is read as the provider's.

Co-authored-by: Cursor <cursoragent@cursor.com>
@vercel

vercel Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

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

Project Deployment Actions Updated (UTC)
openwork-app Ready Ready Preview, Comment Jul 24, 2026 11:13pm
openwork-den Ready Ready Preview, Comment Jul 24, 2026 11:13pm
openwork-den-worker-proxy Ready Ready Preview, Comment Jul 24, 2026 11:13pm
openwork-landing Ready Ready Preview, Comment, Open in v0 Jul 24, 2026 11:13pm
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
openwork-diagnostics Skipped Skipped Jul 24, 2026 11:13pm

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