fix(platform): self-heal integration installed flag on credential activation#1593
Conversation
…ivation When a tracked seed integration config (e.g. examples/integrations/tavily/config.json) gets reverted to installed:false by a git checkout while its DB credential row stays active, the composer readiness gate (installed && isActive) disagrees with the "Connected" badge (isActive only), so users see "Requires Tavily" on Web search / Deep research even though Settings shows Tavily Connected. Fix at the two write sites that flip isActive:true — test_connection and oauth2_token_exchange — by calling a new idempotent ensureInstalledInternal action that rewrites config.json with installed:true. Also invalidate the ['config','integrations'] TanStack cache after a successful test so the composer picks up the healed flag without a page refresh. Debug console.log on the self-heal path for log-based verification.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (4)
📝 WalkthroughWalkthroughThis PR modifies the integration activation flow across client and backend layers. It adds React Query cache invalidation to the client-side Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Summary
Settings → Integrationsshows Tavily as Connected (green badge driven bycred.isActive), but the chat composer+menu gates Deep research and Web search oninstalled && isActive, so they show Requires Tavily. The two surfaces can disagree when the tracked seed file (examples/integrations/tavily/config.json) gets reverted toinstalled: falseby agit checkoutwhile the DB credential row stays active. Once in that state, the UI has no path to re-runinstallIntegration(the save/test flow only installs when no credential row exists yet).isActive: true— test_connection.ts and oauth2_token_exchange.ts — by calling a new idempotent internal actionensureInstalledInternalin file_actions.ts that rewritesconfig.jsonwithinstalled: truewhen it's missing.['config', 'integrations']TanStack cache after a successful test in useTestIntegration, so the composer picks up the healed flag without a page refresh.console.logon the self-heal path for log-based verification (can swap tocreateDebugLog('DEBUG_INTEGRATIONS', ...)later if noise is a concern).Why not the alternatives
installed && isActive— regresses the user's current UX (they already see Tavily as Connected), and doesn't actually unblock them.isActiveonly — the engine/runtime (listForExecution,start_workflow_from_file) still filters byinstalled: true, so the capability would fail silently at execution time.Test plan
git checkout -- examples/integrations/tavily/config.jsonto flip the seed back toinstalled: false; confirm composer shows Requires Tavily on Web search / Deep research while Settings → Integrations still shows Connected.examples/integrations/tavily/config.jsonon disk now has"installed": true.+menu shows Web search and Deep research without the Requires Tavily hint (no page refresh needed).[Integrations] ensureInstalledInternal: done (slug=tavily changed=true)on the first heal andchanged=falseon a subsequent test.oauth2_token_exchange.ts.installed: truealready on disk, Test connection is a no-op for the file — no spuriousgit statuschurn.npx tsc --noEmitfromservices/platform/andnpm run lint --workspace=@tale/platformare clean.Summary by CodeRabbit
Bug Fixes
Refactor