M24: attention reasons and actions #38

Closed
opened 2026-10-02 04:07:04 +00:00 by jhgaylor · 3 comments
Owner

Depends on: #36 (classification only; the rest can start now)
Blocks: #40

Swarm track. Attention says what happened, not just "needs you", so the client can explain it, bundle it with others and act on it.


Today Attention is idle | working | needs_input | done, plus an Ask for question cards. Keep those states, and add a reason to every non-idle one.

  • Reasons:
    • ask: an open Ask (agent blocks, and Claude Code through its hook), with its headline;
    • failed: a command that ran longer than a few seconds ended with a non-zero exit (from shell integration's CommandEnd);
    • exited: a pane's program died with a non-zero code, mainly servers and Rerun/Hook policies (from Exit), or machine_gone;
    • input: the pane waits on a prompt. That covers bell and Notify, plus prompt detection for [sudo] password, [y/N] and (y/n), and "Enter passphrase", when output stops on that line;
    • done: a long command finished while nobody was looking (today's done), with its duration.
  • Each reason carries since_ms, a one-line headline, the command and exit code where there is one, and a bundle key:
    • failed and exited bundle by machine;
    • ask bundles by project and agent;
    • input never bundles.
  • Actions, with one route for them all (POST /api/attention/act) taking one pane or a list:
    • allow and deny: answer an ask (wrapping /api/panes/{id}/ask);
    • rerun: run the last command again (the "Run again" menu item);
    • restart: restart the pane's program under its policy;
    • send: type an answer (y, Enter), for input;
    • dismiss: today's PaneOp::Attention.
  • Everywhere:
    • illogical attention --json lists the reasons;
    • illogical events streams changes;
    • push notifications show the headline and offer the reason's actions;
    • dismissing on one client clears the reason on every other.
  • Done when:
    • a failing cargo test, a dying npm run dev, a sudo prompt, a Claude Code question and a 10-minute build each show the right reason and headline in illogical attention;
    • "rerun all" on three failed panes reruns all three;
    • the phone's push for a failure has a working Run again button.
**Depends on:** #36 (classification only; the rest can start now) **Blocks:** #40 *Swarm track. Attention says what happened, not just "needs you", so the client can explain it, bundle it with others and act on it.* -------- Today `Attention` is `idle | working | needs_input | done`, plus an `Ask` for question cards. Keep those states, and add a **reason** to every non-idle one. - **Reasons:** - `ask`: an open `Ask` (agent blocks, and Claude Code through its hook), with its headline; - `failed`: a command that ran longer than a few seconds ended with a non-zero exit (from shell integration's `CommandEnd`); - `exited`: a pane's program died with a non-zero code, mainly servers and `Rerun`/`Hook` policies (from `Exit`), or `machine_gone`; - `input`: the pane waits on a prompt. That covers bell and `Notify`, plus prompt detection for `[sudo] password`, `[y/N]` and `(y/n)`, and "Enter passphrase", when output stops on that line; - `done`: a long command finished while nobody was looking (today's `done`), with its duration. - **Each reason carries** `since_ms`, a one-line `headline`, the command and exit code where there is one, and a **bundle key**: - `failed` and `exited` bundle by machine; - `ask` bundles by project and agent; - `input` never bundles. - **Actions,** with one route for them all (`POST /api/attention/act`) taking one pane or a list: - `allow` and `deny`: answer an `ask` (wrapping `/api/panes/{id}/ask`); - `rerun`: run the last command again (the "Run again" menu item); - `restart`: restart the pane's program under its policy; - `send`: type an answer (`y`, Enter), for `input`; - `dismiss`: today's `PaneOp::Attention`. - **Everywhere:** - `illogical attention --json` lists the reasons; - `illogical events` streams changes; - push notifications show the headline and offer the reason's actions; - dismissing on one client clears the reason on every other. - **Done when:** - a failing `cargo test`, a dying `npm run dev`, a `sudo` prompt, a Claude Code question and a 10-minute build each show the right reason and headline in `illogical attention`; - "rerun all" on three failed panes reruns all three; - the phone's push for a failure has a working Run again button.
Author
Owner

Part of the Swarm MVP (#44). The MVP cut of this ticket is listed there; anything not on that list is after the MVP.

Part of the Swarm MVP (#44). The MVP cut of this ticket is listed there; anything not on that list is after the MVP.
Author
Owner

Done 2026-10-02, cut to the MVP (#44). Merged in 4e34244.

What landed:

  • Every needs_input and done pane carries a reason (PaneInfo.reason):
    • ask: Claude Code's question through its hook, or an agent block's question or permission request, worked out live from what's open;
    • failed: a command that ran 3 s or more ended non-zero (not Ctrl-C);
    • done: a command that ran 5 s or more finished while nobody was looking;
    • exited: the program died non-zero, or its machine went;
    • input: a bell or a notification (the Notification hook's message becomes the headline).
  • Each reason has since_ms, a headline, the command, exit and duration where there is one, a bundle key and its actions.
  • Bundle keys: failed:<machine>, exited:<machine>, ask:<project>:<agent>. done and input never bundle.
  • POST /api/attention/act takes one pane or a list: allow and deny for approvals, answer and deny for questions, and dismiss. Editor is checked on each pane, and each pane gets its own result.
  • GET /api/attention and illogical attention [--json] list the reasons. illogical events carries the reason on attention events.
  • Pushes are titled by kind, with the headline as the body and the reason's actions in the payload. A failure offers Dismiss.
  • The tab and pane badges say failed or done, with the headline as their title. Dismissing clears it on every client.

Tests:

  • crates/daemon/tests/attention.rs: a failing cargo test, a long build, Claude Code's question answered through act, three agent approvals allowed and denied as a list, the push's actions, and events.
  • web/e2e/attention.spec.ts: dismissing on one client clears it on the other, and a pushed failure offers Dismiss.

Not covered (after the MVP):

  • prompt detection for input ([sudo], [y/N]);
  • the rerun, restart and send actions;
  • the 10-minute build, tested as a 5 s one.

What's left: Claude Code's terminal permission prompts come with M29 (#46). The ask bundle's project switches to M23's when #37 merges.

**Done 2026-10-02, cut to the MVP (#44).** Merged in 4e34244. **What landed:** - Every needs_input and done pane carries a reason (`PaneInfo.reason`): - **ask:** Claude Code's question through its hook, or an agent block's question or permission request, worked out live from what's open; - **failed:** a command that ran 3 s or more ended non-zero (not Ctrl-C); - **done:** a command that ran 5 s or more finished while nobody was looking; - **exited:** the program died non-zero, or its machine went; - **input:** a bell or a notification (the Notification hook's message becomes the headline). - Each reason has `since_ms`, a headline, the command, exit and duration where there is one, a bundle key and its actions. - Bundle keys: `failed:<machine>`, `exited:<machine>`, `ask:<project>:<agent>`. done and input never bundle. - `POST /api/attention/act` takes one pane or a list: allow and deny for approvals, answer and deny for questions, and dismiss. Editor is checked on each pane, and each pane gets its own result. - `GET /api/attention` and `illogical attention [--json]` list the reasons. `illogical events` carries the reason on attention events. - Pushes are titled by kind, with the headline as the body and the reason's actions in the payload. A failure offers Dismiss. - The tab and pane badges say failed or done, with the headline as their title. Dismissing clears it on every client. **Tests:** - `crates/daemon/tests/attention.rs`: a failing cargo test, a long build, Claude Code's question answered through act, three agent approvals allowed and denied as a list, the push's actions, and events. - `web/e2e/attention.spec.ts`: dismissing on one client clears it on the other, and a pushed failure offers Dismiss. **Not covered (after the MVP):** - prompt detection for input (`[sudo]`, `[y/N]`); - the rerun, restart and send actions; - the 10-minute build, tested as a 5 s one. **What's left:** Claude Code's terminal permission prompts come with M29 (#46). The ask bundle's project switches to M23's when #37 merges.
Author
Owner

Done: merged to main in 4e34244 (Merge M24), cut to the swarm MVP scope (#44).

Done: merged to main in 4e34244 (Merge M24), cut to the swarm MVP scope (#44).
Commenting is not possible because the repository is archived.
No milestone
No project
No assignees
1 participant
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
jhgaylor/illogical#38
No description provided.