Files
npub1qyvc0c5kl4gqv2fd97fsk46tu378sqgy35vc83rvgfwne90sel7s0ed67dandTyler Longwell eca05aa257 feat(acp): thread-scoped concurrent sessions — scope-keyed dispatch, affinity, control resolution
Scheduling identity becomes ConversationSessionKey (channel_id, root_event_id):

- queue.rs: all in-flight control state (deadlines, batch sizes, retry,
  cancel sets, withheld native steer) keyed by scope; flush_next selects
  the oldest non-in-flight scope so distinct roots flush concurrently;
  restore_unclaimed is the exact lossless undo of flush_next.
- pool.rs: TaskMeta carries the scope; try_claim returns
  ClaimOutcome{Claimed,BusyOwner,Exhausted} with strict retained-root
  slot affinity and lazy owner pruning; send_steer scope-keyed.
- lib.rs: dispatch_pending dispatches multiple scopes per pass, holding
  BusyOwner/Exhausted batches until after the loop (prevents
  flush→restore→reflush livelock) then restoring losslessly; control
  resolution never fans out across roots — explicit root targets
  exactly, channel-level control resolves only when exactly one scope
  is in flight (Err(n) = ambiguous, touch nothing); steer fork is
  scope-exact. Channel mode remains the degenerate root=None path.

Deterministic coverage: cross-root concurrent dispatch, busy-owner skip
without root migration, pool-exhaustion lossless restore, three
restore_unclaimed exactness tests, control-scope resolution (channel
exactly-one rule, explicit control-frame root, threaded-event root
targeting, channel-mode fallback). cargo test -p buzz-acp: 557 passed.

Co-authored-by: Tyler Longwell <tlongwell@block.xyz>
Signed-off-by: Tyler Longwell <tlongwell@block.xyz>
2026-07-18 17:49:24 -04:00
..