Skip to content

Add database keep-alive for crashed standalone DBs - #1

Merged
bobdivx merged 1 commit into
mainfrom
fix/database-keep-alive
Aug 13, 2026
Merged

bobdivx merged 1 commit into
mainfrom
fix/database-keep-alive

Conversation

@bobdivx

@bobdivx bobdivx commented Aug 13, 2026

Copy link
Copy Markdown
Owner

Summary

  • Add DatabaseKeepAliveJob (every 2 minutes) mirroring application keep-alive
  • Auto-restart exited standalone DBs that were desired-running or linked to a running app
  • Honor intentional stops via DatabaseDesiredRuntimeState

Test plan

  • Unit tests: tests/Unit/DevForge/DatabaseKeepAliveServiceTest.php
  • Stop a linked libSQL DB while its app stays up then wait for keep-alive restart
  • Manual stop via UI leaves DB stopped
  • StarbaseFR / TeslaSphere / popcorn remain healthy after deploy

Made with Cursor

Mirrors application keep-alive so linked libSQL containers that exit are brought back without waiting for a manual start, while honoring intentional stops.

Co-authored-by: Cursor <cursoragent@cursor.com>
@cursor

cursor Bot commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Bugbot is not enabled for your account, so this pull request was not reviewed.

Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs.

@bobdivx
bobdivx merged commit 8f70446 into main Aug 13, 2026
1 check passed
@bobdivx
bobdivx deleted the fix/database-keep-alive branch August 13, 2026 04:12
cursor Bot pushed a commit that referenced this pull request Sep 14, 2026
…isconnect, CTA proactif manage modal

- Ajoute auth_mode?: string | null au type CatalogItem (ligne 23)
- Supprime duplicate mcpOAuthStart dans api.ts (gardé lignes 754-758, 760-763)
- Remplace api.post(...) par api.mcpOAuthDisconnect(manage.id) dans disconnectOAuth (ligne 406)
- Ajoute CTA proactif (info tone) dans manage modal quand manageCatalog?.auth_mode=oauth && !oauth_connected (avant le warn 401)

Résout les bugs #1-#4 signalés par utilisateur.

Co-authored-by: Mathieu JESER <bobdivx@users.noreply.github.com>
bobdivx added a commit that referenced this pull request Sep 14, 2026
* feat(mcp): OAuth as primary flow for OAuth-enabled presets

- Make API tokens optional (required: false) for Turso and Linear
- Reorder Turso fields: org first (required), api_token second (optional)
- Update catalog copy: OAuth now presented as recommended, not limitation
- Add OAuth CTA button in add-preset modal for auth_mode=oauth presets
- New flow: User clicks preset → sees OAuth button → connects directly
- Fallback: Manual token fields remain available (advanced mode)
- Fixes UX gap where OAuth was only shown after 401 errors

Presets updated:
- Turso: api_token optional, OAuth primary
- Linear: api_key optional, OAuth primary
- Vercel, Sentry, Notion, Stripe: already had optional tokens ✓

Closes user report: UI still asks for tokens instead of OAuth popup

Co-authored-by: Mathieu JESER <bobdivx@users.noreply.github.com>

* feat(mcp): OAuth-first for all hosted MCPs based on 2026 research

Major UX shift: OAuth is now the PRIMARY authentication method for all
hosted MCPs that support it, with API tokens relegated to optional
fallback for CI/CD only.

Research findings (2026 docs):
- Turso: OAuth 2.1+PKCE via mcp.turso.ai (RFC 9728/8414 discovery)
- Vercel: OAuth via mcp.vercel.com (allowlist + consent flow)
- Linear: OAuth via mcp.linear.app/mcp (dynamic client registration)
- Sentry: OAuth via mcp.sentry.dev/mcp (device code for headless)
- Notion: OAuth via mcp.notion.com/mcp (no PAT support)
- Stripe: OAuth via mcp.stripe.com (restricted keys for unattended)
- Cloudflare: OAuth via mcp.cloudflare.com/mcp (RFC 9728 metadata)
- Supabase: OAuth via mcp.supabase.com/mcp (dynamic client reg)
- Neon: OAuth via mcp.neon.tech/mcp (browser-based consent)
- PostHog: OAuth via mcp.posthog.com/mcp (region auto-detection)
- GitHub: OAuth via api.githubcopilot.com/mcp/ (pre-registered apps)
- Slack: OAuth via official mcp.slack.com/mcp (user OAuth)

