Repository navigation
Add trusted anchors for durable offline mailbox handoffs - #158
aakashH242 wants to merge 2 commits into
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Hey @larstalian, the PR for #139 is ready for review. Thanks for helping work through the design. I also wanted to ask about the hosted inbox limitation, as a separate follow-up. If mail reaches a hosted assistant through the laptop just before it goes offline, that mail stays on the laptop even if the next call goes through the VPS. Would it make sense to let the VPS be the only computer handling hosted-assistant calls, while the laptop continues running the network for local agents? The idea would be to keep hosted inboxes in one place, so switching computers doesn’t leave mail behind. Two questions before proposing any changes:
For this first follow-up, I’d be fine with hosted calls reporting that the VPS is unavailable when it’s down, rather than quietly starting a different inbox elsewhere. I’d keep this PR focused on the agreed permanent-mailbox handoffs. Happy to help with the hosted inbox follow-up separately if that approach fits. |
|
Thanks for this! We are reviewing it now (the full suite plus our own checks) and will come back here with findings. |
|
Thanks. Looking forward to your response. |
|
Sorry for the churn: main moved quite a bit in the last two days (v0.12.14 to v0.12.17, with changes in |
|
Thanks, and agreed on keeping this PR to the permanent-mailbox handoffs. Short answers: (1) yes; (2) no, there's no conversation id. The stable identity is the connection (and its 1. Only computers whose relay is checking in. Reason only sees a computer through its Two things matter for your plan:
2. No conversation id. Hosted apps don't send one, and the hosted MCP endpoint keeps no per-conversation state. Two things are stable:
What is tied to a computer is the engine-side session and its address:
That computer-bound handoff is the part a follow-up would need to cover. Happy to go through it with you separately, as you suggest. |
36fa049 to
8d1e45d
Compare
|
Hey @larstalian, I’ve rebased this PR for #139 onto current The conflict fixes keep the new delivery receipts and usage tracking, along with the anchor’s checks on which computer sent an acknowledgment. I added a regression test for acknowledgments from the wrong computer and repeated acknowledgments. I reran the checks on the rebased code:
Thanks for explaining the hosted inbox side. I had misunderstood where the inbox lives. I’ve corrected the README, DESIGN.md and PR description: Reason already holds the hosted inbox centrally; the remaining gap is mail waiting on a computer or its peers before it reaches Reason. I also understand there’s no conversation ID, and a managed laptop can’t currently keep its daemon running with the relay disabled. This PR stays focused on permanent-mailbox handoffs. Happy to work through the computer-bound hosted handoff separately. The hosted test here is only a local engine simulation; I haven’t tested the actual Reason hosted service. The CI run currently says |
This implements the same-person trusted anchor discussed in #139. A cloud workspace can hand a message and its existing small text attachments to the user's always-on VPS while the laptop is off. Once the anchor confirms durable storage, the sender can go away; the anchor keeps custody until the laptop saves the message.
What changes
anchor = true. It advertises throughPresence.featuresand remembers only permanent mailboxes (terminalandlisten --as), so a fresh workspace can discover an offline laptop without a registration command.listen --as terminalinbox, including after a terminal rename. Failed notice writes cannot undo revocation or make cancelled mail deliverable again.As agreed in the issue, the anchor is trusted and can read the stored mail. This does not add an encryption layer for an untrusted anchor. Larger artifacts, R2, and task allocation remain follow-ups. README and DESIGN.md describe setup, custody, and limits.
Validation
Built and tested on Linux, including an unmodified 0.12.17 binary for the mixed-version checks:
cargo fmt --checkcargo clippy --all-targets --locked -- -D warningscargo test --lockedtests/e2e/anchor.pytests/e2e/reconnect.pytests/e2e/two_machines.pyThe new e2e script uses disposable homes and test identities over real iroh connections. It covers fresh-workspace discovery, offline delivery with attachments, sender shutdown, anchor restart, lost acceptance and recipient acknowledgments, direct/forwarded deduplication, direct delivery first, capacity refusal and recovery, original-send expiry with CLI notice retrieval, unknown mailboxes, revocation learned from another machine, and mixed versions. Unit regressions also cover SQLite write failures, cancellation persistence, source/acknowledgment checks, renamed terminal inboxes, and current-connection capability gating.
The full Rust suite ran from a byte-identical copy on a Linux filesystem: the mounted checkout rejects its
targetdirectory, which affects two existing file tests. No tests were skipped or changed for that workaround. Local review logs and generated files are not included.Hosted handoff limitation
As clarified in Lars's reply, Reason already stores hosted inboxes centrally, keyed by the hosted connection and its
asname. There is no per-conversation ID. The remaining gap is mail that has not yet reached Reason: it can still be waiting on the computer carrying the session or in peers' outboxes for that computer.This PR covers permanent mailboxes. It does not transfer those computer-bound hosted-session queues when the carrier changes. The local daemon-facing simulation verifies that mail saved on the laptop is not silently migrated by registering an ordinary session on the VPS, and remains retrievable when the laptop returns. It does not exercise Reason's hosted inbox or actual
reason network __relayservice.Rebased onto current
main(bcf045c, v0.12.17), preserving upstream delivery receipts, idempotent sends, usage tracking, and native agent support. A new regression test verifies that peer-scoped acknowledgments preserve receipt states and count acceptance only once. README and DESIGN.md now describe the hosted handoff boundary above.macOS/Windows execution and physical power-loss testing were not run locally.
Closes #139.