Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
TypeScript agentic-aiagentsaiai-agentsaiagentsdeveloper-toolsfunction-callinggpt-4javascriptjsllmllmopsmcppythonremote-mcp-serverssetypescript
feat(connected-accounts): support REVOKED status added in Apollo PR #9550
Zen Agent0b32b158f38b
diff --git a/python/composio/core/models/connected_accounts.py b/python/composio/core/models/connected_accounts.pyindex 6479f86c6..0b8d7ee0c 100644--- a/python/composio/core/models/connected_accounts.py+++ b/python/composio/core/models/connected_accounts.py@@ -77,10 +77,18 @@ class ConnectionRequest(Resource):while deadline > time.time():connection = self._client.connected_accounts.retrieve(nanoid=self.id)self.status = connection.status- if self.status != "ACTIVE":- time.sleep(1)- continue- return connection+ if self.status == "ACTIVE":+ return connection+ # Fail fast on terminal non-ACTIVE states (FAILED / EXPIRED /+ # INACTIVE / REVOKED) instead of polling until timeout.+ if self.status in ("FAILED", "EXPIRED", "INACTIVE", "REVOKED"):+ raise exceptions.SDKError(+ message=(+ f"Connection {self.id} entered terminal state "+ f"{self.status!r} before becoming active"+ ),+ )+ time.sleep(1)raise exceptions.ComposioSDKTimeoutError(message=f"Timeout while waiting for connection {self.id} to be active",diff --git a/python/composio/core/models/webhook_events.py b/python/composio/core/models/webhook_events.pyindex 790d5c2d7..9f29da5dc 100644--- a/python/composio/core/models/webhook_events.py+++ b/python/composio/core/models/webhook_events.py@@ -29,6 +29,7 @@ class ConnectionStatusEnum(str, Enum):FAILED = "FAILED"EXPIRED = "EXPIRED"INACTIVE = "INACTIVE"+ REVOKED = "REVOKED"# =============================================================================diff --git a/ts/packages/cli/src/models/connected-accounts.ts b/ts/packages/cli/src/models/connected-accounts.tsindex 91128e845..9a58d4147 100644--- a/ts/packages/cli/src/models/connected-accounts.ts+++ b/ts/packages/cli/src/models/connected-accounts.ts@@ -13,7 +13,15 @@ export const ConnectedAccountItem = Schema.Struct({id: Schema.String,word_id: Schema.optional(Schema.NullOr(Schema.String)),alias: Schema.optional(Schema.NullOr(Schema.String)),- status: Schema.Literal('INITIALIZING', 'INITIATED', 'ACTIVE', 'FAILED', 'EXPIRED', 'INACTIVE'),+ status: Schema.Literal(+ 'INITIALIZING',+ 'INITIATED',+ 'ACTIVE',+ 'FAILED',+ 'EXPIRED',+ 'INACTIVE',+ 'REVOKED'+ ),status_reason: Schema.optionalWith(Schema.NullOr(Schema.String), { default: () => null }),is_disabled: Schema.Boolean,user_id: Schema.String,diff --git a/ts/packages/cli/src/services/composio-clients.ts b/ts/packages/cli/src/services/composio-clients.tsindex fb4ddb747..0a8c95bd6 100644--- a/ts/packages/cli/src/services/composio-clients.ts+++ b/ts/packages/cli/src/services/composio-clients.ts@@ -1775,9 +1775,18 @@ function buildConnectedAccountsNamespace(client.connectedAccounts.list({toolkit_slugs: params.toolkit_slugs,user_ids: params.user_ids,- statuses: params.statuses as- | Array<'INITIALIZING' | 'INITIATED' | 'ACTIVE' | 'FAILED' | 'EXPIRED' | 'INACTIVE'>- | undefined,+ // Cast widens to whatever the Stainless-generated client+ // currently accepts, plus 'REVOKED'. The cast bypasses the+ // stale Stainless types so callers passing 'REVOKED' (a valid+ // Apollo status) are forwarded as-is until @composio/client is+ // regenerated.+ statuses: params.statuses as Parameters<+ typeof client.connectedAccounts.list+ >[0] extends infer P+ ? P extends { statuses?: infer S }+ ? S+ : never+ : never,limit: params.limit,}),ConnectedAccountListResponsediff --git a/ts/packages/cli/src/services/tool-router-session-connections.ts b/ts/packages/cli/src/services/tool-router-session-connections.tsindex 2a727d56a..cec5bcb1a 100644--- a/ts/packages/cli/src/services/tool-router-session-connections.ts+++ b/ts/packages/cli/src/services/tool-router-session-connections.ts@@ -56,6 +56,7 @@ const normalizeConnectedAccountStatus = (case 'FAILED':case 'EXPIRED':case 'INACTIVE':+ case 'REVOKED':return status;default:return 'INACTIVE';diff --git a/ts/packages/core/src/models/ConnectedAccounts.ts b/ts/packages/core/src/models/ConnectedAccounts.tsindex e41d04cf0..36f9cc5aa 100644--- a/ts/packages/core/src/models/ConnectedAccounts.ts+++ b/ts/packages/core/src/models/ConnectedAccounts.ts@@ -107,7 +107,11 @@ export class ConnectedAccounts {cursor: parsedQuery.data.cursor?.toString(),limit: parsedQuery.data.limit,order_by: parsedQuery.data.orderBy,- statuses: parsedQuery.data.statuses,+ // Cast widens to match the Stainless-generated client params, which+ // lag behind the live API enum. Apollo accepts the union value at+ // runtime (`z.nativeEnum(ConnectionStatusEnum)` on the query param);+ // remove the cast once `@composio/client` is regenerated.+ statuses: parsedQuery.data.statuses as ConnectedAccountListParamsRaw['statuses'],toolkit_slugs: parsedQuery.data.toolkitSlugs,user_ids: parsedQuery.data.userIds,};