Skip to content

feat: ack — clear mail you already read (#160) - #171

Merged
yonidavidson merged 1 commit into
mainfrom
feat/160-ack
Aug 9, 2026
Merged

feat: ack — clear mail you already read (#160)#171
yonidavidson merged 1 commit into
mainfrom
feat/160-ack

Conversation

@yonidavidson

Copy link
Copy Markdown
Owner

Closes #160. (Supersedes #166, which GitHub auto-closed when its base branch was merged and deleted; same commit, rebased onto main.)

peek works but does not clear; inbox clears but was the operation that hung and lost mail. With no third option, an agent that read its mail the only way that worked could never mark it read: the unread count stayed at 5, the stop guard blocked every turn demanding the messages be read, and each turn was spent explaining that they had been.

What changed

  • src/bus.tsack(recipient, ids | 'all'). Message ids live in the inbox keys, so acking archives without re-fetching a single body. Returns {acked, unknown, failed}.
  • src/cli.tsagentcomm ack <id…> / ack --all, --json included. Exit 1 when an id is not pending for you (already acked, or addressed to another alias) — quietly succeeding there is how mail gets lost track of. peek now ends with the line that clears what you handled.
  • src/hook-run.ts — the stop guard names ack --all as the way out, since that guard is what the stuck count was blocking on.
  • The guidance file written into repos teaches peek → act → ack as the non-destructive path.

Tests

test/bus.test.ts: ack by id, --all, unknown ids reported, cross-mailbox ack refused. test/cli.e2e.test.ts: the full peek → ack → empty flow through the CLI, including exit codes and the bare-ack usage error.

`peek` shows messages without consuming; `inbox` consumes what it shows.
With only those two there was no way to mark mail read that arrived any
other way, so an agent that had read all five messages via `peek` and
replied to every one still showed five unread — and the stop guard blocked
every turn for fifteen turns demanding it read them.

`agentcomm ack <id…>` / `ack --all` archives pending messages by id. It
works off the KEYS (the id is in the key), so nothing is re-fetched, and
ids that are not pending for you are reported with a non-zero exit instead
of passing silently — acking someone else's mail is not a quiet no-op.

`peek` now closes with the one-liner that clears what you handled, the
stop guard says the same thing, and the guidance file teaches peek+ack as
the non-destructive read path.
@yonidavidson
yonidavidson merged commit a504874 into main Aug 9, 2026
2 checks passed
@yonidavidson
yonidavidson deleted the feat/160-ack branch August 9, 2026 08:11
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.

No way to clear mail you have already read — peek cannot ack, so the unread count never drops

1 participant