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
fix(connected-accounts,py): drop INACTIVE from terminal states in wait_for_connection
jkomyno4e1883089d38
diff --git a/python/composio/core/models/connected_accounts.py b/python/composio/core/models/connected_accounts.pyindex 0b8d7ee0c..e9545088a 100644--- a/python/composio/core/models/connected_accounts.py+++ b/python/composio/core/models/connected_accounts.py@@ -74,14 +74,20 @@ class ConnectionRequest(Resource):"""timeout = self.DEFAULT_WAIT_TIMEOUT if timeout is None else timeoutdeadline = time.time() + timeout+ # Mirror the TS contract (`ConnectionRequest.ts` `terminalErrorStates`):+ # FAILED / EXPIRED / REVOKED are terminal — credentials are gone and+ # cannot transition back to ACTIVE without a fresh auth flow, so+ # polling until timeout is wasted wall-clock time.+ # INACTIVE is intentionally NOT terminal: it means "user disabled, can+ # be reactivated", and a connection can briefly transit through it+ # before settling on ACTIVE — failing fast there would regress callers.+ terminal_states = ("FAILED", "EXPIRED", "REVOKED")while deadline > time.time():connection = self._client.connected_accounts.retrieve(nanoid=self.id)self.status = connection.statusif 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"):+ if self.status in terminal_states:raise exceptions.SDKError(message=(f"Connection {self.id} entered terminal state "