Make Pause end a llama turn that is running a tool

A llama turn's interrupt set a flag that the streaming loop and the tool
loop check, and nothing else. A tool call looks nowhere at all while it
runs: llama-server runs a shell command to its own timeout, up to a
minute, and the turn sat there for all of it with the phone showing a
Pause that had done nothing.

The wait is now a channel with two writers -- the call's own thread and
the interrupt -- so whichever speaks first decides what the model is
told. The call is left running on the machine and its answer dropped,
since nothing in that protocol takes one back. The same release covers a
permission question, so interrupt, detach and stop share one method.
This commit is contained in:
iris-ai committed 2026-09-21 02:19:36 -04:00
1 parent 6ed896f1e1
commit 78f2fe3b79
3 files changed
+110 -23

No files matched your search

+10
View File
@@ -487,6 +487,16 @@ written, and the fold uses that same predicate to decide a reply is settled.
`generate` now fails the turn for both -- a reply that stops early is not a
reply, and the transcript keeps whatever arrived before it.
- **A cancel flag is only as prompt as the next place somebody looks.** A
llama turn waits on two things that look nowhere at all: a permission
question, and a tool call `llama-server` is running -- a shell command there
runs to its own timeout, up to a minute. Setting `cancel` left the turn
exactly where it was until that came back, so Pause did nothing on screen
for as long as the command took. `Shared::abandon_turn` sets the flag *and*
releases both waits, the tool call by answering its channel with
`tools::UNFINISHED` -- the call is left running over there, because nothing
in that protocol takes one back, and its answer is dropped.
- **A path is stored as it was typed, and `~` is expanded where it is used.**
`~/repos/x` and `/home/someone/repos/x` are a path and a snapshot of where it
pointed, and the snapshot is what breaks when an account is renamed or the