Files
alknet/docs/architecture/questions/054-inbound-worker-hook-placement.md
T
glm-5.2 87b2c2a5ef docs(arch): hub-wiring cluster — aggregated env, peer_operations, from_call cleanup, alknet-hub crate spec
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).
2026-07-09 16:01:30 +00:00

1.1 KiB

OQ-54: Inbound Worker on_worker_connected Hook Placement

  • Origin: crates/hub/README.md
  • Status: open
  • Door type: Two-way
  • Priority: low
  • Resolution: Not yet decided.

When a worker connects inbound (via CallAdapter::handle), the hub needs to call from_call, register the bundles, and attach_peer. Two options:

  • (a) Explicit: The assembly layer calls hub.on_worker_connected() after CallAdapter::handle accepts the connection. The hub provides the method; the assembly layer wires it.
  • (b) Wrapper: The hub provides a HubCallAdapter wrapper that calls the hook automatically inside handle(). The assembly layer uses the wrapper instead of the raw CallAdapter.

Option (a) is simpler and more flexible — the assembly layer controls when the hook fires and can add its own logic (authorization checks, logging) before discovery. Option (b) is more convenient but hides the hook from the assembly layer.

The explicit approach is the committed interim. A wrapper is additive.