Skip to content

fix(app): watchdog + recorded outcomes for cloud MCP maintenance - #2778

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

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

Conversation

@benjaminshafii

@benjaminshafii benjaminshafii commented Jul 15, 2026 •

Copy link
Copy Markdown
Member

What

Field incident (Jul 14): after the cloud MCP token death spiral, clearing the localStorage gates did nothing until a full app restart — consistent with a wedged in-flight lock: runSessionMcpMaintenanceTask releases its lock only in finally, so one hung network await blocks every future tick for that target forever.

Rebased onto the structured-maintenance rewrite (#2779) and slimmed to the two pieces it does not cover:

  • Watchdog: the task races a timeout (default 2 min, injectable). On timeout the lock is released and the run is recorded as timed_out; a run-token guard prevents the late-settling task from releasing a newer run's lock.
  • Persisted outcomes: every run records ok | error | timed_out (+ length-capped detail, newest 8 targets) under openwork.den.mcp.lastMaintenanceOutcome, with readCloudMcpMaintenanceOutcome(targetKey) exported for the diagnostics UI (feat(mcp): add live connection diagnostic tracing #2672). This complements fix(mcp): gate sends until Cloud search tools are ready #2779's ephemeral inspector events and per-session React state with a cross-restart signal.

Dropped from the original version of this PR: the tick catch-rewrite — #2779's retry/state/inspector plumbing now covers failure surfacing inside the tick.

Testing

  • bun test tests/ in apps/app — 298 pass / 0 fail (5 tests: hung tick → lock released + timed_out recorded + next tick runs; late-settle cannot release a newer run's lock; throwing tick records error + releases; detail cap + newest-8 retention; corrupt storage tolerated)
  • pnpm typecheck in apps/app — clean

fraimz: skipped — unit-tested renderer logic, no visual surface change. Part 3/3 of the token-death-spiral fixes (#2776 auth-code matching, #2777 provisioning-only gate — both merged).

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

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

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