docs+tui: reachability stance (no sealed mailbox) and peer-unreachable queued footer #99

Merged
sirius merged 1 commit from wt/t_d662c8a6 into main 2026-09-18 01:02:26 +00:00
4 changed files with 79 additions and 14 deletions
Showing only changes of commit dff37fe00e - Show all commits

docs+tui: reachability stance (no sealed mailbox) and peer-unreachable queued footer
Some checks failed
ci / test (pull_request) Has been cancelled
ci / sdk (pull_request) Has been cancelled
android-ci / android (pull_request) Has been cancelled

Add a Reachability section to docs/THREAT_MODEL.md: no sealed mailbox or
server-side message store, the chat outbox is local-device retry only, and
there is no mutual-online indicator — a send is a one-shot Noise IK session
and an unanswered dial queues locally with the retry clock shown.

OutboxSummary now carries the outstanding row's attempt count and soonest
retry, so the footer reads 'peer unreachable, queued (n/8, retry 45s)'
instead of a bare 'n queued'. Tests updated to the real outbox wording; the
Android KDoc note stops claiming the footer copy is mirrored (Android shows
per-row 'queued (try n/8, retry …)' via OutboxDetail).
agent 2026-09-17 20:44:28 -04:00
No known key found for this signature in database

View file

@ -130,8 +130,13 @@ fun parseDelivery(direction: String, delivery: String?): Delivery? {
/**
* Chat-level delivery summary derived from the rendered rows.
*
* Mirrors `src/tui.rs::OutboxSummary`: `Queued` + `Sending` are "still coming",
* `Failed` is terminal and keeps a fail-closed statement on screen.
* The *counting* rule mirrors `src/tui.rs::OutboxSummary`: `Queued` + `Sending`
* are "still coming", `Failed` is terminal and keeps a fail-closed statement on
* screen. The TUI's footer wording for an outstanding row also carries the
* reachability statement and retry clock (`peer unreachable, queued (n/8, retry
* 45s)`); on Android that per-row detail already lives in the row's own
* `queued (try n/8, retry …)` marker (`OutboxDetail.kt`), so the summary stays
* the short count form instead of repeating it.
*/
data class OutboxSummary(
val queued: Int = 0,

View file

@ -66,6 +66,16 @@ A chat send to an unreachable onion is written to an `outbox` row next to its `m
The queue is bounded in scope: chat only. File transfer and `rcp` frames are one-shot, so a failed payment claim does not sit in the store being retried forever.
## Reachability: there is no sealed mailbox, and no mutual-online indicator
**No sealed mailbox.** OnionWire does not implement a server-side message store, a sealed mailbox, or any store-and-forward drop. There is no address a peer can write a message to when you are offline, and nothing that holds a message on your behalf after your device is gone. A mailbox of that kind needs a persistent process that accepts and later replays ciphertext for an absent recipient — exactly the hosted store-and-forward server this threat model rules out (“Tor relays are not a chat server”, “Out of v1”). A sealed box whose key never leaves the user's device is still a server holding the traffic pattern and the ciphertext, and it is still a third party that can be compelled, logged, or silently serve a stale box. That is the design decision, and it is not planned as a follow-up.
**The chat outbox is local-device retry only.** A message to an unreachable peer is written to the local `outbox` row and re-dialed from this device. It dies with the device: no relay, no friend, no other install ever holds it. Nothing in the outbox is a delivery guarantee.
**No mutual-online indicator.** OnionWire has no presence, no "peer is online" dot, and no shared online state. Every send is a one-shot Noise IK session to the peer's onion and is closed after one application frame; the peer's availability is only learned from whether *this* dial succeeded. A roster row we have not reached is marked `stale` (from the last connect attempt, `last_connect_ok`) and the footer states the consequence instead of implying presence: `peer unreachable, queued (n/8, retry …)` while an outbox row is outstanding. "They are offline right now" and "they have never been online since my last attempt" are indistinguishable to OnionWire, and the UI does not pretend otherwise.
**What this costs, stated plainly.** Two devices that are never online at the same time cannot talk, and there is no queue that changes that — the sender's own device is the only queue. Anyone who needs offline delivery must run their own always-on OnionWire install (their own identity, their own onion) to hold the messages, which is a hosted server *they* own and operate, not a service OnionWire provides.
## Chat is ratcheted on top of the one-shot Noise session
The Noise IK session is still the transport: handshake, **one** application
@ -234,7 +244,8 @@ the peer already knows the plaintext they sent.
## Out of v1
Prosody, XMPP, s2s, MAM, carbons, a **server-side** outbox / store-and-forward
relay, multi-device, DHT / name server, A/V. The local retry queue of the
previous section is not an outbox in the XMPP sense: it never leaves the device.
Prosody, XMPP, s2s, MAM, carbons, a **sealed mailbox**, a **server-side**
outbox / store-and-forward relay, multi-device, DHT / name server, A/V. The
local retry queue of the previous section is not an outbox in the XMPP sense: it
never leaves the device, and it is not a mailbox either — see “Reachability”.

View file

@ -204,11 +204,22 @@ pub struct OutboxSummary {
pub failed: usize,
/// First terminal failure, for the fail-closed footer copy.
pub first_error: Option<String>,
/// Highest attempt count across outstanding rows (0 when nothing is
/// outstanding). With `DEFAULT_MAX_ATTEMPTS` this is the `n` in `(n/8)`.
pub attempts: u32,
/// Seconds until the earliest scheduled retry, relative to the render
/// `now`. `None` while nothing is outstanding.
pub next_in_secs: Option<i64>,
}
impl OutboxSummary {
/// Footer note, or `None` when nothing is outstanding. Any terminal failure
/// keeps a `send failed` statement so the fail-closed copy stays visible.
///
/// An outstanding row is a reachability statement, not just a count: the
/// peer's onion did not answer *this* dial, so the note names that and the
/// retry it is waiting on (`peer unreachable, queued (n/8, retry 45s)`).
/// There is no mutual-online indicator to fall back on.
pub fn note(&self) -> Option<String> {
let reason = || {
short_send_reason(
@ -216,12 +227,19 @@ impl OutboxSummary {
FAIL_REASON_BUDGET,
)
};
let queued = || {
format!(
"peer unreachable, queued ({}/{DEFAULT_MAX_ATTEMPTS}, {})",
self.attempts,
retry_in_text(self.next_in_secs.unwrap_or(0))
)
};
match (self.queued, self.failed) {
(0, 0) => None,
(queued, 0) => Some(format!("{queued} queued")),
(0, 1) => Some(format!("send failed: {}", reason())),
(0, failed) => Some(format!("send failed: {} ({failed} failed)", reason())),
(queued, _) => Some(format!("{queued} queued, send failed: {}", reason())),
(_, 0) => Some(queued()),
(_, _) => Some(format!("{}, send failed: {}", queued(), reason())),
}
}
}
@ -244,7 +262,17 @@ pub fn chat_with_delivery(
summary.failed += 1;
summary.first_error.get_or_insert_with(|| why.clone());
}
_ => summary.queued += 1,
_ => {
summary.queued += 1;
// The note is the reachability statement for the selected
// friend: highest attempt count, soonest scheduled retry.
summary.attempts = summary.attempts.max(entry.attempts);
let secs = entry.next_attempt_at - now;
summary.next_in_secs = Some(match summary.next_in_secs {
Some(prev) => prev.min(secs),
None => secs,
});
}
}
}
if msgs.is_empty() {

View file

@ -531,7 +531,10 @@ fn identical_bodies_join_by_message_id_not_body() {
"delivered row (id 8) must keep its mark: {:?}",
lines[1]
);
assert_eq!(summary.note().as_deref(), Some("1 queued"));
assert_eq!(
summary.note().as_deref(),
Some("peer unreachable, queued (1/8, retry 30s)")
);
}
#[test]
@ -621,13 +624,19 @@ fn footer_summary_counts_queued_and_keeps_fail_closed() {
queued: 2,
failed: 0,
first_error: None,
attempts: 3,
next_in_secs: Some(45),
};
assert_eq!(queued.note().as_deref(), Some("2 queued"));
assert_eq!(
queued.note().as_deref(),
Some("peer unreachable, queued (3/8, retry 45s)")
);
let failed = OutboxSummary {
queued: 0,
failed: 1,
first_error: Some("connect peer.onion:80: connection timed out".into()),
..OutboxSummary::default()
};
let note = failed.note().expect("failed rows must produce a note");
assert!(note.starts_with("send failed:"), "{note:?}");
@ -637,9 +646,15 @@ fn footer_summary_counts_queued_and_keeps_fail_closed() {
queued: 3,
failed: 1,
first_error: Some("connect peer.onion:80: connection timed out".into()),
attempts: 2,
next_in_secs: Some(60),
};
let mixed_note = mixed.note().expect("mixed rows must produce a note");
assert!(mixed_note.contains("3 queued"), "{mixed_note:?}");
assert!(
mixed_note.contains("queued (2/8, retry 1m)"),
"{mixed_note:?}"
);
assert!(mixed_note.starts_with("peer unreachable"), "{mixed_note:?}");
assert!(mixed_note.contains("send failed"), "{mixed_note:?}");
// Fail-closed copy stays visible in the real footer at the 80-col floor.
@ -653,7 +668,10 @@ fn footer_summary_counts_queued_and_keeps_fail_closed() {
assert!(line.contains("TOR") && line.contains("? help"), "{line:?}");
let queued_line = status_footer(80, FP, ONION, queued.note().as_deref(), main_footer_hints());
assert!(queued_line.contains("2 queued"), "{queued_line:?}");
assert!(
queued_line.contains("queued (3/8, retry 45s)"),
"{queued_line:?}"
);
assert!(queued_line.chars().count() <= 80);
// `! ` ornament (colour off) still lands on the derived failing note.
@ -731,7 +749,7 @@ fn chat_and_footer_rows_fit_80x24_and_wrap_instead_of_clipping() {
"long row was clipped, not wrapped:\n{screen}"
);
assert!(
screen.contains("1 queued"),
screen.contains("peer unreachable, queued (3/8, retry 45s)"),
"footer summary missing:\n{screen}"
);
println!("===== AFTER outbox 80x24 (real draw_chat + status_footer) =====\n{screen}");
@ -789,7 +807,10 @@ async fn renders_a_queued_row_from_a_real_outbox_send() {
"real outbox row did not render: {:?}",
lines[0]
);
assert_eq!(summary.note().as_deref(), Some("1 queued"));
assert_eq!(
summary.note().as_deref(),
Some("peer unreachable, queued (1/8, retry 45s)")
);
// And once a send crosses the circuit the row is gone, so the same message
// renders as delivered.