Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

feat(composio): add connect flow hook for composio modal

Steven Enamakel2f7564c0e195
diff --git a/app/src/components/composio/ComposioConnectModal.tsx b/app/src/components/composio/ComposioConnectModal.tsx
index 1011dc9c74..3ea208f21a 100644
--- a/app/src/components/composio/ComposioConnectModal.tsx
+++ b/app/src/components/composio/ComposioConnectModal.tsx
@@ -69,8 +69,6 @@ export default function ComposioConnectModal({
error,
setError,
connectUrl,
- clearMemoryOnDisconnect,
- setClearMemoryOnDisconnect,
requiredFields,
fieldValues,
setFieldValues,
@@ -336,24 +334,6 @@ export default function ComposioConnectModal({
className="w-full">
{t('composio.connect.addAnotherAccount')}
</Button>
- <label
- htmlFor="composio-clear-memory-on-disconnect"
- className="flex items-start gap-2 rounded-lg border border-line bg-surface-muted px-3 py-2">
- <Checkbox
- id="composio-clear-memory-on-disconnect"
- checked={clearMemoryOnDisconnect}
- onCheckedChange={setClearMemoryOnDisconnect}
- className="mt-0.5"
- />
- <span className="min-w-0">
- <span className="block text-sm font-medium text-content">
- {t('accounts.disconnectClearMemory')}
- </span>
- <span className="block text-xs text-content-muted">
- {t('accounts.disconnectClearMemoryHint')}
- </span>
- </span>
- </label>
<div className="grid grid-cols-2 gap-3">
<Button
variant="secondary"
@@ -383,7 +363,6 @@ export default function ComposioConnectModal({
variant="secondary"
size="md"
onClick={() => {
- setClearMemoryOnDisconnect(false);
setPhase(initiallyConnected ? 'connected' : initiallyExpired ? 'expired' : 'idle');
setError(null);
}}
diff --git a/app/src/components/composio/useComposioConnectFlow.ts b/app/src/components/composio/useComposioConnectFlow.ts
index 2e5cea4e7d..5dd39df43c 100644
--- a/app/src/components/composio/useComposioConnectFlow.ts
+++ b/app/src/components/composio/useComposioConnectFlow.ts
@@ -109,7 +109,6 @@ export function useComposioConnectFlow({
);
const [error, setError] = useState<string | null>(null);
const [connectUrl, setConnectUrl] = useState<string | null>(null);
- const [clearMemoryOnDisconnect, setClearMemoryOnDisconnect] = useState(false);
// Provider-specific required fields are sourced from the declarative
// registry rather than per-toolkit booleans (#2127). New providers
@@ -554,16 +553,14 @@ export function useComposioConnectFlow({
setPhase('disconnecting');
setError(null);
try {
- await deleteConnection(conn.id, { clearMemory: clearMemoryOnDisconnect });
+ await deleteConnection(conn.id);
const remaining = activeConnections.filter(c => c.id !== conn.id);
setActiveConnections(remaining);
if (remaining.length > 0) {
setActiveConnection(remaining[0]);
- setClearMemoryOnDisconnect(false);
setPhase('connected');
} else {
setActiveConnection(undefined);
- setClearMemoryOnDisconnect(false);
setPhase('idle');
}
onChanged?.();
@@ -571,10 +568,9 @@ export function useComposioConnectFlow({
const msg = err instanceof Error ? err.message : String(err);
setPhase('error');
setError(t('composio.connect.disconnectFailed').replace('{msg}', msg));
- setClearMemoryOnDisconnect(false);
}
},
- [activeConnection, activeConnections, clearMemoryOnDisconnect, onChanged, t]
+ [activeConnection, activeConnections, onChanged, t]
);
return {
@@ -584,8 +580,6 @@ export function useComposioConnectFlow({
error,
setError,
connectUrl,
- clearMemoryOnDisconnect,
- setClearMemoryOnDisconnect,
requiredFields,
fieldValues,
setFieldValues,
diff --git a/app/src/lib/composio/composioApi.test.ts b/app/src/lib/composio/composioApi.test.ts
index 632cb0a94c..f22d0ecd9f 100644
--- a/app/src/lib/composio/composioApi.test.ts
+++ b/app/src/lib/composio/composioApi.test.ts
@@ -9,7 +9,6 @@ import {
listConnections,
listToolkits,
listTriggers,
- syncConnection,
} from './composioApi';
const mockCallCoreRpc = vi.fn();
@@ -107,67 +106,6 @@ describe('composioApi trigger wrappers', () => {
});
expect(out.deleted).toBe(true);
});
-
- it('deleteConnection forwards clear_memory only when requested', async () => {
- mockCallCoreRpc.mockResolvedValue({
- result: { deleted: true, memory_chunks_deleted: 3 },
- logs: [],
- });
-
- const out = await deleteConnection('conn-1', { clearMemory: true });
-
- expect(mockCallCoreRpc).toHaveBeenCalledWith({
- method: 'openhuman.composio_delete_connection',
- params: { connection_id: 'conn-1', clear_memory: true },
- });
- expect(out.memory_chunks_deleted).toBe(3);
- });
-});
-
-describe('syncConnection', () => {
- beforeEach(() => {
- mockCallCoreRpc.mockReset();
- });
-
- it('dispatches composio_sync with the connection id and default reason=manual', async () => {
- mockCallCoreRpc.mockResolvedValue({
- result: { toolkit: 'gmail', connectionId: 'conn-1', items_ingested: 4 },
- logs: ['stub'],
- });
-
- const out = await syncConnection('conn-1');
-
- expect(mockCallCoreRpc).toHaveBeenCalledWith({
- method: 'openhuman.composio_sync',
- params: { connection_id: 'conn-1', reason: 'manual' },
- });
- // Outcome envelope is unwrapped to the bare provider payload.
- expect(out).toMatchObject({ toolkit: 'gmail', connectionId: 'conn-1' });
- });
-
- it('forwards an explicit reason verbatim (periodic / connection_created)', async () => {
- mockCallCoreRpc.mockResolvedValue({});
-
- await syncConnection('conn-2', 'periodic');
- expect(mockCallCoreRpc).toHaveBeenLastCalledWith({
- method: 'openhuman.composio_sync',
- params: { connection_id: 'conn-2', reason: 'periodic' },
- });
-
- await syncConnection('conn-3', 'connection_created');
- expect(mockCallCoreRpc).toHaveBeenLastCalledWith({
- method: 'openhuman.composio_sync',
- params: { connection_id: 'conn-3', reason: 'connection_created' },
- });
- });
-
- it('returns non-object outcomes verbatim (unwrap is a no-op for primitives)', async () => {
- // Defensive: a future Rust handler returning a bare scalar / null
- // shouldn't trip the unwrap path.
- mockCallCoreRpc.mockResolvedValue(null);
- const out = await syncConnection('conn-null');
- expect(out).toBeNull();
- });
});
describe('listAgentReadyToolkits', () => {