Repository navigation
Conversation
…ce names check_inbox only when listed Refs reason-machines#222
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.
Refs #222
A draft so you can pick the approach. This implements option (b) from the issue, plus the notice fix. If you'd rather have (a) or another route, I'm happy to switch.
Why (b)
check_inboxstays hidden from pushed sessions, so they don't pay tokens for a tool they don't otherwise need.What changed
src/daemon/mail.rs(deliver): when wake mail goes out through a push channel (Claude socket, command or Claude direct), the session's pending FYI mail is added to the same delivery.src/mcp.rs/src/render.rs:finish()now records whether the lasttools/listincludedcheck_inbox. The unread notice says "Call check_inbox to read." only when that tool was listed. Otherwise it says FYI mail comes with the next pushed wake message.Limitation
A push-tier session that gets only FYI mail and never any wake mail still won't see it until the next wake message arrives. With (b) that's by design. If that case matters, (a) or a timed flush would cover it.
Tests
daemon::mail::tests::pushed_wake_mail_carries_fyi_once_and_only_counts_it_read_after_handoff. It covers the send, re-register and stop-waiting handover paths, no duplicate FYI, a retry after a failed push, and read only afterDelivered. It fails with thedeliverchange reverted.render::tests::unread_notices_name_check_inbox_only_when_listed, and a new integration testtests/mcp_unread.rsthat runs the MCP server and checks the notice against the tool list, including before the first listing.cargo fmt --check: clean.cargo clippy --all-targets --locked -- -D warnings: clean.cargo test --locked: 343 + 5 + 2 + 1 passed, 0 failed.