Skip to content

fix(dashboards): surface missing required launch input instead of "Unexpected server error" - #4385

Merged
yomgui merged 3 commits into
devfrom
fix/dashboard-mcp-launch-input
Sep 4, 2026
Merged

yomgui merged 3 commits into
devfrom
fix/dashboard-mcp-launch-input

Conversation

@yomgui

@yomgui yomgui commented Sep 4, 2026 •

Copy link
Copy Markdown
Member

Problem

A Dashboard tile whose saved launch input omits an argument the MCP tool requires (e.g. the Atlassian remote MCP's cloudId for getConfluencePage / searchJiraIssuesUsingJql) fails on every launch with the generic "Unexpected server error" and a "Refresh failed" badge — identically for org-account and individual-account connections, because the rejection happens before credential mode matters.

Three hops hid the real cause:

  1. Desktop host (apps/server/src/mcp-app-host.ts): callMcpAppTool let the SDK McpError escape untyped, so rethrowMcpAppHostError didn't map it and the route answered HTTP 500 internal_error.
  2. Den diagnostics (ee/apps/den-api/.../external-mcp-diagnostics.ts): MCP_INVALID_PARAMS / MCP_PROVIDER_INVALID_PARAMS produced the phase-generic "requested provider operation failed" text even though the provider's rejection naming the argument was already captured as providerErrorMessage.
  3. Authoring (ee/apps/den-api/.../mcp-connections.ts, ee/apps/den-web/.../org-dashboard-detail-screen.tsx): GET /v1/mcp-connections/:id/mcp-apps exposed only a requiresInput boolean, so the add-app dialog could neither show which keys a tool needs nor validate the pasted JSON.

Ruled out (and now asserted): JSON double-escaping. A JQL string with escaped quotes round-trips Den storage and reaches the provider byte-identically.

Fix (smallest diff per layer)

  • Desktop host: rethrow client.callTool rejections as McpAppHostError("tool_call_failed", message) → 422 with the provider's message on the tile. The message is bounded (providerErrorExcerpt: control chars stripped, 512-char cap — the same bound Den applies to provider excerpts) because it is provider-controlled text reaching viewer-scoped callers.
  • Den diagnostics: invalid-params codes now render The provider rejected the tool arguments. Provider-declared message (untrusted): "…" — reusing the existing sanitized providerErrorMessage (control chars stripped, 512-char cap) and the existing "(untrusted)" convention already used for MCP_PROVIDER_DECLARED_ERROR. No new provider data is captured.
  • Authoring: new mcpToolRequiredInputKeys(); /mcp-apps returns requiredInputKeys: string[] (OpenAPI schema updated). The add-app dialog shows the required keys, pre-fills the placeholder, and refuses Add with Launch input is missing required key: cloudId. Older Den → [], so behavior degrades to today's.

Not done deliberately: server-side launchArguments validation in POST/PATCH /v1/dashboards (would require Den to fetch the provider schema on every save; the dialog is where the JSON is pasted).

After the fix, the tile reads (asserted on the real Electron tile):
MCP error -32603: The provider rejected the tool arguments. Provider-declared message (untrusted): "Invalid arguments for tool getConfluencePage: [{…"path":["cloudId"],"message":"Required"}]".

Verification

Lane: local (cold-boot server(), MySQL 3306 + Redis 6379). Daytona credentials are available, but both specs embed an inline loopback witness MCP (shaped like the Atlassian remote MCP: same tool names, cloudId required, MCP-App ui:// bindings) that a remote Den cannot reach — the same local-placement constraint remote-mcp-apps.e2e.test.ts declares. Both specs skip loudly under OPENWORK_EVAL_DAYTONA=1 / OPENWORK_EVAL_DEN_API_URL.

Check Command Result
evals/specs/dashboard-atlassian-launch-input.test.ts — real Den connection proxy + real Desktop App-host code; asserts requiredInputKeys, byte-identical launchArguments round-trip, typed tool_call_failed naming cloudId, per-member needs_signin surface (409 + absent from app-host index), and the control launch succeeding once cloudId is supplied pnpm --dir evals run test:pr specs/dashboard-atlassian-launch-input.test.ts exit 0 — 1 passed, 0 failed, 0 skipped
evals/specs/dashboard-atlassian-tile-error.e2e.test.ts — spec.world(atlassianDashboardTiles) (evals/worlds/dashboard-launch-input.ts); real Electron; user.click Run on both tiles; user.see the provider's rejection naming cloudId + "Refresh failed", user.notSee "Unexpected server error"; world.tiles() proves both tiles carry it; witness received the pasted args intact pnpm evals:e2e dashboard-atlassian-tile-error exit 0 — 1 passed, 0 failed, 0 skipped, verdict passed
apps/server/src/mcp-app-host.test.ts (+1: hostile-provider rejection → typed, bounded host error) bun --conditions=development test src/mcp-app-host.test.ts 24 pass, 0 fail
Eval-runner unit gate (layering lint specs-use-testkit-only, channel ratchet, runner tests) pnpm --dir evals run test exit 0
ee/apps/den-api/test/external-mcp-diagnostics.test.ts (extended: message carries provider text) bun test test/external-mcp-diagnostics.test.ts 83 pass, 0 fail
ee/apps/den-api/test/mcp-connection-apps.test.ts (+1: mcpToolRequiredInputKeys) bun test test/mcp-connection-apps.test.ts 5 pass, 0 fail
ee/apps/den-web/tests/dashboard-mcp-app-catalog.test.ts (+1: missingRequiredInputKeys) bun test --conditions development tests/dashboard-mcp-app-catalog.test.ts 4 pass, 0 fail

tsc --noEmit reports no errors in any touched file in apps/server, ee/apps/den-api, or ee/apps/den-web. Pre-existing, unrelated: external-mcp-diagnostics.test.ts › uses one absolute deadline… fails only when co-scheduled in one bun process with mcp-connection-action-app.test.ts; reproduces on pristine origin/dev files and passes in isolation.

Test evidence for both specs is published below (runs bound to the head SHA 174208abc). Warden findings on 1a40e49a8 (bounded provider text; user.see witnesses) were addressed in 174208abc with inline replies.

Follow-up worth a separate ticket: the test-evidence publisher keeps one sticky comment per PR, so the PR-lane run is posted as a second labelled comment.

Verdict: Passed.

…expected server error"

A dashboard tile whose saved launch input omits an argument the MCP tool
requires (for example the Atlassian remote MCP's cloudId) failed on every
launch with the generic "Unexpected server error" and a "Refresh failed"
badge, identically across org-account and individual-account connections.
Three hops hid the cause:

- apps/server: callMcpAppTool let the SDK McpError escape untyped, so the
  route handler answered 500 internal_error. Rejections are now rethrown as
  McpAppHostError("tool_call_failed", message) and mapped to 422 with the
  provider's message.
- den-api: MCP_INVALID_PARAMS / MCP_PROVIDER_INVALID_PARAMS produced the
  phase-generic "requested provider operation failed" text. They now relay
  the already-captured, sanitized provider message using the existing
  "Provider-declared message (untrusted)" convention.
- den-api + den-web: GET /v1/mcp-connections/:id/mcp-apps exposed only a
  requiresInput boolean, so the add-app dialog could not tell authors which
  keys a tool needs. It now returns requiredInputKeys; the dialog shows
  them, pre-fills the placeholder, and refuses Add when a key is missing.

The pasted JSON (including escaped quotes in a JQL string) was already
forwarded byte-identically; that was ruled out and is asserted.

Specs (local lane; both embed a loopback witness MCP shaped like the
Atlassian remote MCP and skip loudly on Daytona / attached Den):
- evals/specs/dashboard-atlassian-launch-input.test.ts (PR lane) drives the
  real Den connection proxy with the real Desktop App-host code.
- evals/specs/dashboard-atlassian-tile-error.e2e.test.ts asserts the real
  Electron tile names the missing argument and never shows the generic 500.
@vercel

vercel Bot commented Sep 4, 2026 •

Copy link
Copy Markdown
Contributor

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

4 Skipped Deployments
Project Deployment Actions Updated
openwork-app Ignored Ignored Preview Sep 4, 2026 5:45am UTC
openwork-den Ignored Ignored Preview Sep 4, 2026 5:45am UTC
openwork-diagnostics Ignored Ignored Preview Sep 4, 2026 5:45am UTC
openwork-landing Ignored Ignored Preview Sep 4, 2026 5:45am UTC

@yomgui

yomgui commented Sep 4, 2026 •

Copy link
Copy Markdown
Member Author

Test evidence — a-dashboard-tile-launched-with-the-reported-atlassian-json-names-the-missing-req — ✅ passed

✅ passed · 2 expectations passed · 0 failed · 0 pending

[world] den(local) · [seed] api GET /v1/me/orgs · orgConnection("Atlassian (One org account)") · [seed] api GET /v1/mcp-connections/emc_01m1nf8ejqe2zsj880ab123rby/mcp-apps · [seed] api POST /v1/dashboards · [seed] api POST /v1/dashboards/dsb_01m1nf8ennekaby67xgy5y6j45/access · [seed] api POST /v1/mcp/token · desktop(as admin) · workspace(/tmp/openwork-dashboard-launch-input-1788500804998)
[probe] eventually(Dashboard navigation opened) · eventually(granted Atlassian dashboard tiles rendered with Run buttons)
[user] click(label=Run Confluence page) · click(label=Run Jira queue) · see(text=/rejected the tool arguments/, timeoutMs=120000) · see(text=/cloudId/) · see(text=/Refresh failed/) · notSee(text=/Unexpected server error/)
[probe] eventually(both Atlassian tiles name the missing required argument)
verdict passed · 4 user observations (see ×3, notSee ×1) · 3 probes · steps 0/0

ℹ️ ASSERTION — 1. The dashboard tile names the missing required argument instead of a generic server error

After Run, both tiles show the "Refresh failed" badge with the provider's rejection naming cloudId and never "Unexpected server error" (confluence={"text":"Confluence page openwork-app-host-connect-be29a4049b7c Refresh failed MCP error -32603: The provider rejected the tool arguments. Provider-declared message (untrusted): "Invalid arguments for tool getConfluencePage: [{"code":"invalid_type","expected":"string","received":"undefined","path":["cloudId"],"message":"Required"}]".","badgeFailed":true,"opaque":false,"namesCloudId":true}, jql={"text":"Jira queue openwork-app-host-connect-be29a4049b7c Refresh failed MCP error -32603: The provider rejected the tool arguments. Provider-declared message (untrusted): "Invalid arguments for tool searchJiraIssuesUsingJql: [{"code":"invalid_type","expected":"string","received":"undefined","path":["cloudId"],"message":"Required"}]".","badgeFailed":true,"opaque":false,"namesCloudId":true}).

  • ✅ PASS The dashboard tile names the missing required argument instead of a generic server error — After Run, both tiles show the "Refresh failed" badge with the provider's rejection naming cloudId and never "Unexpected server error" (confluence={"text":"Confluence page openwork-app-host-connect-be29a4049b7c Refresh failed MCP error -32603: The provider rejected the tool arguments. Provider-declared message (untrusted): "Invalid arguments for tool getConfluencePage: [{"code":"invalid_type","expected":"string","received":"undefined","path":["cloudId"],"message":"Required"}]".","badgeFailed":true,"opaque":false,"namesCloudId":true}, jql={"text":"Jira queue openwork-app-host-connect-be29a4049b7c Refresh failed MCP error -32603: The provider rejected the tool arguments. Provider-declared message (untrusted): "Invalid arguments for tool searchJiraIssuesUsingJql: [{"code":"invalid_type","expected":"string","received":"undefined","path":["cloudId"],"message":"Required"}]".","badgeFailed":true,"opaque":false,"namesCloudId":true}).

ℹ️ ASSERTION — 2. The pasted launch JSON reached the provider intact

The witness received getConfluencePage {"pageId":"1122334455"} and searchJiraIssuesUsingJql with the exact single-escaped JQL string; the provider rejected both for the missing required cloudId with JSON-RPC -32602.

  • ✅ PASS The pasted launch JSON reached the provider intact — The witness received getConfluencePage {"pageId":"1122334455"} and searchJiraIssuesUsingJql with the exact single-escaped JQL string; the provider rejected both for the missing required cloudId with JSON-RPC -32602.

Test run created 2026-09-04T05:45:57.360Z · Source: evals/results/test-runs/2026-09-04T05-45-57-359Z-a-dashboard-tile-launched-with-the-reported-atlassian-json-names-the-missing-req/test-run.json · Repro: pnpm --dir evals artifacts:publish -- --pr 4385 --test-run 2026-09-04T05-45-57-359Z-a-dashboard-tile-launched-with-the-reported-atlassian-json-names-the-missing-req

@yomgui

yomgui commented Sep 4, 2026 •

Copy link
Copy Markdown
Member Author

Test evidence — dashboard-tiles-forward-pasted-atlassian-launch-json-intact-and-surface-the-prov — ✅ passed

✅ passed · 5 expectations passed · 0 failed · 0 pending

Dry run: screenshots were not uploaded.

verdict passed · 0 user observations · 0 probes · steps 0/0

ℹ️ ASSERTION — 1. The dashboard add-app catalog names the required launch-input keys

GET /v1/mcp-connections/:id/mcp-apps lists getConfluencePage with requiredInputKeys=["cloudId","pageId"] and searchJiraIssuesUsingJql with requiredInputKeys=["cloudId","jql"], so the add-app dialog can show them and refuse a pasted payload that omits cloudId.

  • ✅ PASS The dashboard add-app catalog names the required launch-input keys — GET /v1/mcp-connections/:id/mcp-apps lists getConfluencePage with requiredInputKeys=["cloudId","pageId"] and searchJiraIssuesUsingJql with requiredInputKeys=["cloudId","jql"], so the add-app dialog can show them and refuse a pasted payload that omits cloudId.

ℹ️ ASSERTION — 2. Pasted launch JSON round-trips through Den storage byte-identically

The JQL string with escaped quotes stored on the dashboard element and returned by /v1/me/dashboards strictly equals the pasted value ("project = HELPDESK AND status NOT IN ("Closed", "Resolved", "Duplicate", "Declined", "Spam") AND assignee = c…) — escaping is not the failure.

  • ✅ PASS Pasted launch JSON round-trips through Den storage byte-identically — The JQL string with escaped quotes stored on the dashboard element and returned by /v1/me/dashboards strictly equals the pasted value ("project = HELPDESK AND status NOT IN ("Closed", "Resolved", "Duplicate", "Declined", "Spam") AND assignee = c…) — escaping is not the failure.

ℹ️ ASSERTION — 3. An unconnected individual-accounts connection is the needs_signin surface

GET /v1/mcp-connections/:id/mcp-apps answered 409 "Connect your account before using this MCP's tools." and the Desktop app-host server index omits connection emc_01m1nf7fqxeb79rccx93egj7sx while listing emc_01m1nf7fp0e07sa3d06w93fbxe; a tile granted over it can only fail with "The originating Connect MCP server is not available to this workspace."

  • ✅ PASS An unconnected individual-accounts connection is the needs_signin surface — GET /v1/mcp-connections/:id/mcp-apps answered 409 "Connect your account before using this MCP's tools." and the Desktop app-host server index omits connection emc_01m1nf7fqxeb79rccx93egj7sx while listing emc_01m1nf7fp0e07sa3d06w93fbxe; a tile granted over it can only fail with "The originating Connect MCP server is not available to this workspace."

ℹ️ ASSERTION — 4. A launch missing a required argument surfaces the provider's rejection naming that argument

callMcpAppTool threw McpAppHostError(tool_call_failed) for both tools with messages ["MCP error -32603: The provider rejected the tool arguments. Provider-declared message (untrusted): "Invalid arguments for tool getConfluencePage: [{"code":"invalid_type","expected":"string","received":"undefined","path":["cloudId"],"message":"Required"}]".","MCP error -32603: The provider rejected the tool arguments. Provider-declared message (untrusted): "Invalid arguments for tool searchJiraIssuesUsingJql: [{"code":"invalid_type","expected":"string","received":"undefined","path":["cloudId"],"message":"Required"}]"."]; /workspace/:id/mcp-apps/call maps this to 422 tool_call_failed so the dashboard tile shows the provider's own text naming cloudId, never the generic "Unexpected server error". The witness received the pasted arguments byte-identically (jql intact, no cloudId), so the only failure is the missing required argument.

  • ✅ PASS A launch missing a required argument surfaces the provider's rejection naming that argument — callMcpAppTool threw McpAppHostError(tool_call_failed) for both tools with messages ["MCP error -32603: The provider rejected the tool arguments. Provider-declared message (untrusted): "Invalid arguments for tool getConfluencePage: [{"code":"invalid_type","expected":"string","received":"undefined","path":["cloudId"],"message":"Required"}]".","MCP error -32603: The provider rejected the tool arguments. Provider-declared message (untrusted): "Invalid arguments for tool searchJiraIssuesUsingJql: [{"code":"invalid_type","expected":"string","received":"undefined","path":["cloudId"],"message":"Required"}]"."]; /workspace/:id/mcp-apps/call maps this to 422 tool_call_failed so the dashboard tile shows the provider's own text naming cloudId, never the generic "Unexpected server error". The witness received the pasted arguments byte-identically (jql intact, no cloudId), so the only failure is the missing required argument.

ℹ️ ASSERTION — 5. The same launch succeeds once cloudId is supplied

callMcpAppTool with { cloudId, jql } returned a non-error result through the same Den proxy and Desktop App-host pipeline, isolating the root cause to the missing required argument that the add-app dialog neither surfaced nor validated.

  • ✅ PASS The same launch succeeds once cloudId is supplied — callMcpAppTool with { cloudId, jql } returned a non-error result through the same Den proxy and Desktop App-host pipeline, isolating the root cause to the missing required argument that the add-app dialog neither surfaced nor validated.

Test run created 2026-09-04T05:45:29.174Z · Source: evals/results/test-runs/2026-09-04T05-45-29-173Z-dashboard-tiles-forward-pasted-atlassian-launch-json-intact-and-surface-the-prov/test-run.json · Repro: pnpm --dir evals artifacts:publish -- --pr 4385 --test-run 2026-09-04T05-45-29-173Z-dashboard-tiles-forward-pasted-atlassian-launch-json-intact-and-surface-the-prov

diff-warden[bot]
diff-warden Bot previously approved these changes Sep 4, 2026

@diff-warden diff-warden 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.

Warden security clearance: clear. No blocking findings (security or desktop↔den sync) in this diff (64aa2aed3bdac317b23655857290b52feceeecf3). Automated clearance satisfies the required-review gate only — a human still reviews and merges. Analysis run

…orld layer

The eval-runner unit gate rejected the new E2E spec on two rules that
landed on dev alongside this branch: specs-use-testkit-only (no direct
@openwork/behaviors imports from *.e2e.test.ts) and the channel ratchet
(zero raw probe.eval escapes in new-layer specs).

- evals/worlds/dashboard-launch-input.ts: the Atlassian-shaped witness,
  Den seeding (connection, dashboard, grant, MCP tokens), signed-in Desktop
  with Connect reconciled, and typed DOM accessors (openDashboard,
  tilesReady, tiles) now live in a world.
- dashboard-atlassian-tile-error.e2e.test.ts drives only user/probe/evidence
  channels through spec.world(atlassianDashboardTiles).
- dashboard-atlassian-launch-input.test.ts reuses the shared witness and
  payload constants instead of duplicating them.

Behavior under test is unchanged; both specs re-ran green locally along
with `pnpm --dir evals run test` (layering lint + channel ratchet).
Comment thread apps/server/src/mcp-app-host.ts Resolved
…age via user.see

Addresses the two Warden findings on this branch:

- diff-security-review (blocking): the tool_call_failed message copied the
  provider's error text verbatim to viewer-scoped callers of
  /workspace/:id/mcp-apps/call. Providers already return arbitrary tool
  results to the same callers, so this is not a new disclosure class, but
  the text is untrusted: strip control characters and cap it at 512 chars
  (the same bound Den applies to provider-declared excerpts). The host test
  now models a hostile provider (control char + 2 KB tail) and asserts the
  relayed message keeps the argument path while dropping both.
- spec-provenance-review (advisory): the E2E claim is now witnessed on the
  visible surface with user.see("rejected the tool arguments" / "cloudId" /
  "Refresh failed") and user.notSee("Unexpected server error"); the
  world.tiles() facts remain to prove both tiles carry the message.

@diff-warden diff-warden 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.

Warden security clearance: clear. No blocking findings (security or desktop↔den sync) in this diff (174208abcbdee9c343909f42a413aff4c1ee6c6f). Automated clearance satisfies the required-review gate only — a human still reviews and merges. Analysis run

@yomgui
yomgui merged commit d9c1084 into dev Sep 4, 2026
34 checks passed
@yomgui
yomgui deleted the fix/dashboard-mcp-launch-input branch September 4, 2026 05:59
yomgui added a commit that referenced this pull request Sep 4, 2026
…lder

dev now renders the required input keys in the picker placeholder (#4385).
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