acpmux: a peer's briefs, steer and report name none of this host's peers

Merged
TE
9d ago
+301-11

A peer daemon's connection (Origin::Peer, paired devices included) learns nothing about this host's peers (#26823, #26860, #26881, #26887, #26895). Three brief methods still leaked them:

  • _acpmux/briefs listed a peer connection the briefs this host had sent to its peers, with their host/target/to names, and asked every connected peer for its own briefs and merged them in.
  • _acpmux/steer and _acpmux/report forwarded a peer connection's call to the peer a brief ran on, or replayed that brief's row (idempotency key), naming the peer.
  • _acpmux/tasks {"all": true} (same ledger, same file) listed those rows too.

For Origin::Peer now:

methodreply to a peer connection
_acpmux/briefsonly briefs this host ran (a row whose session is one of this host's, Hub::brief_ran_here), newest first, status/limit applied after that filter, without suggestedHost; no peer is asked
_acpmux/tasksthe same filter
_acpmux/steer, _acpmux/reporta brief this host ran: as before, never forwarded, row without suggestedHost. A brief a peer ran (replays included), or one still being claimed: not_found "no brief """, byte for byte the answer for a brief that does not exist

Local, app and Web origins keep full detail. Daemon-to-daemon calls keep working: a host forwarding a steer or report to the peer that ran the brief reaches a brief that peer ran, and a host listing a peer's briefs gets the ones that peer ran (what it merges anyway).

Risk: low. A peer connection that relied on listing or steering briefs of this host's peers through this host can no longer (that was the leak). No new timers, observers or loops.

Test

tests/peer_briefs_origin.rs (fake peer daemon; multi-thread runtime with 32 MiB worker stacks, as tests/peer_dispatch_origin.rs): the unix socket dispatches one brief here and one to the fake peer, steers and reports the peer's with idempotency keys, and lists all three (its own, the one sent, one only the peer knows). A peer connection is then listed only its own brief with no peer name, _acpmux/tasks shows it no peer name, and steer/report of the peer's briefs (with and without the replay keys) give the same error object as a brief that never existed.

Before the fix (this test on base a6e72b7's code, cmux-ci test on the Linux pool, job 7258aa93f852f7748d918cf1): fails. A peer connection is listed the peer's brief and the one sent there, each naming elsewhere:

test a_peer_connections_briefs_steer_and_report_name_none_of_this_hosts_peers ... FAILED
thread '...' panicked at crates/acpmux/tests/peer_briefs_origin.rs:178:9:
{"briefs":[{"briefId":"brief-only-the-peer-knows","host":"elsewhere",...,"target":"elsewhere","to":"elsewhere"},{"briefId":"brief-01a1839a-2aa0-...","host":"elsewhere","lastReportKey":"report-1",...},{"brief":"say hi",...,"host":"local",...}]}
test result: FAILED. 0 passed; 1 failed

After (cmux-ci test on the Linux pool): passes. Head 05f8388, job 56ad9514e8ba56c73332c61f, cargo clippy -p acpmux --all-targets -- -D warnings clean, then:

test a_peer_connections_briefs_steer_and_report_name_none_of_this_hosts_peers ... ok
test result: ok. 1 passed; 0 failed

6372c1c (same code, test differed only by a clippy fix), job c7cf6b27a55b0b05d575b346, with tests/peer_dispatch_origin.rs alongside:

test a_peer_connections_briefs_steer_and_report_name_none_of_this_hosts_peers ... ok
test a_peer_connections_dispatch_names_none_of_this_hosts_peers ... ok

Review: Codex gpt-6-astra (high, fast) at 05f8388: SHIP.

Agent session: agent session

šŸ¤– Generated with Claude Code