Skip to content

fix(apps): preserve tool results and host protocol contracts - #4862

Merged
reachjalil merged 3 commits into
devfrom
fix/app-protocol-contracts
Sep 10, 2026
Merged

reachjalil merged 3 commits into
devfrom
fix/app-protocol-contracts

Conversation

@reachjalil

@reachjalil reachjalil commented Sep 10, 2026 •

Copy link
Copy Markdown
Member

Summary

Preserve MCP App result semantics and advertise only the host capabilities that the originating view can use.

  • Retain optional isError, including explicit false, through server preservation, chat parsing, frame delivery and dashboard caching.
  • Leave provider structuredContent unchanged. Put gateway routing and advisory fields under reserved namespaced _meta keys; schema guidance remains separately model-visible without serializing private provider metadata.
  • Preserve standard MCP content blocks and redact _meta from fallback serialization.
  • Advertise tools and links only for writable views. Keep SDK-provided inline display-mode responses and unsupported-request errors rather than adding redundant handlers.
  • Document the supported protocol subset, including read-only, archived, cached-preview and completed-launch limitations.

Current Dev Reconciliation

Previous head: 9340e58e06e90ade07ea345c84619e184a94546f.
Current signed head: 7ba0107c3739c5124978da6a3dcfad77b21332ab.
Fresh base and merge-base: 858414c41c63a22eecfe331d17f3f5dd348dfc6f (dev).

