List a loop's question in loop-inbox only while the loop holds the session's lock, so a killed loop's question stays gone whatever its pid now names

This commit is contained in:
2026-10-29 18:14:44 +01:00
parent 93d413f5f3
commit 5df105033c
10 changed files with 157 additions and 66 deletions
+1 -1
View File
@@ -43,7 +43,7 @@ def interrupt(question: str, answer_here: bool, session: WorkerSession, paths: P
return stop
# Keys typed while the worker ran wait on the terminal, and would answer a question no one has read, here or in claude's session, which reads them too. Of a pasted answer, the first line answers; the rest wait, and the next question drops them. A longer answer goes through TALK.
effects.discard_typed()
ask = Ask(effects.new_id(), str(session.id), session.root, question, effects.now(), effects.pid(), Asking(session.claude_command()) if answer_here else OpenOnTerminal())
ask = Ask(effects.new_id(), str(session.id), session.root, question, effects.now(), Asking(session.claude_command()) if answer_here else OpenOnTerminal())
with listed(paths.waiting, ask, effects):
answer = first_answer(ask, paths, effects) if answer_here else OpenOnTerminal()
if isinstance(answer, OpenOnTerminal | OpenInInbox):