Repository navigation
fix(mcp): gate sends until Cloud search tools are ready - #2779
Merged
reachjalil merged 5 commits intoJul 15, 2026
Merged
Conversation
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
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. |
Member
Author
This was referenced Jul 15, 2026
reachjalil
marked this pull request as ready for review
July 15, 2026 03:07
This was referenced Jul 15, 2026
benjaminshafii
added a commit
that referenced
this pull request
Jul 15, 2026
Rebased onto the structured-maintenance rewrite (#2779). A stale disabled/removed intent (including the legacy raw-string format migrated from old builds) permanently skipped ALL cloud MCP token maintenance, so the 7-day first-party token expired with nothing to remint it and the engine dropped the MCP at connect (field incident). Recorded intent now only blocks provisioning: when an enabled openwork-cloud entry exists in the engine, the maintenance loop and the reconciler keep its token fresh regardless of recorded intent. Absent or explicitly disabled entries honor intent as before.
benjaminshafii
pushed a commit
that referenced
this pull request
Jul 15, 2026
…nce (#2777) Rebased onto the structured-maintenance rewrite (#2779). A stale disabled/removed intent (including the legacy raw-string format migrated from old builds) permanently skipped ALL cloud MCP token maintenance, so the 7-day first-party token expired with nothing to remint it and the engine dropped the MCP at connect (field incident). Recorded intent now only blocks provisioning: when an enabled openwork-cloud entry exists in the engine, the maintenance loop and the reconciler keep its token fresh regardless of recorded intent. Absent or explicitly disabled entries honor intent as before.
benjaminshafii
added a commit
that referenced
this pull request
Jul 15, 2026
Rebased onto the structured-maintenance rewrite (#2779), slimmed to the two pieces #2779 does not cover: - runSessionMcpMaintenanceTask races the task against a timeout so one hung await cannot wedge every future tick for a target until app restart (field incident); a run token keeps a late-settling task from releasing a newer run's lock - each run persists its last outcome (ok/error/timed_out, capped detail) per target under openwork.den.mcp.lastMaintenanceOutcome with a reader for the diagnostics UI — complementing #2779's ephemeral inspector events and React state with a cross-restart signal
benjaminshafii
pushed a commit
that referenced
this pull request
Jul 15, 2026
#2778) Rebased onto the structured-maintenance rewrite (#2779), slimmed to the two pieces #2779 does not cover: - runSessionMcpMaintenanceTask races the task against a timeout so one hung await cannot wedge every future tick for a target until app restart (field incident); a run token keeps a late-settling task from releasing a newer run's lock - each run persists its last outcome (ok/error/timed_out, capped detail) per target under openwork.den.mcp.lastMaintenanceOutcome with a reader for the diagnostics UI — complementing #2779's ephemeral inspector events and React state with a cross-restart signal
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


This is the single combined Cloud MCP fix and supersedes #2773.
This PR prevents a message from starting an agent run while
search_capabilitiesorexecute_capabilitymay be missing from the selected provider/model. It combines the original Cloud MCP silent-failure diagnostics with a graceful pre-send readiness gate: users can keep typing, editing, changing models, and attaching files while OpenWork verifies or restores the tools, but the queued message is not released until the exact Cloud tool projection is proven.Why this fixes the silent missing-search failure
The previous session maintenance path could collapse an unusable reconcile result into
skipped, swallow startup/reload errors, and consider generic endpoint health sufficient. That could leave the assistant without the Cloud search tool after restart while the UI provided no durable explanation.The first commit makes restoration failures visible and retryable. The second commit closes the send-time race: run-start analytics, telemetry, attachment conversion, commands, and
promptAsyncnow remain behind the readiness decision. A failed check therefore creates no agent run and does not clear the draft.Readiness contract and engine gap
connectedtransport status is not enough. The gate requires all of the following for the active workspace, provider, and model:openwork-cloudregistration as connected and the overall Cloud health check has no failure.tools/listprobe returns bothsearch_capabilitiesandexecute_capability.openwork-cloud_search_capabilitiesandopenwork-cloud_execute_capability.The current health endpoint can prove selected-model projection only when OpenCode's provider/model tool-list endpoint enumerates MCP tools. Some engine versions omit MCP tools there and fall back to
/provider, which proves only that the model supports tool calling in general. This PR explicitly rejects that fallback withprovider_tool_projection_unverified; generic tool-calling support is never treated as proof that the two Cloud tools were injected.That is the strongest honest check available without a stronger engine contract. A future OpenCode contract should expose an authoritative provider/model-scoped effective tool manifest on every supported engine version.
Submission behavior
End-to-end evidence
The user-facing
cloud-mcp-submit-readinessfraimz ran against an isolated macOS Electron app, OpenWork server, OpenCode 1.17.11 sidecar, local Den API/MySQL, and a liveopenwork-cloudMCP registration. The flow first proved that the transport was connected and the direct endpoint listed both tools. It then observed the bundled engine's realprovider_capabilityfallback, delayed only the health request to make the transient UI state observable, and let the real response continue.The result passed with 1 flow, 0 failures, 0 skips. It proved the composer remained editable, attachment access remained enabled, repeated clicks produced one readiness check, no user message or agent run existed before readiness, and the real unprovable projection failed closed with the edited draft preserved.
Preparing without blocking the composer
Safe failure preserves the draft and recovery actions
Full claim → action → assertion evidence is posted in the fraimz PR comment and can be reproduced with:
pnpm fraimz --flow cloud-mcp-submit-readiness --cdp-url <electron-cdp-url>Diagnostics and security
Focused regression coverage
The new tests prove:
Validation
pnpm --filter @openwork/app typecheck— passedpnpm --filter @openwork/app exec bun test --isolate tests/cloud-mcp-submit-readiness.test.ts tests/session-mcp-maintenance.test.ts tests/cloud-mcp-health.test.ts— 22 passed, 0 failedpnpm --filter openwork-server typecheck— passedpnpm --filter openwork-server exec bun test src/cloud-mcp-reconcile.e2e.test.ts src/mcp.engine-sync.e2e.test.ts— 34 passed, 0 failedpnpm fraimz --flow cloud-mcp-submit-readiness --cdp-url http://127.0.0.1:43403— passed, 2 validated screenshotsopenwork-testson Ubuntu and macOS — passedRemaining verification
The bundled OpenCode 1.17.11 engine does not enumerate MCP tools in the provider/model-scoped experimental tool API, so it cannot produce an honest live automatic-release result for this strict gate. The automatic exactly-once release is covered by the focused deterministic tests; this PR does not fabricate an
experimental_toolresponse to claim it passed end to end.A packaged production desktop journey with an engine that exposes the authoritative selected-model tool manifest remains to be run. Windows/Linux coverage and video evidence were not collected. The PR remains a draft until that engine contract is available or the supported engine is qualified with equivalent projection proof.