You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 2fe43b6
Browse filesBrowse the repository at this point in the historyBrowse files
feat(infinity-daemon): add input-less Interrupt for in-flight generation
Adds a real interrupt capability to the protocol and daemon: clients can
stop a thread's in-flight work without queuing input and without shutting
the session down.
## Protocol (`infinity-protocol`)
* New `ClientMessage::Interrupt { thread_id }`: interrupts the thread and
its descendant subtree. Additive enum variant; old daemons silently skip
unparsable frames (both the unix-socket and websocket handlers
`continue` on deserialization failure), so sending to an old daemon is a
safe no-op.
## Core (`infinity-agent-core`)
* New `TaggedSyntheticKind::Interrupt` input marker (plus
`SyntheticKind::is_interrupt` / `thread::is_interrupt_input`). The marker
is consumed entirely by the thread driver — never folded into history or
queued for the model.
* Driver: an interrupt marker cancels the in-flight completion exactly like
user text does (the cancelled step flushes partial output and emits its
completion notification); markers reaching a parked or respawned driver
settle the thread directly. User text in the same batch supersedes the
marker.
* New `Thread::interrupt()`: settles a trailing unanswered tool call with
the synthetic "interrupted by user" result (so a late real result is
matched as already-answered and dropped instead of restarting
generation), sends best-effort RAP cancellation notifications, dismisses
pending user choices (broadcast as `UserChoiceComplete`), and persists.
The interrupted-call settlement logic is factored out of `step_no_defer`
and shared. Exactly one `CompletionFinished` (→ `ResponseDone`) is
emitted per interrupted round so clients settle their indicators.
## Daemon (`infinity-daemon`)
* `SessionManager::interrupt_thread()`: walks the target's subtree
(children tree) and delivers interrupt markers to the target plus every
active descendant (live or parked drivers; idle descendants are skipped —
nothing in flight to cancel). Threads stay alive and accept new input,
like after a normal `ResponseDone`.
* `ClientMessage::Interrupt` handled in the client handler (local and
remote-proxy paths; thread refs are stripped/prefixed like `UserInput`).
Web clients get the message for free via the existing ws passthrough.
## Tests
* core: interrupt cancels an in-flight completion without queuing input;
interrupt settles a pending async tool call so its late result is
dropped; threads accept input afterwards.
* daemon: `interrupt_thread` targets exactly the requested subtree —
interrupting a child leaves the root streaming, and both threads accept
new input after interruption.
0 commit comments