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): retry only API calls that are safe to repeat (#4860)
This PR: - is rebased onto `next` after https://github.com/ComposioHQ/composio/pull/4856 merged; the reads https://github.com/ComposioHQ/composio/pull/4878 made lenient pass `idempotent` alone, the three validated reads pass `{ ...idempotent, ...validated }` - builds every CLI client with `maxRetries: 0`; a call that is safe to repeat passes the new `idempotent` request option (`src/services/composio-request.ts`) and keeps the client's two retries - marks about 35 call sites `idempotent`: every read, plus four calls whose repeat changes nothing (realtime channel auth, presigned upload URL, consumer project resolve, the tool-schema meta call in `tools search`) - stops retrying creates, updates, deletes, links, tool-router sessions and CLI login sessions; tool execution and `proxy` were already sent once and drop their now-redundant `maxRetries: 0` - adds `lint:effect` (`scripts/check-effect-diagnostics.ts`), which runs the Effect language service over CLI `src/` and `test/` and fails on error-level diagnostics such as `floatingEffect`; the typecheck workflow runs it - returns the never-succeeding Effect in the two listen commands, the only existing findings of that check - adds `nonEmptyOrUndefined` (`src/utils/optional-params.ts`) for "leave an empty filter list out of the request", replacing five `list.length > 0 ? list : undefined` sites in files this PR touches (review feedback) ## Context The client retried a failed attempt (connection failure, timeout, 408, 409, 429, 5xx) whatever the call. A write that failed in flight may already have acted, so a retry could create a second auth config, trigger, link or session, or turn a successful delete into a "not found". Defaulting to no retries makes a forgotten option cost resilience on a read instead of a repeated side effect. A client call that is never yielded compiles and silently sends nothing. Neither tsc nor oxlint sees it; the Effect language service does, but only in editors until now. The check takes about a minute and uses the CLI's TypeScript 6 alias, because the workspace's TypeScript 7 has no JS API. Behavior change: a write that hits a 429 or a 5xx now fails on the first attempt instead of being retried. Reads behave as before; a live run of 23 read-only commands matches the pre-refactor baseline (22 byte-identical, 1 differing only in a request id). After the rebase: the CLI suite passes (152 files, 1673 passed, 1 skipped; 18 exemptions), `pnpm typecheck`, `lint:effect` (0 diagnostics), `oxlint` on every touched file and `validate:boundaries` are clean.