Fix connector Connect: use the link flow and surface failures

Root cause found by probing the live API: Composio v3 rejects
POST /connected_accounts for Composio-managed OAuth auth configs with a
400 pointing at POST /connected_accounts/link, and the renderer threw
the failure away inside a .then, so clicking Connect did nothing and no
browser opened.

- createConnectedAccount now calls POST /connected_accounts/link with
  auth_config_id and user_id and reads connected_account_id and
  redirect_url; the local mirror records INITIALIZING until the poll
  adopts Composio's real status.
- Connect failures (and a blocked external-URL open) now show as a
  single line on the page instead of vanishing.
This commit is contained in:
ZacharyZhang-NY committed 2026-07-07 01:53:22 -04:00
1 parent a2de132083
commit d19573187c
4 files changed
+40 -16

No files matched your search

+25 -4
View File
@@ -26,6 +26,7 @@ export function ConnectorsPage({ snapshot, actions }: PageProps) {
const employee = requireActiveEmployee(snapshot);
const [catalogSlot, setCatalogSlot] = useState<CatalogSlot>(null);
const [busySlug, setBusySlug] = useState<string | null>(null);
const [connectError, setConnectError] = useState<string | null>(null);
const pollTimer = useRef<ReturnType<typeof setTimeout> | null>(null);
const catalog: CatalogState = catalogSlot && catalogSlot.orgId === orgId ? catalogSlot.state : { phase: "loading" };
@@ -90,14 +91,19 @@ export function ConnectorsPage({ snapshot, actions }: PageProps) {
const connect = (toolkit: ComposioToolkitSummaryDto) => {
setBusySlug(toolkit.slug);
setConnectError(null);
void window.agentCompany
.connectComposioToolkit({ orgId, toolkitSlug: toolkit.slug, toolkitName: toolkit.name })
.then((result) => {
if (!result.ok) throw new Error(result.error.message);
if (result.data.redirectUrl) {
void window.agentCompany.openExternalUrl(result.data.redirectUrl);
.then(async (result) => {
if (!result.ok) {
setConnectError(result.error.message);
return;
}
pollUntilActive(toolkit.slug, 0);
if (result.data.redirectUrl) {
const opened = await window.agentCompany.openExternalUrl(result.data.redirectUrl);
if (!opened.ok) setConnectError(opened.error.message);
}
})
.finally(() => setBusySlug(null));
};
@@ -112,6 +118,21 @@ export function ConnectorsPage({ snapshot, actions }: PageProps) {
<div style={{ maxWidth: 1060 }}>
<h2 style={{ margin: "0 0 18px", fontSize: 16, fontWeight: 600 }}>Connectors</h2>
{connectError && (
<div
style={{
color: "var(--text-2)",
fontSize: 13,
marginBottom: 14,
overflow: "hidden",
textOverflow: "ellipsis",
whiteSpace: "nowrap",
}}
>
{connectError}
</div>
)}
<ConnectedList accounts={accounts} grants={grants} agents={agents} onGrant={grant} onRevoke={revoke} />
{catalog.phase === "loading" && (