Skip to content

buzz-acp: run independent threads concurrently - #4135

Open
ChinaDairy wants to merge 2 commits into
block:mainfrom
ChinaDairy:agent/thread-scoped-acp-20260801
Open

buzz-acp: run independent threads concurrently#4135
ChinaDairy wants to merge 2 commits into
block:mainfrom
ChinaDairy:agent/thread-scoped-acp-20260801

Conversation

@ChinaDairy

Copy link
Copy Markdown

Summary

  • scope event queue, in-flight tracking, dedup, retry, cancellation and steer routing by (channel, NIP-10 thread root)
  • allow distinct threads in the same channel to dispatch concurrently while preserving top-level channel behavior
  • carry threadRootId through ACP observer Activity frames and exact control/task completion paths
  • add queue and exact thread control-routing regression tests; document the new behavior

Verification

  • cargo fmt --all -- --check
  • cargo check -p buzz-acp
  • cargo test -p buzz-acp queue::tests --no-fail-fast (113 passed)
  • cargo test -p buzz-acp observer_chunk_coalescer_tests --no-fail-fast (2 passed)
  • cargo test -p buzz-acp owner_control_command_tests --no-fail-fast -- --test-threads=1 (4 passed)
  • cargo test -p buzz-acp pool::tests --no-fail-fast -- --test-threads=1 (108 passed)

The full package suite has pre-existing Windows /bin/bash and inert-agent subprocess failures; focused pure/state tests above pass.

@ChinaDairy
ChinaDairy requested a review from a team as a code owner August 1, 2026 15:32
@ChinaDairy
ChinaDairy force-pushed the agent/thread-scoped-acp-20260801 branch from 00afb4c to f9dda8c Compare August 1, 2026 15:32
Signed-off-by: ChinaDairy <81678063+ChinaDairy@users.noreply.github.com>
…p dedup

Successor to a49e561 (v12), which is permanently ineligible for release.
Carries the v13 repairs plus three defects found and fixed in this pass.

LaneKey::resolve collected required root/reply tags into HashSets, so two
IDENTICAL `root` (or `reply`) tags collapsed to a single entry and the
`len() > 1` conflict check could never fire - a duplicated required marker
resolved a lane instead of failing closed. Unrecognised fourth-field markers
hit `continue` and were silently skipped, so an event whose only thread tag
carried an unknown marker derived a TOP-LEVEL lane and ran in the wrong lane
entirely. Both now fail closed: duplicates are counted in a Vec, and an
unknown marker returns MalformedRequiredTag. `mention` stays explicitly
non-authoritative rather than becoming an error, and NIP-10 deprecated
positional compatibility is unchanged.

setup_mode's `nudged_event_ids` was an insert-only HashSet with no eviction:
one entry per mentioned event, retained for the lifetime of the process, and
the events are supplied by other participants. That contradicts the bounded
persistent-state invariant. Replaced with NudgeDedup, reusing the relay's
existing TwoGenDedup two-generation rotation rather than inventing a second
scheme, so recent history is still deduplicated for reconnect replay while
residency is capped.

PoolEvent::Respawn now boxes RespawnResult (clippy::large_enum_variant).
The accompanying collapsible_match cannot be satisfied: install_respawn_result
consumes its argument and a match guard only borrows, so lifting the `if`
into a guard is E0507. That single allow carries the reason inline.

Gates on this tree: cargo fmt --check rc=0; clippy -p buzz-acp --all-targets
-D warnings rc=0; buzz-acp lib 761 passed 0 failed; buzz-agent 468 passed 0
failed across five targets; cargo deny advisories/bans/licenses/sources ok;
Windows x86_64-pc-windows-gnu cross-check 0 warnings; git diff --check rc=0.

Signed-off-by: ChinaDairy <81678063+ChinaDairy@users.noreply.github.com>
@ChinaDairy
ChinaDairy force-pushed the agent/thread-scoped-acp-20260801 branch from e1b8829 to 900a83f Compare August 10, 2026 03:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant