Repository navigation
Description
Version and environment
Clean main 13797cce49dce352669c9ccc4f8d28f75712144e, Astra CLI/Server 0.2.11, Linux. Both binaries reported that SHA and git_dirty=false. A real GLM-5.3 one-shot astra chat --no-resume --permission-mode bypass --json ran only a synthetic task in a new empty Git workspace.
Actual behavior
After the structured tool_started event for Bash, sending SIGINT terminated the CLI immediately by the signal (subprocess return code -2 / conventional shell status 130). No final JSON result was written. The task was a 20-second sleep followed by a marker write; the marker was absent.
An independent, explicit cancellation of the exact owned run initially returned execution_settled=false; a later bounded cleanup confirmed execution_settled=true and the marker remained absent. No continuation was submitted while settlement was uncertain. This does not establish a permanent leaked run or that the old write executed; it establishes that this one-shot path did not use its graceful user-cancellation/result path.
Root cause
The Chat command constructs a cancellation token and incremental state only when --max-wall-time-seconds is supplied, then awaits execute_basic_cli_turn. Neither that await nor the thin one-shot facade consumes SIGINT. The existing tokio::signal::ctrl_c() branch, owner-bound notification, cancellation token, bounded drain and partial-result handling live in the interactive turn_stream_runner::await_stream_with_interrupts path. The one-shot command does not enter that owner.
Reproduction
- Start a normal authenticated one-shot chat with JSON and a dedicated stream-event file, asking for one Bash command: sleep 20 seconds, then write a synthetic marker. Do not request repositories, credentials or network access.
- After the Bash
tool_startedevent, send SIGINT to that CLI process. - Observe signal termination and an empty terminal JSON output, rather than bounded graceful cancellation and a typed interrupted result.
- Before any continuation, settle the exact run through the existing authenticated cancellation API; do not replay the uncertain command.
Expected behavior
Wire user interruption through the existing one-shot lifecycle/cancellation owner. Capture a usable cancellation scope before dispatch, cancel only the admitted run with its captured credential owner, drain within one bounded deadline, and report settlement and interruption truthfully before exit. Preserve canonical journal/lease checks and uncertain-effect safeguards. Internal transport failure must remain distinct from explicit user cancellation; a second force-exit signal may still terminate immediately. Reuse existing cancellation/settlement mechanisms rather than adding another poller or treating terminal status alone as settled.
Activity