Files
composiohq__composio/.changeset
Alberto Schiabel 4b5920bf7a feat(sdk): add session.ensureConnected to reconcile connection state (#4536)
This PR:

- addresses the connection-readiness finding from the Sept 2026 SDK +
client hackathon (area 8): `session.authorize()` always starts a new
link flow, even when the session already resolves an ACTIVE connection
for the toolkit — callers ended up with a pending connected account
while `session.toolkits()` reported a different, active one, and nothing
in the SDK reconciled the two
- adds `session.ensureConnected(toolkit, options?)`: it checks the
session's connection state first — an ACTIVE connection (or a no-auth
toolkit) returns immediately with `wasConnected: true` and no link is
created; otherwise it starts the authorization flow and waits for the
new connection to become active (`timeout` option, default 60s)
- keeps `authorize()` unchanged as the primitive for interactive flows
that should surface the redirect URL instead of blocking
- documents the `session.execute()` `account` option's runtime contract:
accepted on every project, and on single-account projects the identifier
must match one of the session's active connections for the toolkit
(matching the API behavior after the Apollo side-fix)
- adds 5 unit tests for `ensureConnected` (already-connected no-op,
no-auth short-circuit, link-and-wait, pending-account relink, option
validation) and a changeset

Verification: `pnpm exec vitest run` in `ts/packages/core` — 1320
passed; `pnpm typecheck` (tsc + type tests) clean; `pnpm lint` clean at
repo root.
2026-09-18 18:56:25 +02:00
..
2025-05-19 19:30:29 +05:30

Changesets

Hello and welcome! This folder has been automatically generated by @changesets/cli, a build tool that works with multi-package repos, or single-package repos to help you version and publish your code. You can find the full documentation for it in our repository

We have a quick list of common questions to get you started engaging with this project in our documentation