@devries-cameron20 / composio-1 / commits / 103002ef1
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(ts/core): address cursorbot

jkomyno committed Jan 15, 2026 at 00:45 UTC 103002ef1f0af641034d9619d0992db49c4b48dd
1 file changed +17 -13
ts/packages/core/src/telemetry/Telemetry.ts
+17 -13
@@ -304,21 +304,25 @@ export class TelemetryTransport {
304 });
305
306 // Handle SIGINT (Ctrl+C) and SIGTERM (kill command)
307 - const signalHandler = (signal: string) => {
308 - logger.debug(`Received ${signal}, flushing telemetry...`);
309 - this.flush()
310 - .catch(error => {
311 - logger.debug('Error flushing telemetry on signal', error);
312 - })
313 - .finally(() => {
314 - // Re-emit the signal to allow normal process termination
315 - process.removeListener(signal as NodeJS.Signals, () => signalHandler(signal));
316 - process.kill(process.pid, signal);
317 - });
307 + // Store handler references so they can be properly removed
308 + const createSignalHandler = (signal: NodeJS.Signals) => {
309 + const handler = () => {
310 + logger.debug(`Received ${signal}, flushing telemetry...`);
311 + this.flush()
312 + .catch(error => {
313 + logger.debug('Error flushing telemetry on signal', error);
314 + })
315 + .finally(() => {
316 + // Remove the handler before re-emitting to prevent infinite loop
317 + process.removeListener(signal, handler);
318 + process.kill(process.pid, signal);
319 + });
320 + };
321 + return handler;
322 };
323
320 - process.on('SIGINT', () => signalHandler('SIGINT'));
321 - process.on('SIGTERM', () => signalHandler('SIGTERM'));
324 + process.on('SIGINT', createSignalHandler('SIGINT'));
325 + process.on('SIGTERM', createSignalHandler('SIGTERM'));
326 }
327 }
328