Repository navigation
feat(mcp): maild computes the conversations waiting on a reply - #83
Merged
Merged
Conversation
Plan 0012's Phase 3 (ADR-0042). thread.awaitingReply answers the threads waiting on the user: the newest message, past drafts and what is only in Drafts, Trash or Junk, is from someone else to one of its account's identities in To, from no list or no-reply sender, not answered, muted or blocked, and in an inbox. thread.awaitingOthers answers the user's own mail with no reply since. Both put VIPs first, then the newest, take a window of days, and keep an agent to its scope. store.NewestMessages finds each thread's newest eligible message in one query over the window. mailctl waiting prints both. /mcp/mail gains threads_awaiting_reply and threads_awaiting_others, with time_zone for their dates. A test per rule and boundary, a Gmail INBOX label among them; the tools and their limits through kittest and the SDK client. On 50,000 mailgen messages each method answers in p95 under 70 ms at 90 days. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This was referenced Oct 19, 2026
1 task done
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.
Plan 0012's Phase 3 (M8.5, ADR-0042). maild, not the model, picks the conversations waiting on a reply.
This PR is based on #82 and contains its commit (18795a6), so merge #82 first. This PR's own commit is 33e3e87.
What changes
thread.awaitingReply(callers local, session and agent): conversations waiting on the user. The newest message decides, leaving out drafts and messages only in Drafts, Trash or Junk. That message must:List-Idand noList-Unsubscribe, and not come from a no-reply local part (noreply,no-reply,donotreply,do-not-reply,mailer-daemonorpostmaster, compared without case);\Answered, muted or from a blocked sender;INBOXlabel counts);waitingDaysand less thanwithinDaysdays before now.The limits:
limit: 1 to 25, default 5;waitingDays: 0 to 30, default 0;withinDays: 1 to 90, default 30.thread.awaitingOthers: the user's own newest message, to someone who isn't any account's identity, not muted, in the same window.limitdefaults to 10 andwaitingDaysto 5.Both:
totalbeforelimit, with up to 10 recipients and their count;Also:
store.NewestMessagesfinds each thread's newest eligible message in one window-bounded query;mailctl waiting [--others];threads_awaiting_replyandthreads_awaiting_others, each takingtime_zonefor its dates;Tests
internal/engine/awaiting_test.go:waitingDaysis kept;INBOXlabel versus All Mail only;totalagainstlimit, and 10 versus 11 recipients;internal/lodge/mcp_waiting_test.go: both tools throughkittestand the SDK client, Berlin dates, and every limit at and past its value.cmd/mailctl/waiting_test.go.Timing
On
tools/uifixture -n 50000 -seed 7(Strix Halo), 20 runs after one warm-up,limit25,waitingDays0:withinDaysawaitingReplyp95 (matches)awaitingOthersp95Two notes on the fixture:
awaitingOthers, but it scans the same window.[email protected], so the fixture account was given that identity.Gates
make check,make build-windowsandmake ui-check(nsl) pass. The app's only change is in generated types.🤖 Generated with Claude Code