Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
fix(cli): page through every connected account in connections list (#5174)
## What was asked `composio connections list` returned at most 50 connected accounts with no pagination and no warning that the list was cut off. For an account with more than 50 connections, toolkits past the first page (e.g. an ACTIVE Slack connection) looked disconnected. The request was to make the list complete. ## Root cause `GET /api/v3.1/connected_accounts` caps the page size at 50: a larger `limit` is clamped without an error, and the response carries a `next_cursor`. The CLI sent `limit: 1000` once and never read `next_cursor`, in three places: - `connections list`: printed only the first 50 accounts - `connections remove <account>`: could not find an account past the first 50 - the session connection lookup (`listActiveConnectedAccounts`, used by `composio execute` sessions): left out toolkits whose accounts were past the first 50 active ones ## Change - New `listAllConnectedAccounts` (`src/services/list-all-connected-accounts.ts`) follows `next_cursor` to the last page with `limit: 50`. - `connections list`, `connections remove`, and both session lookups use it. - New `decodeAllConnectedAccountPages` decodes the collected items with the same allowlist and redacted error as `decodeConnectedAccountList`. - Since the shared active-accounts list is now complete, `listConnectedAccountsForToolkit` always derives from it. The toolkit-filtered fallback (and its "first 100" slice) is removed. - CHANGELOG entry under Unreleased → Patch Changes. `--toolkit <slug>` was only a partial workaround before this change: it was also capped at 50 accounts per toolkit. ## Tests - New argv-level test: 50 accounts on page 1, Slack on page 2 → `connections list` prints both and makes 2 requests. It fails on the old handler. - Replaced the two fallback tests in `connected-account-selection.test.ts` with one that pages via `next_cursor` (asserts `limit=50`, `cursor=page-2`, no toolkit-filtered request). - `request-failures.client.test.ts`: expected listing query is now `limit=50`. Checks run locally: - `pnpm --filter @composio/cli run typecheck`: 0 errors - `pnpm --filter @composio/cli run lint:effect`: 0 errors - `vitest run` (full CLI suite): 2900 passed, 1 skipped - `validate:skills`, `validate:boundaries`, `validate:command-tests`: OK Not verified: a live run against an account with more than 50 connections. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Mustafa Ansari [zen] <mustafa@composio.dev> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: jkomyno <alberto@composio.dev>