Catalog changes (crates/mcp/src/catalog.rs):
- All OAuth presets: auth_mode changed from 'token' → 'oauth'
- All token fields: required changed from true → false
- All setup_intro: now lead with '✨ OAuth disponible' messaging
- Token fields reordered: non-secret required first, tokens last
- Help text updated: OAuth primary, tokens for CI/CD fallback only
- Discord/Railway/Resend/Upstash: keep as self_hosted (no OAuth)

Frontend changes (apps/web/src/components/McpPage.tsx):
- Filter logic: hide secret+required fields when auth_mode=oauth
- Result: Turso shows only 'org' field, Vercel shows NO fields
- OAuth button always visible as primary CTA for oauth presets
- Token fields only shown if optional (advanced mode label visible)

BREAKING CHANGE: Users who configured token-first will see OAuth
button instead. Existing token configs still work (backward compat).

Closes user report from Mathieu: 'MOST hosted MCPs offer simpler
OAuth/browser login than API tokens — treat token-first as wrong default.'

Co-authored-by: Mathieu JESER <bobdivx@users.noreply.github.com>

* fix(mcp): critical OAuth flow bugs + advanced mode toggle

CRITICAL FIXES per Mathieu review:

1. API method missing: Added api.mcpOAuthStart(id) returning flat { auth_url, state }
   - Before: api.post(...) → undefined method, always failed
   - After: Proper typed method with correct response shape

2. Response destructuring: Fixed both manage + add flows
   - Before: oauth.data.auth_url (wrong, .data doesn't exist)
   - After: const { auth_url } = await api.mcpOAuthStart(id)

3. Popup fallback: Added window.location.assign when popup blocked
   - Before: Toast warning, user stuck
   - After: Full-page redirect fallback (same as manage flow)

4. Field filtering broken: Tokens still visible (all required:false now)
   - Before: filter secret && required (hides nothing)
   - After: Hide ALL secret fields by default for auth_mode=oauth
   - New: Toggle 'Mode avancé (token API / CI)' reveals secrets
   - UX: Non-secret fields (org, project_ref, url) always visible
   - Result: Turso shows only org, Vercel shows nothing by default

5. Slack verified: https://mcp.slack.com/mcp confirmed official (Feb 2026)
   - Docs: https://docs.slack.dev/ai/slack-mcp-server/
   - No changes needed, already correct in catalog

Advanced mode implementation:
- showAdvancedToken state tracks toggle
- OAuth presets: secrets hidden behind collapsible section
- Non-OAuth presets: secrets shown normally (unchanged UX)
- Label: '▶ Mode avancé (token API / CI)' → '▼' when expanded
- Help text: 'Pour CI/CD ou usage sans OAuth. Non requis pour usage interactif.'

Files changed:
- apps/web/src/lib/api.ts: +4 (new mcpOAuthStart method)
- apps/web/src/components/McpPage.tsx: +80 -30 (fixes + toggle)

All bugs from review now fixed. Ready for rebase + CI.

Co-authored-by: Mathieu JESER <bobdivx@users.noreply.github.com>

* fix(mcp): Corrige régressions OAuth - type CatalogItem, api.mcpOAuthDisconnect, CTA proactif manage modal

- Ajoute auth_mode?: string | null au type CatalogItem (ligne 23)
- Supprime duplicate mcpOAuthStart dans api.ts (gardé lignes 754-758, 760-763)
- Remplace api.post(...) par api.mcpOAuthDisconnect(manage.id) dans disconnectOAuth (ligne 406)
- Ajoute CTA proactif (info tone) dans manage modal quand manageCatalog?.auth_mode=oauth && !oauth_connected (avant le warn 401)

Résout les bugs #1-#4 signalés par utilisateur.

Co-authored-by: Mathieu JESER <bobdivx@users.noreply.github.com>

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: Mathieu JESER <bobdivx@users.noreply.github.com>
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