Skip to content

YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context

fix(connections): restore correct connection state for Codex and OAuth tiles (#4951)

Ansh Grover8d254611cb44
diff --git a/apps/screenpipe-app-tauri/components/settings/connections-section.tsx b/apps/screenpipe-app-tauri/components/settings/connections-section.tsx
index 62efc0ae1..75dd8bc65 100644
--- a/apps/screenpipe-app-tauri/components/settings/connections-section.tsx
+++ b/apps/screenpipe-app-tauri/components/settings/connections-section.tsx
@@ -1150,7 +1150,7 @@ function ClaudePanel({ onConnected, onDisconnected }: { onConnected?: () => void
const [claudeAppInstalled, setClaudeAppInstalled] = useState<boolean | null>(null);
useEffect(() => {
- getInstalledMcpVersion().then(v => { if (v) setState("connected"); }).catch(() => {});
+ getInstalledMcpVersion().then(v => { if (v) { setState("connected"); onConnected?.(); } }).catch(() => {});
const os = platform();
if (os === "windows") {
// Check for MSIX package folder first, then fall back to traditional exe search
@@ -1256,7 +1256,7 @@ function CursorPanel({ onConnected, onDisconnected }: { onConnected?: () => void
const [cursorAppInstalled, setCursorAppInstalled] = useState<boolean | null>(null);
useEffect(() => {
- isCursorMcpInstalled().then(ok => { if (ok) setState("installed"); }).catch(() => {});
+ isCursorMcpInstalled().then(ok => { if (ok) { setState("installed"); onConnected?.(); } }).catch(() => {});
const os = platform();
if (os === "windows") {
@@ -1333,7 +1333,7 @@ function CursorPanel({ onConnected, onDisconnected }: { onConnected?: () => void
function CodexPanel({ onConnected, onDisconnected }: { onConnected?: () => void; onDisconnected?: () => void }) {
const [state, setState] = useState<"idle" | "installing" | "installed">("idle");
- useEffect(() => { isCodexMcpInstalled().then(ok => { if (ok) setState("installed"); }); }, []);
+ useEffect(() => { isCodexMcpInstalled().then(ok => { if (ok) { setState("installed"); onConnected?.(); } }); }, []);
const manualConfig = useMemo(() => buildCodexMcpToml({
command: "npx",
@@ -1408,7 +1408,7 @@ function CodexPanel({ onConnected, onDisconnected }: { onConnected?: () => void;
function GrokPanel({ onConnected, onDisconnected }: { onConnected?: () => void; onDisconnected?: () => void }) {
const [state, setState] = useState<"idle" | "installing" | "installed">("idle");
- useEffect(() => { isGrokMcpInstalled().then(ok => { if (ok) setState("installed"); }); }, []);
+ useEffect(() => { isGrokMcpInstalled().then(ok => { if (ok) { setState("installed"); onConnected?.(); } }); }, []);
const manualConfig = useMemo(() => buildGrokMcpJson({
command: "npx",
@@ -4140,14 +4140,16 @@ export function ConnectionsSection({
category: normalizeConnectionCategory(i.category),
description: i.description || undefined,
}));
- // Update connected status from API for hardcoded tiles that also exist in API
+ // Merge backend API state for hardcoded tiles using OR so the file-based
+ // state (e.g. codexInstalled from ~/.codex/config.toml) is never
+ // overwritten to false by a backend entry that tracks a separate concern
+ // (e.g. the codex memory-sync integration returning connected: false).
for (const h of hardcoded) {
const api = integrations.find(i => i.id === h.id);
- h.connected = isMcpOAuthProviderTileConnected(
- h.id,
- api ? api.connected : h.connected,
- mcpProviderConnected,
- );
+ const apiConnected = api
+ ? isMcpOAuthProviderTileConnected(h.id, api.connected, mcpProviderConnected)
+ : false;
+ h.connected = h.connected || apiConnected;
}
// Google OAuth dots are driven by direct oauthStatus (not the cached API), so they stay
// in sync immediately after connect/disconnect without waiting for cache expiry.
diff --git a/apps/screenpipe-app-tauri/lib/hooks/use-hardcoded-tiles.ts b/apps/screenpipe-app-tauri/lib/hooks/use-hardcoded-tiles.ts
index 42af4530d..89b52f1dc 100644
--- a/apps/screenpipe-app-tauri/lib/hooks/use-hardcoded-tiles.ts
+++ b/apps/screenpipe-app-tauri/lib/hooks/use-hardcoded-tiles.ts
@@ -73,8 +73,13 @@ export function hasEnabledCodexMcp(content: string): boolean {
export async function isCodexMcpInstalled(): Promise<boolean> {
try {
- return hasEnabledCodexMcp(await readTextFile(await getCodexConfigPath()));
- } catch { return false; }
+ const path = await getCodexConfigPath();
+ const content = await readTextFile(path);
+ return hasEnabledCodexMcp(content);
+ } catch (e) {
+ console.error("[isCodexMcpInstalled] failed:", e);
+ return false;
+ }
}
// Grok CLI (superagent-ai/grok-cli) keeps user settings in