feat: ack — clear mail you already read (#160) - #171
Merged
Conversation
`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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #160. (Supersedes #166, which GitHub auto-closed when its base branch was merged and deleted; same commit, rebased onto
main.)peekworks but does not clear;inboxclears 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.ts—ack(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.ts—agentcomm ack <id…>/ack --all,--jsonincluded. 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.peeknow ends with the line that clears what you handled.src/hook-run.ts— the stop guard namesack --allas the way out, since that guard is what the stuck count was blocking on.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-ackusage error.