oliver-zehentleitner / maity
cli: `maity wait` names attachments in its event line and prints the fetch command
tsk-hnw52rvtwdsv Done An agent
Why: agents miss images the owner attaches to chat messages. The first line maity wait prints for an event (_event_line in cli/src/maity/cli.py) is e.g. #108514 message: chat (owner); that the message carries a screenshot is only visible in the JSON below it (payload.attachments). maity messages already prints attachment … lines. Owner approved this fix on 2026-11-11 (seq 109092).
Scope (one small CLI PR):
_event_line: whenpayload.attachmentsis non-empty, append[N attachment(s): name1, name2](names cleaned like_attachment_line, capped in length).- Under that line, one line per attachment with the ready command:
maity files get <id> -o <file>. - cli/context/ (the wait/messages help an agent reads): one sentence that attachments are part of the message and must be opened before answering.
- Tests for the event line with zero, one and several attachments, and a hostile name (control characters, very long).
- changelog.d fragment.
No hub or contract change. If the event payload doesn't carry attachment names (only ids), print ids and say so in the PR body; don't add a hub call per event.
Notes
An agent · Nov 11, 2026, 07:47 UTC
Plan (unr9), branch claude/wait-attachments from main. Written before any code.
What the event already carries: a message event's
payload.attachmentsis attachment metadata (id,name,size,type, …; docs/api.md §8.7 and the events table), so names are printed without a hub call per event.Changes in cli/src/maity/cli.py:
_event_line: for an event with a non-emptypayload.attachmentslist, append[N attachment(s): name1, name2]before the standing suffix. Each name is cleaned asfiles getwould save it (file_name, thenonboarding.inline), each is cut to 60 characters, and the whole bracket to 200 with…. An entry with no usable name shows its id.- A new
_attachment_lines(event)that the wait loop prints under the event line (stderr, like the event line), one line per attachment:attachment <id> <name>: maity files get <id>. The id is shell-quoted. An attachment already taken out (deleted_at) says so and gives no command. stdout stays the JSON. wait's help: one sentence saying a message's attachments are part of it, the event line names them, and they are to be opened withmaity files getbefore answering.
One deviation from the card, on purpose: the printed command has no
-o <file>. Decision 3a8f1852 in cli/context/commands.md (the contract owner's ruling for §13, #216) sends a file without-ointo./maity-files/, never into the working directory. The sender picks the name, andconftest.py,sitecustomize.pyor aMakefilesaved in the working directory would be picked up by the next test run or build. Printing-o <sender's name>would undo that for anyone who copies the line. The bare command saves under the cleaned name in./maity-files/and prints where it went. If you want-oanyway, I'd print-o maity-files/<cleaned name>.Tests (cli/tests/test_wait_attachments.py):
- the event line with zero, one and several attachments;
- a hostile name (control characters, an escape sequence, a newline,
/, shell metacharacters, 500 characters); - an entry without a name, one without a usable id, a taken-out one;
- a non-message event left unchanged;
- the wait loop's stderr through its fake hub, if the existing tests have one.
Docs:
cli/context/commands.mdgets a Keep the Why entry (names in the line, the command without-oand why, the caps). The changelog getschangelog.d/wait-attachments.md(Changed,cli:). No hub or contract change.Checks: the CLI's tests, lint and types, the overlap check, then the PR via lotse and the review via vuur. Main is frozen for deploy 7, so it merges after that.
An agent · Nov 11, 2026, 11:51 UTC
#1641 merged as 6a00dc280 (head dd0ce649e). Both legs APPROVE (4hch, gb8w), Oliver approved the §13 row (req-vjkm45ekkjt9), ci-ok green with cli-windows 3.11 and 3.13.
Follow-ups for the next CLI pull request (lotse 110733), non-blocking:
- "ASCII letters" (gb8w): the FETCHABLE_ID comment in cli/src/maity/cli.py and KTW 9468d8cc say "letters"; the regex takes ASCII letters only (re.ASCII).
- The Windows skip reason (gb8w): "on the runners it wrote no calls file" says more than the log does; "no calls file appeared" matches it. Plus "windows" → "Windows" in the comment. Ready as commit 45e833d59 on unr9's local branch claude/wait-attachments-followups.