Skip to content

feat: answer a lich worker's task with its last message - #42

Merged
omartelo merged 3 commits into
mainfrom
feat/worker-auto-answer
Oct 5, 2026
Merged

omartelo merged 3 commits into
mainfrom
feat/worker-auto-answer

Conversation

@omartelo

@omartelo omartelo commented Oct 5, 2026

Copy link
Copy Markdown
Collaborator

Client side of omartelo/lich feat/worker-auto-answer:

  • hooks/worker-answer.js: in a lich worker (LICH_SUBAGENT_CARDS=off), posts the turn's final message to POST /mod/answer when the main loop's Stop lists no background tasks and the turn ended with an answer (not aborted, not blank); cut at 16,000 characters.
  • Status line: a worker in this checkout counts until lich stops listing it (lich closes it once it reported); a done turn with a command left in the background no longer drops it, and TaskStop keeps reaching lich. An isolated worker still ends at a done turn.

Fixtures pinned to the lich branch until a release ships the contract. Tests: node 303/303, claude plugin test . 23/23, validate ok. Live: see the lich PR. Release as 0.17.0 after lich ships.

A new mod, hooks/worker-answer.js, implements lich's mod-answer contract
(POST /mod/answer {session_id, text}). In a session spawned with
LICH_SUBAGENT_CARDS=off, which every `lich open --subagent` worker is, it
posts the final message of a main-loop turn whose classic.Stop listed no
background task and whose turn.complete ended with a non-blank answer. A
turn that backgrounded work answers only in the turn Claude Code resumes in;
aborted, failed, refused and subagent turns never answer. lich then hands
such a worker its task without the ticket and the reply instructions.

The fixture is vendored from the lich commit that adds the contract, which is
in no release yet.
A worker that ended its turn with a command left in the background is listed
done, so the status line dropped it and TaskStop went to Claude Code while it
still worked. A same-checkout worker now runs until lich stops listing it, which
lich does once it reported; an isolated worker, which keeps its card, still ends
at a done turn. The two status-line tests change because that rule changed.
@omartelo
omartelo merged commit 518ad0d into main Oct 5, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant