Skip to content

fix(app): cloud MCP user state gates provisioning, not token maintenance - #2777

Merged
benjaminshafii merged 1 commit into
devfrom
fix/cloud-mcp-maintenance-gate
Jul 15, 2026
Merged

benjaminshafii merged 1 commit into
devfrom
fix/cloud-mcp-maintenance-gate

Conversation

@benjaminshafii

Copy link
Copy Markdown
Member

What

Field incident (Jul 14): a machine had the legacy raw-string openwork.den.mcp.cloudControlUserState = "removed" left over from a manual connection toggle. Two gates treated ANY recorded intent as a veto on all maintenance:

  • syncCloudControlMcpInBackground returned skipped before even listing the engine's MCPs
  • shouldSkipForPrerequisite in the reconciler skipped on readCloudMcpUserState(scope) !== null

Result: the 7-day first-party token expired with nothing to remint it → engine dropped the MCP at connect (SSE 401) → search_capabilities/execute_capability vanished from sessions.

Invariant implemented

Recorded user intent (disabled/removed) gates provisioning only — never token freshness. If the engine has a configured openwork-cloud entry with enabled !== false, maintenance and repair run regardless of recorded intent. Absent or explicitly disabled entries honor intent exactly as before.

  • use-session-mcp-maintenance.ts: list the engine MCPs first; apply the intent gate only when no enabled entry exists; pass effective enablement to the reconciler
  • cloud-mcp-reconciler.ts shouldSkipForPrerequisite: consult user state only when configuredEnabled !== true

Testing

  • bun test tests/cloud-mcp-maintenance-gate.test.ts tests/cloud-mcp-health.test.ts tests/cloud-mcp-user-state.test.ts in apps/app — 21 pass / 0 fail (new file with 4 tests: the exact field repro with the legacy raw string + enabled entry + expired-token health → remint happens; provisioning still gated when the entry is absent; explicit disable still skips; reconciler-level yield/block matrix)
  • pnpm typecheck in apps/app — clean

fraimz: skipped — unit-tested renderer logic, no visual surface change. Part 2/3 of the token-death-spiral fixes (#2776 is part 1; maintenance watchdog ships separately).

@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-app Ready Ready Preview, Comment Jul 15, 2026 5:52am
openwork-den Ready Ready Preview, Comment Jul 15, 2026 5:52am
openwork-den-worker-proxy Ready Ready Preview, Comment Jul 15, 2026 5:52am
openwork-landing Ready Ready Preview, Comment, Open in v0 Jul 15, 2026 5:52am
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
openwork-diagnostics Skipped Skipped Jul 15, 2026 5:52am

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.

This branch was successfully deployed

4 active and 1 inactive deployments
Preview – openwork-den-worker-proxy — a9b78263 Deployed Jul 15, 2026 by vercel[bot]
Preview – openwork-den — a9b78263 Deployed Jul 15, 2026 by vercel[bot]
Preview – openwork-landing — a9b78263 Deployed Jul 15, 2026 by vercel[bot]
Preview – openwork-app — a9b78263 Deployed Jul 15, 2026 by vercel[bot]
Preview – openwork-diagnostics — a9b78263 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