How does the system handle a SIGINT mid-stream, abort the in-flight model request and any running tools, persist session state, and flush analytics before exit

en
87.5% sentence pass·7/8 cited·7/7 citations valid·94 fn·0 dec·858 sem
Application Bootstrap & EntrypointsAPI Client & Model ResolutionTool FrameworkAnalytics & TelemetryFoundation Utilities

SIGINT mid-stream handling

Overview

The whitelist and source excerpts provided do not contain a SIGINT handler, abort-controller wiring for the in-flight request, tool cancellation path, session persistence on interrupt, or an analytics flush-before-exit routine that can be cited .

Steps

  1. The closest signal-adjacent surfaces in scope are withRetry, which throws APIUserAbortError when its options.signal is already aborted at the top of each attempt, and queryModel, which receives an AbortSignal parameter threaded from the caller . Neither function shows where SIGINT is bound to that signal, nor a cleanup chain .
  2. runHeadless contains gracefulShutdownSync call sites for error exits, but the body of gracefulShutdownSync and any telemetry/session flush it performs are not included in the provided source . registerCleanup appends to a cleanup set, but no caller that drains it on SIGINT is shown .
  3. Because the actual process.on('SIGINT', ...) handler, the AbortController.abort() call, the tool-execution cancellation branch in checkPermissionsAndCallTool, the session-log persistence writer, and the OTEL forceFlush/shutdown path in initializeTelemetry are not present in the whitelist or excerpts, the end-to-end flow cannot be faithfully traced here .

State touched

Decisions

(none in whitelist)