Three ADRs addressing gaps surfaced by the first hub consumer (alkapi): - ADR-067: Aggregated peer-env wiring — Dispatcher::with_aggregated_env hook so compose_root_env reads a shared PeerCompositeEnv across all calls, not a fresh per-call one. The hub-defining gap (alkapi OQ-08 / G.1). - ADR-068: PeerCompositeEnv::peer_operations override — adds list_operation_names() to OperationEnv, overrides on OverlayOperationEnv and PeerCompositeEnv. Fixes services/list-peers returning empty operation lists for non-local peers (alkapi G.6). - ADR-069: from_call is a manual free function, not auto-wired — reverses the aspirational OQ-27 resolution to match the implementation. Cleans the 'v1 default' hedging language in ADR-017 and client-and-adapters.md (alkapi G.4). New crate spec: alknet-hub — reusable hub pattern (aggregated env, connection lifecycle, worker supervision with backoff, service discovery). Spec fixes: builder API drift (with_local/with_local_streaming separation), ScopedOperationEnv → ScopedPeerEnv type name, OQ count 51→54. Three new OQs: OQ-52 (wait_for_close), OQ-53 (backoff defaults), OQ-54 (inbound hook placement).
1.2 KiB
1.2 KiB
OQ-52: CallConnection::wait_for_close() for Supervision Loop
- Origin: crates/hub/README.md
- Status: open
- Door type: Two-way
- Priority: medium
- Resolution: Not yet decided.
The hub's worker supervision loop needs a way to await connection close so it
can call detach_peer and retry. Today CallConnection exposes connection()
(the underlying Connection) but not a "wait for run_loop exit" future.
Options:
- (a) Add a
closed()method toCallConnectionthat returns aFuture<Output = ()>resolving whenrun_loopexits. The dispatcher signals atokio::sync::Notifyon exit;closed()awaits it. - (b) Use a
tokio::sync::oneshotchannel created by the caller and passed to the dispatcher, signaled onrun_loopexit. - (c) Poll
connection().accept_bi()in a loop until it returnsConnectionClosed— works but is polling, not event-driven.
Option (a) is the cleanest: a method on CallConnection that any caller
(not just the hub) can use to await connection close. It is a small additive
change to alknet-call.
- Cross-references: ADR-067, crates/hub/README.md