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): harden triggers status filtering and error handling
Align trigger status counts with filtered output semantics, avoid duplicate deprecated ID params, and handle HTTP failures gracefully while reusing shared toolkit slug formatting logic. Co-authored-by: Cursor <cursoragent@cursor.com>
haxzie committed
Feb 23, 2026 at 19:27 UTC
fcdd97e8e91b01cb09457a30a3572bde1c3dba5b
3 files changed
+44
-24
ts/packages/cli/src/commands/triggers/commands/triggers.status.cmd.ts
+40
-20
@@ -1,10 +1,15 @@
1
import { Command, Options } from '@effect/cli';
2
import { Effect, Option } from 'effect';
3
+import { handleHttpServerError } from 'src/effects/handle-http-error';
4
import { requireAuth } from 'src/effects/require-auth';
5
import { ComposioToolkitsRepository } from 'src/services/composio-clients';
6
import { TerminalUI } from 'src/services/terminal-ui';
7
import { clampLimit } from 'src/ui/clamp-limit';
7
-import { formatTriggersStatusJson, formatTriggersStatusTable } from '../format';
8
+import {
9
+ formatTriggersStatusJson,
10
+ formatTriggersStatusTable,
11
+ toolkitSlugFromTriggerName,
12
+} from '../format';
13
14
const userIds = Options.text('user-ids').pipe(
15
Options.withDescription('Filter by user IDs, comma-separated'),
@@ -71,11 +76,6 @@ const mergeCsvOptions = (
76
return merged.length > 0 ? merged : undefined;
77
};
78
74
-const deriveToolkitSlug = (triggerName: string): string => {
75
- const prefix = triggerName.split('_')[0];
76
- return prefix ? prefix.toLowerCase() : '';
77
-};
78
-
79
/**
80
* Display active trigger instances with optional filters.
81
*/
@@ -114,22 +114,41 @@ export const triggersCmd$Status = Command.make(
114
const triggerNamesList = csvOption(triggerNames)?.map(name => name.toUpperCase());
115
const toolkitsList = csvOption(toolkits)?.map(slug => slug.toLowerCase());
116
117
- const result = yield* ui.withSpinner(
118
- 'Fetching trigger status...',
119
- repo.listActiveTriggers({
120
- user_ids: csvOption(userIds),
121
- connected_account_ids: connectedAccountIdsList,
122
- trigger_ids: csvOption(triggerIds),
123
- trigger_names: triggerNamesList,
124
- show_disabled: showDisabled,
125
- deprecatedConnectedAccountUuids: csvOption(deprecatedConnectedAccountUuids),
126
- limit: clampLimit(limit),
127
- })
128
- );
117
+ const resultOpt = yield* ui
118
+ .withSpinner(
119
+ 'Fetching trigger status...',
120
+ repo.listActiveTriggers({
121
+ user_ids: csvOption(userIds),
122
+ connected_account_ids: connectedAccountIdsList,
123
+ trigger_ids: csvOption(triggerIds),
124
+ trigger_names: triggerNamesList,
125
+ show_disabled: showDisabled,
126
+ limit: clampLimit(limit),
127
+ })
128
+ )
129
+ .pipe(
130
+ Effect.asSome,
131
+ Effect.catchTag(
132
+ 'services/HttpServerError',
133
+ handleHttpServerError(ui, {
134
+ fallbackMessage: 'Failed to fetch trigger status.',
135
+ hint: 'Retry with:\n> composio triggers status --show-disabled',
136
+ fallbackValue: Option.none(),
137
+ })
138
+ )
139
+ );
140
+
141
+ if (Option.isNone(resultOpt)) {
142
+ return;
143
+ }
144
+
145
+ const result = resultOpt.value;
146
147
const filteredItems =
148
toolkitsList && toolkitsList.length > 0
132
- ? result.items.filter(item => toolkitsList.includes(deriveToolkitSlug(item.trigger_name)))
149
+ ? result.items.filter(item =>
150
+ toolkitsList.includes(toolkitSlugFromTriggerName(item.trigger_name))
151
+ )
152
: result.items;
153
154
if (filteredItems.length === 0) {
@@ -142,7 +161,8 @@ export const triggersCmd$Status = Command.make(
161
}
162
163
const showing = filteredItems.length;
145
- const total = filteredItems.length;
164
+ const total =
165
+ toolkitsList && toolkitsList.length > 0 ? result.items.length : result.total_items;
166
167
yield* ui.log.info(
168
`Listing ${showing} of ${total} triggers\n\n${formatTriggersStatusTable(filteredItems)}`
ts/packages/cli/src/commands/triggers/format.ts
+3
-3
@@ -70,7 +70,7 @@ const TRIGGER_STATUS_TABLE = {
70
const toStatus = (item: TriggerInstanceItem): string =>
71
item.disabled_at === null ? 'ACTIVE' : 'DISABLED';
72
73
-const toToolkitSlug = (triggerName: string): string => {
73
+export const toolkitSlugFromTriggerName = (triggerName: string): string => {
74
const prefix = triggerName.split('_')[0];
75
return prefix ? prefix.toLowerCase() : '-';
76
};
@@ -92,7 +92,7 @@ export const formatTriggersStatusTable = (items: ReadonlyArray<TriggerInstanceIt
92
truncate(item.trigger_name, TRIGGER_STATUS_TABLE.triggerName).padEnd(
93
TRIGGER_STATUS_TABLE.triggerName
94
),
95
- truncate(toToolkitSlug(item.trigger_name), TRIGGER_STATUS_TABLE.toolkit).padEnd(
95
+ truncate(toolkitSlugFromTriggerName(item.trigger_name), TRIGGER_STATUS_TABLE.toolkit).padEnd(
96
TRIGGER_STATUS_TABLE.toolkit
97
),
98
truncate(item.user_id || '-', TRIGGER_STATUS_TABLE.userId).padEnd(
@@ -114,7 +114,7 @@ export const formatTriggersStatusJson = (items: ReadonlyArray<TriggerInstanceIte
114
id: item.id,
115
uuid: item.uuid || undefined,
116
trigger_name: item.trigger_name,
117
- toolkit_slug: toToolkitSlug(item.trigger_name),
117
+ toolkit_slug: toolkitSlugFromTriggerName(item.trigger_name),
118
user_id: item.user_id || undefined,
119
connected_account_id: item.connected_account_id || undefined,
120
status: toStatus(item),
ts/packages/cli/test/src/commands/triggers/triggers.status.cmd.test.ts
+1
-1
@@ -136,7 +136,7 @@ describe('CLI: composio triggers status', () => {
136
137
expect(output).toContain('trg_active_2');
138
expect(output).not.toContain('trg_active_1');
139
- expect(output).toContain('Listing 1 of 1 triggers');
139
+ expect(output).toContain('Listing 1 of 2 triggers');
140
})
141
);
142
}