Make Omni/Agent respond to standard Unix signals the way interactive programs do:
SIGINT (Ctrl-C) → cancel the current iteration. The Op loop check should raise SteeringCancel (or equivalent), unwinding the current turn cleanly. In stdin-mode, after cancellation the agent returns to reading the next prompt. In one-shot mode it exits with a cancellation status.SIGTERM → finish the current iteration and then exit cleanly (no more prompts accepted). In one-shot mode it behaves the same as today.SIGHUP → ignore, or optionally treat like SIGTERM. TBD by the implementer.Pi uses {"type":"cancel"} on stdin. We're not doing that — cancel is what SIGINT was designed for, it's what every REPL, shell, and interactive Unix program uses, and it doesn't require inventing a command vocabulary. Keeps stdin as a pure prompt channel.
kill -INT <pid> during an in-flight loop iteration causes the current LLM call or tool to unwind cleanly via the existing SteeringCancel path in Op.check.kill -TERM <pid> causes the agent to finish the current iteration (don't cancel mid-turn), then exit 0 without reading another prompt.agent script.md shebang case is unaffected except that SIGINT now behaves like a cancel instead of a hard kill (which is a strict improvement).t-759.1 (stdin prompt mode must exist before the "return to read next prompt after cancel" behavior makes sense).
System.Posix.Signals (installHandler, sigINT, sigTERM).IORef or TVar flag that the Op loop's existing check step polls.SteeringCancel plumbing in Op.check — reuse it, don't invent new cancellation machinery.Reviewed b3a7429d. Approved.
Code review:
Per author: bild + bild --test passed locally. Approving and marking Done.
Implemented SIGINT/SIGTERM handling in Omni/Agent.hs using System.Posix.Signals. Added process-level signal state: SIGINT sets a cancel flag consumed via existing Op.check SteeringCancel path; SIGTERM sets a graceful-stop flag (no mid-turn cancellation). In stdin \0 mode, SIGINT cancels current turn and loop continues reading next prompt; SIGTERM stops accepting new prompts after current turn completes. Also ignore SIGHUP. Verified with bild Omni/Agent.hs and bild --test Omni/Agent.hs.