Repository navigation
Description
Stage 2 of the Tower-to-Tower messaging design: an agent on one of my Towers sends to an agent on another of my Towers, both behind NAT, through Codev Cloud.
Design: the approved spec for issue #1940, codev/specs/1940-tower-to-tower-messaging-proto.md (on main once PR #1957 merges). It designs all three stages; this issue builds stage 2. Read Decisions 2, 5, 6, 7 and 9, the stage 2 walkthrough, and the "What Codev Cloud must change" section before planning.
Already in place (stage 1, PR #1957): the address grammar and one shared parser (afx:// addresses parse today and are refused with a clear message), <workspace>:architect:<name> on one Tower, the builder rule, workspace names, afx workspace list and afx whoami, the qualified sender header and reply line.
Depends on:
- issue Tower persists the typed tower name instead of the cloud's canonical slug; add rename, deregistration and name-takeover handling (Tower half of codev-cloud#17) #1871 (Tower persists and displays the cloud's canonical slug);
- Codev Cloud changes listed in the spec: Tower slugs unique per account, the relay with an attested statement of the sending Tower, flood limits.
Narrows: issue #655 (cloud messaging) to whatever this does not cover.
Acceptance criteria (inherited from the spec as written)
- The headline path works between two Towers on one account, both behind NAT. The stage 2
walkthrough can be followed as written: the same commands, in that order, with those results. - With remote messaging off, a Tower refuses an
afx://send to another Tower before anything
leaves the machine, and says how a human turns it on. - A Tower's name is unique within its owner's account only. The name I give a Tower is not
affected by what any other account has registered, and an address for one of my own Towers
never contains an owner. - A Tower accepts no remote message until its owner has granted a peer. A fresh install, and an
upgraded one, refuse everything. - The sender is told
delivered,heldwith where and why, orrefusedwith the reason. A
refusal exits non-zero and leaves nothing on the receiving Tower. - A message for a Tower that is offline, or sent while the cloud is unreachable, is held on the
sending Tower, visible inafx inbox, and is accepted exactly once when the route returns,
provided that is within the message's 30-day lifetime. After that it is shown as expired. - Mail held on the sending Tower is a distinct kind of held mail: the local delivery drainer
never tries to type it into a terminal, it never raises the starved-agent escalation, and
afx inboxand the held-mail indicator show it apart from mail waiting for a local agent. - Messages from one Tower to one recipient are delivered in the order they were sent,
including when the peer is online and several agents send at once: the sending Tower makes
one relay call at a time for each peer. - The recipient's header marks the message as remote and names the sending Tower and the
sender's full address; the reply command in it works. - The sending Tower's identity shown to the recipient comes from Codev Cloud's authentication
of that Tower, carried in the attested statement. No field of the message can change it. - A relayed request is accepted only with a statement whose MAC verifies under the current
tunnel session's secret. A request from this machine that holds the local key, a request
through Codev Cloud's/t/browser proxy with any headers, a replayed statement, and one
from an earlier tunnel session are each refused, and nothing is stored. - A send to a peer that does not speak the protocol, or through a cloud without the relay, is
refused with that reason and not held. -
--raw,--interruptand--no-enterare refused for a remote recipient, and control
characters in a remote body never reach a terminal. - From one Tower I can list my other Towers, and for one I have been granted, its workspaces and
agents. - Removing a grant refuses further mail from that peer immediately, and stops automatic
delivery of mail from it that was accepted but not yet delivered. - Flooding is bounded at the cloud and again at the receiving Tower.
- Both Towers keep a record of every cross-Tower attempt and its outcome, without bodies in
logs.
Activity
[Spec 1940] Review round 1: a builder may write its own workspace bef…