发布

  • feat(connected-accounts): support REVOKED status added in Apollo #9550 (#3344)

    frostbyte_neo 发布于 2026-05-07 10:19:19 +00:00

    Description

    Apollo (hermes#9550) added a new `REVOKED` value to the
    connected-account status enum, alongside the existing `INITIALIZING |
    INITIATED | ACTIVE | FAILED | EXPIRED | INACTIVE`. The Apollo
    public-API response schema is `z.nativeEnum(ConnectionStatusEnum)`, so
    any list / get / status-update endpoint can now return `REVOKED` and
    clients must handle it.

    This PR fixes every hand-written place in the TS and Python SDKs that
    hard-coded the prior 6-value set and would either (a) fail-fast against
    `REVOKED` (Zod / Effect Schema parse error) or (b) silently
    misclassify it.

    TypeScript SDK — BREAKING fixes

    File Change Severity
    `ts/packages/core/src/types/connectedAccounts.types.ts` Add
    `REVOKED` to `ConnectedAccountStatuses` and
    `ConnectedAccountStatusSchema` (`z.enum`) BREAKING —
    `z.enum().parse()` would throw on responses containing the new value
    `ts/packages/cli/src/models/connected-accounts.ts` Add `REVOKED`
    to Effect `Schema.Literal(...)` for `ConnectedAccountItem.status`
    BREAKING — `Schema.Literal()` enforces literal matching
    `ts/packages/cli/src/services/tool-router-session-connections.ts`
    Add `'REVOKED'` case to the `normalizeConnectedAccountStatus` switch
    BREAKING — silent fall-through to `'INACTIVE'` masked the new status
    `ts/packages/cli/src/services/composio-clients.ts` Replace the
    explicit 6-value cast with a generic that resolves to whatever the
    Stainless client currently accepts Forwards `REVOKED` to Apollo;
    auto-tracks future Stainless regenerations
    `ts/packages/core/src/models/ConnectedAccounts.ts` Cast
    `statuses` to the Stainless params type so `REVOKED` (already
    accepted by Apollo) flows through until `@composio/client` is
    regenerated Adapter shim; remove once `@composio/client` is
    regenerated

    Python SDK — DEGRADED fixes

    File Change Severity
    `python/composio/core/models/webhook_events.py` Add `REVOKED` to
    `ConnectionStatusEnum` DEGRADED — code that checked `status in
    ConnectionStatusEnum` would have failed to recognise the new value
    `python/composio/core/models/connected_accounts.py`
    `ConnectionRequest.wait_for_connection` now fails fast on terminal
    non-ACTIVE states (`FAILED` / `EXPIRED` / `INACTIVE` /
    `REVOKED`) instead of looping until the 60s timeout DEGRADED —
    REVOKED used to look identical to "still pending" until the timeout
    fired

    The Stainless-generated `@composio/client` (TS) and
    `composio_client` (Python) packages will pick up `REVOKED`
    automatically when regenerated; this PR covers the hand-written SDK code
    only.

    How did I test this PR

    • `pnpm typecheck` (root) — clean (`9 successful, 9 total`)
    • `pnpm test` (root) — 694 passed, 1 skipped (75 test files); examples
      validation `Validated 22 example packages`
    • Python: `ruff check` and `ruff format --check` clean on both
      edited files
    • Smoke-tested Python imports + enum membership:
      ```
      PYTHON: imports OK, REVOKED present: REVOKED
      ```

    Triggered by: sarthak@composio.dev | Source: web
    Session:
    https://zen-api-production-4c98.up.railway.app/dashboard/#/chat/zen-14dc825802da

    下载附件