Repository navigation
docs(j5): define cross-server peering for A2A - #172
Conversation
cb1eff0 to
d7438d0
Compare
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository: Jacksondr5/j5code/.coderabbit.yaml Review profile: CHILL Plan: Essentials Run ID: 📥 CommitsReviewing files that changed from the base of the PR and between 8f56083 and d7438d0d2ad63042b00a7dcde8b0019d73d67479. 📒 Files selected for processing (5)
Included review availability: 4 reviews are currently available. Your included PR review attempts over the past 7 days set your current allowance at 5 reviews per hour. 📝 WalkthroughWalkthroughThe documentation defines direct, mutual server peering and cross-server delivery. It also updates A2A requirements for listing and messaging peer-hosted participants. ChangesCross-server peering
Priority: ➖ Normal Estimated code review effort: 3 (Moderate) | ~20 minutes Change: Other Suggested reviewers: Merge Risk: 🔵 Low · up to In the event that peer servers expose the same participant ID, the documented ID-only messaging flow cannot reach that participant. This is a bounded design risk, with no current runtime change; clarify recipient identity before relying on the contract in implementation. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
bryantderosier
left a comment
There was a problem hiding this comment.
The spec reads well, and the implementation stack keeps to its rulings: a peer participant has the same id and no server field, a peer is a revocable session in Connections, people stay server-local, and there's no relay or tunnel. The gaps I found are where the text promises more than the implementation does, plus one vocabulary clash.
Should fix
- "Peer" now means two things. The glossary defines a peer as another server, but
a2a/index.mdstill uses "peer" for another agent: the one-open-Exchange rule, the queueing policy, the silence kinds, the envelope section, AC13, and the "A busy receiver" and "A failed delivery" scenarios. The envelope channel is also namedpeer/peerMessage. This PR puts both senses on one page. (inline onglossary.md) - The delivery sentence saying "the receipt, retry and alarm facts are the same" across servers doesn't match the implementation. The origin records delivered as soon as the peer accepts, and a failure injecting into the receiver's thread only alarms on the receiver's side. (inline on
a2a/index.mdand AC18 incross-device.md) - The "home server is asleep" scenario promises a recorded send that retries and then alarms. The implementation only does that for an agent this server has already exchanged with; a first send to an unreadable peer is refused. (inline on
cross-device.md) - No criterion covers a peer credential expiring. The session lasts 30 days, and then peering stops with nothing visible. (inline on AC13 in
cross-device.md)
Nits
- AC20 says a withdrawal closes "exactly as a local one would", but the implementation sends a withdrawal notice that starts a turn on the answerer. (inline)
- AC12 "in one act": introduction stops at the first failure and doesn't roll back. (inline)
- The new
agent-tools.mdHistory line cites AC17, but the criterion it adds is AC21, and the 2026-09-16 entry comes after the 2026-09-17 one. (inline) - It would help to say that
list_participantsreads every peer's roster live, so an unreachable peer adds up to its timeout to the call. (inline on AC17)
| | Term | Gloss | Owner | | ||
| | ---------------------- | -------------------------------------------------------------------------------------------------- | ------------------------------------------------------------ | | ||
| | fleet | All of a user's agents across every connected server — the totality, never a sub-grouping | [cross-device.md](cross-device.md) | | ||
| | peer | Another server this server exchanges agent messages with, by mutual record | [cross-device.md](cross-device.md) | |
There was a problem hiding this comment.
This makes "peer" mean another server, but a2a/index.md still uses "peer" for another agent (the one-open-Exchange rule, the queueing policy, AC13, and the "A busy receiver" and "A failed delivery" scenarios), and the envelope channel is peer/peerMessage. This PR already mixes the two senses on one page: "a participant's Squadron may live on a peer server" sits a few paragraphs from "asks a peer that has been archived". I'd make the term "peer server" here and in cross-device.md, or rename the agent sense, so a reader never has to guess which one is meant.
There was a problem hiding this comment.
Done in b46582161e: "peer server" is the term for another server in the glossary and cross-device.md, leaving "peer" to mean another agent as a2a/index.md uses it.
|
|
||
| ## Delivery | ||
|
|
||
| Delivery is **log-first**: the ledger row is the act, and delivery is an attempt recorded against it. A successful attempt is a **delivery receipt**; a failed one is retried; a failure past the retry limit is a **delivery alarm** — a visible fact attributed to the sender, never a silent loss, and never assumed repaired because time passed or a later message got through. "Was it delivered" and "was it answered" are independent facts. | ||
| Delivery is **log-first**: the ledger row is the act, and delivery is an attempt recorded against it. A successful attempt is a **delivery receipt**; a failed one is retried; a failure past the retry limit is a **delivery alarm** — a visible fact attributed to the sender, never a silent loss, and never assumed repaired because time passed or a later message got through. "Was it delivered" and "was it answered" are independent facts. When the receiver's Squadron lives on a peer server, the attempt crosses to that server, which records its own received row before delivering; the receipt, retry and alarm facts are the same. |
There was a problem hiding this comment.
"The receipt, retry and alarm facts are the same" isn't what the implementation does. The origin records delivered once the peer accepts the message, and if injecting into the receiver's thread then fails, the alarm only shows on the receiver's server, not on the sender. Either the peer sends that alarm back to the origin, or this sentence should say that across servers the receipt means the peer accepted the message.
There was a problem hiding this comment.
Done in b46582161e: the Delivery paragraph now says that across peer servers the receipt means the peer server accepted the message, and that delivery to the thread is the peer server's to retry and alarm on. Carrying that alarm back is tracked in #260.
| 15. A peer is recorded only after the recording server has reached the peer at the stated origin; an unreachable origin is refused with the reason, never recorded. | ||
| 16. An agent addresses a participant homed on a peer by the same participant id it would use locally; no agent verb takes, returns or reveals a server, and the envelope names the sender and its Squadron exactly as for a local send. | ||
| 17. The address book lists participants homed on peers beside local ones with their Squadron; a peer that cannot be read is reported as unread in the listing, never omitted silently. | ||
| 18. A message to a participant on a peer is recorded in the sender's Squadron ledger before the call returns; the peer records its own received row before delivering to the agent's thread; the peer's acknowledgement is the sender's delivery receipt; failure to reach the peer retries and alarms as any delivery does. |
There was a problem hiding this comment.
Same gap as the Delivery sentence in a2a/index.md: here the receipt is the peer's acknowledgement, which the implementation sends on acceptance, before the receiver's thread is injected. A later injection failure alarms only on the peer. I'd either require that alarm to travel back to the sender, or say plainly that the receipt means "the peer accepted it" and that delivery to the thread is the peer's to alarm on.
There was a problem hiding this comment.
Done in b46582161e: AC18 says the peer server's acknowledgement is the receipt and that a later injection failure alarms on the peer server. #260 tracks routing that alarm back.
| - **A Mac-only job.** An agent that must run on a Mac gets its own Squadron homed on the Mac server; it is asked for results by a Squadron elsewhere through a cross-server Exchange, once peering exists. (AC1, AC6) | ||
| - **Peering two servers.** The user opens Settings → Connections on their laptop, connected to the work server and the home server, and peers them. Each server confirms it can reach the other at the origin the user confirmed; each lists the other as an authorized session. Revoking either session later ends the peering. (AC11–AC15) | ||
| - **A Mac-only job.** An agent that must run on a Mac gets its own Squadron homed on the Mac server. An agent in Billing Migration, on the work server, asks it for results by participant id, as it would ask any peer; the ask is recorded in Billing Migration's ledger, the Mac server records its received row and delivers it, and the reply travels back and closes the Exchange. Neither agent named a server. (AC1, AC6, AC16, AC18, AC20) | ||
| - **The home server is asleep.** An agent on the work server asks an agent homed on the home server. The send is recorded, delivery retries and then alarms on the asker, and the work server's address book reports the home server as unread rather than showing nobody there. (AC17, AC18) |
There was a problem hiding this comment.
The implementation doesn't do this for a first contact. A send to an agent on an unreadable peer is only recorded and retried if this server has already exchanged with that agent; otherwise it can't be resolved and is refused. That fits the no-persistent-cache ruling in the worklog, so I'd narrow this scenario and AC18 to participants the server has already seen, and say that a first send to an unreachable peer is refused with the reason.
There was a problem hiding this comment.
Done in b46582161e: AC18 and the asleep-server scenario are narrowed to participants this server has already exchanged messages with, and a first send to a peer server that cannot be read is refused with the reason.
|
|
||
| 11. A server delivers to, and accepts deliveries from, only the servers in its peer registry; a peer record names the peer's environment id, the origin this server reaches it at, and the credential the peer issued. | ||
| 12. Peering is mutual: peering two environments records each as the other's peer in one act, and removing either side ends delivery in both directions. | ||
| 13. A peer's credential is an ordinary session of the issuing server, bound to the peer's environment identity and to a scope that permits only accepting deliveries and reading the address book; it appears in Settings → Connections, and revoking it there ends the peering. |
There was a problem hiding this comment.
This covers revocation but not expiry. The implementation issues the peer a 30-day session, and when it lapses peering just stops with nothing shown to anyone. I'd add what happens when a peer's session expires or is revoked: deliveries alarm with that reason, and the address book reports the peer as unread (per AC17), never omits it.
There was a problem hiding this comment.
Done in b46582161e: AC13 now covers expiry and revocation: deliveries alarm with that reason and the address book reports the peer server as unread. #173 also makes peer sessions long-lived and shows the expiry in the record.
| 17. The address book lists participants homed on peers beside local ones with their Squadron; a peer that cannot be read is reported as unread in the listing, never omitted silently. | ||
| 18. A message to a participant on a peer is recorded in the sender's Squadron ledger before the call returns; the peer records its own received row before delivering to the agent's thread; the peer's acknowledgement is the sender's delivery receipt; failure to reach the peer retries and alarms as any delivery does. | ||
| 19. Retrying one message to a peer never yields a second received row or a second delivery. | ||
| 20. A reply, silence notice or lifecycle closure for an Exchange across peers travels the peer path back to the origin server and closes or notifies the origin Exchange exactly as a local one would. |
There was a problem hiding this comment.
"Exactly as a local one would" doesn't match the withdrawal path: the implementation sends a withdrawal notice across that starts a turn on the answerer, which a local withdrawal doesn't do. Either that's intended and this criterion should name it, or the notice shouldn't wake the answerer. Worth settling which.
There was a problem hiding this comment.
Settled in #176 (c7529d6fa5): a withdrawal closes the answerer's Exchange without injecting anything into its thread, locally and across servers. AC20 says so.
| ### Peering | ||
|
|
||
| 11. A server delivers to, and accepts deliveries from, only the servers in its peer registry; a peer record names the peer's environment id, the origin this server reaches it at, and the credential the peer issued. | ||
| 12. Peering is mutual: peering two environments records each as the other's peer in one act, and removing either side ends delivery in both directions. |
There was a problem hiding this comment.
"In one act" reads as atomic, but introduction stops at the first failure and doesn't roll back, so one side can end up recorded without the other. Either require rollback, or note that a partial introduction leaves a one-sided record that a retry or removal clears.
There was a problem hiding this comment.
Done in b46582161e: AC12 states what a failed introduction leaves (one-sided records and issued credentials) and that a retry or removal clears it.
| @@ -369,3 +370,4 @@ stopping retires nothing. | |||
| - 2026-09-14 — `delegate_task`, `task_status`, and `task_cancel` return to the J5 surface, with a saved-agent `agent` parameter on `delegate_task` replacing the J5-only `invoke_agent` ([review](https://github.com/Jacksondr5/j5code/pull/124#issuecomment-5663559782)). | |||
| - 2026-09-15 — machine participants appear in `list_participants` as named senders that receive nothing (issue #74). | |||
| - 2026-09-17 — personas, not agents: `list_agents` becomes `list_personas`, the `agent` parameter on `spawn_agent`, `delegate_task`, and crew seats becomes `persona` (no alias: pre-dogfood, no legacy-compatibility code), crew results carry `persona_id`, and the mention is `@persona:ID`; "agent" keeps meaning a running participant (Bryant; [record](../../worklog/2026-09-16-crew-command-decoupling.md)). | |||
| - 2026-09-16 — participants homed on peer servers appear in the address book and are addressed like local ones; AC17 ([record](../../worklog/2026-09-16-cross-server-peering-session.md)). | |||
There was a problem hiding this comment.
This cites AC17, but the criterion this PR adds to this file is AC21. The entry is also dated 2026-09-16 and sits after the 2026-09-17 one; I'd move it up so the History stays in date order.
There was a problem hiding this comment.
Done in b46582161e: the entry cites AC21 and sits in date order.
| 14. Peering is done from a client connected to both environments with administrative scope; the person confirms the origin each server will use, which may differ from the one the client uses. | ||
| 15. A peer is recorded only after the recording server has reached the peer at the stated origin; an unreachable origin is refused with the reason, never recorded. | ||
| 16. An agent addresses a participant homed on a peer by the same participant id it would use locally; no agent verb takes, returns or reveals a server, and the envelope names the sender and its Squadron exactly as for a local send. | ||
| 17. The address book lists participants homed on peers beside local ones with their Squadron; a peer that cannot be read is reported as unread in the listing, never omitted silently. |
There was a problem hiding this comment.
It's worth a sentence saying the address book reads every peer's roster live on each call, so an unreachable peer adds up to its timeout to list_participants. That cost follows from the no-cache ruling, and an agent calling this in a loop should know about it.
There was a problem hiding this comment.
Done in b46582161e: AC17 states the live roster read and that an unreachable peer server costs the call its timeout.
The cross-device definition deferred server-to-server Exchanges to a future "peer registry" without saying what one is, how servers learn about each other, or what agents would see. The trigger it waited for has arrived: a remote development server is in daily use. Defines peering in cross-device.md: mutual peer records that the client introduces, ordinary auth sessions on the receiving side visible in Settings → Connections, Squadron-resolved routing that agents never see, people server-local, no relay or tunnel. AC6 becomes a criterion rather than a deferral; AC11–AC22 and three scenarios cover the behavior. The A2A definition, agent tools and glossary gain one-line pointers, and a session record carries the investigation findings and the build outline. Built by Claude Fable 5.1 in Claude Code. Co-Authored-By: Claude Fable 5.1 <[email protected]>
Review of #172 (bryantderosier). "Peer" meant both another server and another agent on one page; the receipt across servers was described as the same fact as a local one when it means the peer server accepted the message; the asleep-server scenario promised record-retry-alarm for a first contact the implementation refuses; nothing covered a credential expiring; and the address-book cost of a live roster read was unstated. Another server is a peer server. AC12 states what a failed introduction leaves. AC13 covers expiry and revocation. AC17 states the live read. AC18 and the scenario state acceptance-as-receipt and the known-participant condition. AC20 names withdrawal as closing without waking the answerer. The agent-tools history line cites AC21 and sits in date order. Built by Claude Fable 5.1 in Claude Code. Co-Authored-By: Claude Fable 5.1 <[email protected]>
b465821 to
b85be05
Compare
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
…sonas Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Stack 1/8. Based on
j5/main. Merge in order, retargeting toj5/mainas predecessors land.Full stack:
Testing:
scripts/j5/pr-env.sh <pr> --peer(#255) serves this PR's build as two peered servers, Local and Remote. Rebased ontoj5/mainon 2026-09-30, after the Effect rc.115 upstream sync and the Playbooks and Crews migrations landed; peer migrations are now 023–027 and the FORK.md case is 48. A test state directory that ran an earlier cut of this stack recorded the peer tables under other ids, so rerunpr-env.shwith--freshfor such environments.Problem
The cross-device definition deferred server-to-server Exchanges to a future "peer registry" without saying what one is, how two servers learn about each other, or what agents would see. The trigger it waited for has arrived: a remote development server is in daily use, and today's investigation confirmed the A2A implementation is strictly single-server (local-only receiver resolution, both cross-Squadron ledger writes in one SQLite, in-process delivery transport, no peer concept anywhere).
What this defines
In
docs/j5/product/cross-device.md, a Peering section plus AC11–AC22 and three scenarios:send_message,list_participants, and envelopes gain no server field. The platform resolves participant → Squadron → peer.AC6 is rewritten from "when built" into a present-tense criterion. The A2A definition, the agent-tools contract (new AC17), and the glossary get one-line pointers. A worklog record carries the investigation findings, the two design questions and their answers, and the build outline so the criteria can be read against an implementation shape.
No code changes. Formatted with
vp fmt; lockfile churn reverted.Built by Claude Fable 5.1 in Claude Code.
🤖 Generated with Claude Code
Summary by CodeRabbit