The three useful commits rebase cleanly. Current dev already owns originating endpoint/workspace/session/engine binding, live launch leases, disposal and archive restrictions (#4863), plus private App readiness repair (#4839). Those implementations are retained, not duplicated. The protocol/result increment is still absent from dev, so this PR is not obsolete.

#4294 independently owns bounded discovery recovery and saved dashboard identity checks. This PR does not add retries or replay tools. The candidate heads compose without textual conflicts; that check does not establish combined runtime behavior. No review threads were present when inspected; historical automated review summaries are not current-head clearance.

Verification

Verdict: Incomplete. Passed on the current head, all exit 0:

  • pnpm --filter @openwork/app exec bun test --isolate tests/mcp-app-frame.test.ts tests/dashboard-tile-cache.test.ts tests/session-sync-tool-parts.test.ts: 49 passed, 0 failed, 0 skipped.
  • pnpm --filter openwork-server exec bun --conditions=development test src/opencode-plugins/openwork-extensions-preview.test.ts src/opencode-plugins/gmail-attachment-fulfillment.test.ts: 50 passed, 0 failed, 0 skipped.
  • pnpm --filter @openwork-ee/den-api exec bun --conditions=development test --isolate test/mcp-tool-content.test.ts test/external-connection-proxy.test.ts test/mcp-agent-timeouts.test.ts: 52 passed, 0 failed, 0 skipped.
  • Diff whitespace check; every feature commit verifies G with Jalil's existing signature.

Total: 151 passed; no failed or skipped tests. The focused checks use deterministic fixtures, not live providers. Expected rejection diagnostics and a non-failing storage warning appear in output.

Deferred: the existing saved-app-creation runtime journey, database-backed search-divergence coverage, and current-head runtime evidence. No manual cloud/E2E/review runs or local E2E were started. Earlier test counts, typechecks and published runtime evidence (including the report for ba4008e03e54580c5f8d271ed21fb0cbce90dae9) are historical only and do not prove this head.

Message/context writes, View tools, resource proxies and streaming are outside this increment. Normal CI remains required and unchanged. No merge, deployment or review request is included.

@mintlify

mintlify Bot commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated
differentai 🟢 Ready View Preview Sep 10, 2026, 11:45 PM

💡 Tip: Enable Automations to automatically generate PRs for you.

@vercel

vercel Bot commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

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

Project Deployment Actions Updated
openwork-app Ready Ready Preview Sep 10, 2026 11:45pm UTC
openwork-den Ready Ready Preview Sep 10, 2026 11:45pm UTC
openwork-diagnostics Ready Ready Preview Sep 10, 2026 11:45pm UTC
openwork-landing Ready Ready Preview, v0 Sep 10, 2026 11:45pm UTC

@github-actions

github-actions Bot commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

Passed · 12/12 tests · 18/18 assertions · 8 images

Commit 7ba0107c3739c5124978da6a3dcfad77b21332ab · selected evidence

Open review report

@github-actions

github-actions Bot commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

Warden review summary — Clear

Native findings: 0. Blocking policy matches before consolidation: 0. Full finding text remains in Warden's native checks and review threads. This comment retains only native IDs, severity, skill attribution, and safe locations. Analysis run

Reported trigger coverage (not proof of complete repository or context coverage): diff-security-review (145029 ms), confidentiality-review (191323 ms), spec-provenance-review (187000 ms), desktop-den-sync-review (306882 ms).

Blockers

  • None.

Advisories

  • None.

Needs recheck

  • None.

Observed review-thread metrics

  • Unique observed run attempts in retained window: 3
  • Distinct heads in retained window: 3
  • Current unresolved Warden threads: 0 of 0 observed
  • Observed resolved/unresolved transitions in retained snapshots: 0 / 0
  • First observed resolved/unresolved (state at first collection, not event time): 0 / 0
  • Precision: unavailable (no adjudications; no TP/FP values are inferred)
  • Observation window: 3/20 run attempts retained; truncated: false
  • Transition snapshot: 0/0 current attributed threads retained (limit 500); truncated: false

Thread states are read-only collection snapshots. These metrics are neither lifetime totals nor exact resolution times, and this summary is not clearance authority.

diff-warden[bot]
diff-warden Bot previously approved these changes Sep 10, 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 (2362e57ed7bf1214f8b05697b3c2dbe33687c6cd). Automated clearance satisfies the required-review gate only — a human still reviews and merges. Analysis run

@reachjalil
reachjalil force-pushed the fix/app-protocol-contracts branch from 2362e57 to ba4008e Compare September 10, 2026 22:48
@diff-warden
diff-warden Bot dismissed their stale review September 10, 2026 22:55

The latest Warden review is blocked or incomplete; clearance revoked.

@reachjalil
reachjalil force-pushed the fix/app-protocol-contracts branch from ba4008e to 9340e58 Compare September 10, 2026 23:35

@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 (9340e58e06e90ade07ea345c84619e184a94546f). Automated clearance satisfies the required-review gate only — a human still reviews and merges. Analysis run

@reachjalil
reachjalil force-pushed the fix/app-protocol-contracts branch from 9340e58 to 7ba0107 Compare September 10, 2026 23:44
null,
{ name: "OpenWork", version: "1.0.0" },
readOnly ? {} : { serverTools: {} },
readOnly ? {} : { serverTools: {}, openLinks: {} },

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.

Interactive MCP Apps can open attacker-controlled URLs through Electron

Advertising openLinks lets untrusted MCP App content invoke onopenlink, which passes its URL to Electron's shell.openExternal; require explicit user approval or restrict links to an allowlist before enabling this capability.

Evidence
  • The changed capability declaration exposes openLinks to every non-read-only MCP App sandbox.
  • The same component registers bridge.onopenlink and forwards the app-supplied url to openDesktopUrl.
  • openDesktopUrl only checks for http:/https: and then calls window.__OPENWORK_ELECTRON__.shell.openExternal in the Electron runtime.
  • A connected or compromised MCP server can therefore cause the desktop to open arbitrary attacker-controlled web pages, enabling phishing or other unsafe external navigation.
    Clear when: MCP App link requests require an explicit user confirmation or are restricted to trusted, validated destinations before reaching shell.openExternal.

Identified by Warden · diff-security-review · FH6-D6C

Comment on lines +103 to +105
...createOpenworkServerClient({ baseUrl: "http://localhost:1" }),
resolveMcpApp: async (workspaceId, name, launch, context) => {
resolutions.push({ workspaceId, name, launch, context })

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.

Private content-block metadata is exposed to the model

The new pass-through for standard MCP content blocks returns nested _meta unchanged, allowing provider-private metadata (including credentials or sensitive identifiers) to become model-visible; strip _meta from model-facing blocks while retaining it only for the app host. Clear when: content blocks delivered through the agent tool result no longer contain provider _meta fields.

Evidence
  • externalCapabilitySuccessToolResult() uses externalToolContent(result.result) to build the content returned by the capability gateway.
  • The changed externalToolContent() branch returns every SDK-validated content block unchanged.
  • MCP content blocks may contain reserved _meta fields, so a provider-controlled block can now carry that metadata into the model-visible tool result; the fallback branch previously removed _meta during serialization.

Identified by Warden · diff-security-review · AJF-ASX

Comment on lines 569 to 572
const launchResult = externalCapabilitySuccessToolResult(executed)
expect(launchResult.structuredContent).toMatchObject({
serverTools: {
expect(launchResult._meta).toMatchObject({
"openwork/serverTools": {
searchCapabilities: "search_capabilities",

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.

Moving MCP App launch metadata breaks published desktop clients

The Den response moves MCP App launch metadata from structuredContent to _meta, so already-published desktop builds that read the former will fail to discover and render external MCP Apps.

Evidence
  • externalCapabilitySuccessToolResult() now places result.mcpApp under _meta["openwork/mcpApp"] and openwork/serverTools rather than in structuredContent.
  • The desktop MCP App launch path now reads gatewayMcpAppLaunch(result?._meta), while the preceding desktop implementation consumed the launch reference from the structured result.
  • The changed test explicitly verifies the new _meta shape, confirming the wire response changed for the same external capability call.
  • Published desktop binaries still use the old structured-content reader, so they receive a successful tool result without a launch binding and cannot mount the MCP App. Ship a desktop release that accepts both locations first, then deploy the Den response change; clear when old and new desktop builds can both discover the launch binding.

Identified by Warden · desktop-den-sync-review · SZC-BNX

This branch was successfully deployed

5 active deployments
Preview – openwork-landing — 7ba0107c Deployed Sep 10, 2026 by vercel[bot]
Preview – openwork-app — 7ba0107c Deployed Sep 10, 2026 by vercel[bot]
Preview – openwork-den — 7ba0107c Deployed Sep 10, 2026 by vercel[bot]
staging - packages/docs — 7ba0107c Deployed Sep 10, 2026 by mintlify[bot]
Preview – openwork-diagnostics — 7ba0107c Deployed Sep 10, 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