acpmux: tasks: give a session a task, end it with a typed result in one call, list a chat's tasks

Merged
TE
1mo ago
+991-41

Part 1 of goal 8 in the design doc (leo-workspace research/2026-10-24-acpmux-tasks-liveness-urgency.md, leo-workspace#1010): task state with typed results, and acpmux task ls.

Leo, 2026-10-24: "shouldn't you be able to tell more metadata regarding... when things are completed, when things are not completed?"

What it does

  • acpmux task new SESSION "title" [--stop "done when"] [brief] (_acpmux/task_new): gives a session on this daemon a task. The task is a brief in the existing ledger (dispatch.rs, kind: "task") that records the giver's session id (fromSession). The lane gets the brief as the giver's message (the session_message chip), with the task id first and the one call that ends it.
  • acpmux task done|blocked|failed ID --summary "one line" [--pr URL]... [--sha SHA]... [--why …] extends _acpmux/report and does not duplicate it. hub/tasks.rs checks the result: the summary is one line of at most 300 characters; why is required unless the state is done; PRs are https URLs; SHAs are 7 to 40 hex digits. A bad result is refused with task.result_invalid. Only the task's own session or the chat that gave it can end it (task.not_yours). Sending the same call again is a replay (replayed: true) and gives one result and one card. The person on this machine (its socket) may also end a task; a Web or peer connection, which proves no session, may not. When someone other than the lane ends a task, the card says Ended by: NAME. The replay check runs under the ledger's lock, so two identical reports at once send one card. A card that can't be delivered (the giver is gone, or the prompt is refused) stays on the row as result.undelivered; task ls shows it, and the same call again sends it again.
  • The result goes back to the giver's chat once, as one prompt with the new provenance task_result {from, fromName, to, taskId, state}. The chat draws it as the lane's sender card, and the card opens the lane. No card is sent when the giver ended the task itself.
  • acpmux task ls [--from NAME | --all] [--open] (_acpmux/tasks): lists the tasks this chat gave, open ones first, with each lane's state now and each result's summary.
  • The gallery has a task-result variant (RemoteSender.gallery.ts).

blocked stays open, so the giver can end the task once it is unblocked. Not in this PR, each in its own later PR: tasks for a peer's session, liveness (a lane that closes with its task still open), urgency boxes, and the coordinator sweep.

Size

About 1,030 changed lines, over the ~800 guideline. About 400 of them are tests, the gallery variant, and the regenerated protocol spec and methods.ts; the code itself is about 615 lines. The brief handlers were moved out first, as their own PR (#24970), so server/requests.rs changes by only 7 lines here. Splitting the CLI from the RPC would land a task_new nobody can call.

Tests (huge-blue)

  • New and passing: tests/hub_integration/tasks.rs, with
    • a_task_brings_its_typed_result_back_to_the_chat_that_gave_it_once
    • a_blocked_task_says_why_and_a_task_is_given_only_to_a_session_here (also: Web and Peer are refused task.not_yours, red without the fix; and the person's own result says Ended by:)
    • two_reports_at_once_send_one_card_and_a_card_not_delivered_is_kept_and_sent_again (red on the earlier head: a refused sender name left a starting row)
  • Also passing: the hub::tasks unit tests and the webview test incomingMessage.test.ts ("a task's result is its lane's message, and opens the lane").
  • peer_integration 32/32. lib 719/720: the one failure, protocol_registry_names_every_served_method (_acpmux/unknown), is red on base as well. clippy, cargo fmt, vp fmt, typecheck and bun (33) are clean.
  • The protocol spec was blessed and regenerated (protocol_ir_is_current, acpmux-protocol:codegen).

Capture

No capture: the only visible change is that a task's result draws as the lane's existing sender card, unchanged, and that card opens the lane. Showing it in the app takes a live acpmux daemon with two chats, and the capture minis run with no agent backend (the agent-pane tour marks chat as optional). The gallery's new task-result variant (RemoteSender.gallery.ts) shows the card, and gallery visual evidence captures it. The real-chat end-to-end check is on Leo's machine once the nightly carries this.

Review

Codex xhigh via acpmux (session review-24939 on huge-blue): SHIP at 54a3db8814db0f64e06866dabddabec7b1734977, after four rounds. It found that a Web or peer connection could end a task (fixed: task.not_yours); that two reports at once could send two cards; that a refused sender name left a claimed row; that a card that failed to send was only logged; and that keyed retries of an undelivered card, and late send failures, misbehaved. Each of these has a test.

Agent session: big-red

šŸ¤– Generated with Claude Code