@devries-cameron20 / composio-1 / commits / 0c9cb82fe
Fork 0

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): apply unknown-status guard to connections list/remove commands

`connections.list.cmd.ts` and `connections.remove.cmd.ts` decode the same `ConnectedAccountListResponse` schema as `connected-accounts.list.cmd.ts` but were yielding the decode without a `catchTag` — a future server-side status addition would brick those commands for every user, including users not filtering by status. Mirror the forward-compat guard from `connected-accounts.list.cmd.ts`: catch `ParseError`, warn pointing at `composio upgrade`, fall back to the raw response. Surfaced by pattern-recognition review of PR #3344 (P2#4) — keeping the guard scoped to one command of three would reproduce the same bug Apollo's next enum addition (queued S2S_OAUTH2 revocation) is about to cause.

jkomyno committed May 7, 2026 at 10:49 UTC 0c9cb82fed0ab47f3a894f715d1d5fb179360140
2 files changed +32 -2
ts/packages/cli/src/commands/connections/commands/connections.list.cmd.ts
+16 -1
@@ -73,7 +73,22 @@ export const connectionsCmd$List = Command.make('list', { toolkit }, ({ toolkit
73 limit: 1000,
74 })
75 );
76 - const result = yield* Schema.decodeUnknown(ConnectedAccountListResponse)(rawResult);
76 + // Same forward-compat guard as `connected-accounts.list.cmd.ts`: the
77 + // closed `Schema.Literal(...)` for `status` would brick this command
78 + // for the entire user base when Apollo adds a new enum value.
79 + const result = yield* Schema.decodeUnknown(ConnectedAccountListResponse)(rawResult).pipe(
80 + Effect.catchTag('ParseError', error =>
81 + Effect.gen(function* () {
82 + yield* ui.log.warn(
83 + `Server returned a connection field this CLI does not recognize ` +
84 + `(likely a newly-added status). Run "composio upgrade" to pick up ` +
85 + `the latest schema. Continuing with raw response.\n\n` +
86 + `Decode error: ${error.message}`
87 + );
88 + return rawResult as ConnectedAccountListResponse;
89 + })
90 + )
91 + );
92
93 yield* ui.output(formatConnectionsJson(result.items), { force: true });
94 })
ts/packages/cli/src/commands/connections/commands/connections.remove.cmd.ts
+16 -1
@@ -109,7 +109,22 @@ export const connectionsCmd$Remove = Command.make('remove', { account }, ({ acco
109 })
110 )
111 );
112 - const result = yield* Schema.decodeUnknown(ConnectedAccountListResponse)(rawResult);
112 + // Same forward-compat guard as `connected-accounts.list.cmd.ts`: the
113 + // closed `Schema.Literal(...)` for `status` would brick this command
114 + // for the entire user base when Apollo adds a new enum value.
115 + const result = yield* Schema.decodeUnknown(ConnectedAccountListResponse)(rawResult).pipe(
116 + Effect.catchTag('ParseError', error =>
117 + Effect.gen(function* () {
118 + yield* ui.log.warn(
119 + `Server returned a connection field this CLI does not recognize ` +
120 + `(likely a newly-added status). Run "composio upgrade" to pick up ` +
121 + `the latest schema. Continuing with raw response.\n\n` +
122 + `Decode error: ${error.message}`
123 + );
124 + return rawResult as ConnectedAccountListResponse;
125 + })
126 + )
127 + );
128 const resolved = resolveAccount({ accounts: result.items, selector: account });
129
130 if ('error' in resolved) {