fix(a2a/events): guard A2aEventQueue with threading.Lock to prevent concurrent iteration crash #11043

Closed
HAL9000 wants to merge 3 commits from pr_fix_8256 into master

3 Commits

Author SHA1 Message Date
CleverAgents Bot ac9f74bdd6 ci: stop master workflow on PR updates
CI / lint (pull_request) Has been cancelled
CI / typecheck (pull_request) Has been cancelled
CI / security (pull_request) Has been cancelled
CI / quality (pull_request) Has been cancelled
CI / unit_tests (pull_request) Has been cancelled
CI / integration_tests (pull_request) Has been cancelled
CI / e2e_tests (pull_request) Has been cancelled
CI / coverage (pull_request) Has been cancelled
CI / build (pull_request) Has been cancelled
CI / docker (pull_request) Has been cancelled
CI / helm (pull_request) Has been cancelled
CI / push-validation (pull_request) Has been cancelled
CI / status-check (pull_request) Has been cancelled
Remove the stale pull_request trigger from master.yml so PR branch commits do not launch the master workflow.

Maintenance patch for PR #11043.
2026-06-10 20:19:54 -04:00
HAL9000 14f51b48b7 fix(a2a/events): add PR compliance checklist items for A2aEventQueue thread-safety fix (#8256)
CI / benchmark-publish (pull_request) Has been skipped
CI / push-validation (pull_request) Successful in 31s
CI / lint (pull_request) Failing after 1m35s
CI / build (pull_request) Successful in 1m19s
CI / helm (pull_request) Successful in 56s
CI / benchmark-regression (pull_request) Failing after 1m38s
CI / quality (pull_request) Successful in 2m4s
CI / security (pull_request) Successful in 2m11s
CI / typecheck (pull_request) Successful in 2m14s
CI / integration_tests (pull_request) Successful in 4m34s
CI / e2e_tests (pull_request) Successful in 6m7s
CI / unit_tests (pull_request) Successful in 6m53s
CI / coverage (pull_request) Has been skipped
CI / docker (pull_request) Has been skipped
CI / status-check (pull_request) Failing after 4s
This commit adds the mandatory compliance items from the PR checklist that were
missing on the original threading.Lock implementation:

- CHANGELOG.md entry under [Unreleased]/Fixed documenting the A2aEventQueue
  lock-guarding fix (issue #7604 / PR #8256)
- CONTRIBUTORS.md entry for HAL 9000's concurrency safety contribution
- BDD test scenarios verifying concurrent publish+unsubscribe and
  subscribe-while-publishing complete without RuntimeError crashes

ISSUES CLOSED: #7604
2026-05-09 00:07:32 +00:00
HAL9000 04de283262 fix(a2a/events): guard A2aEventQueue with threading.Lock to prevent concurrent iteration crash
CI / status-check (pull_request) Blocked by required conditions
CI / benchmark-publish (pull_request) Has been skipped
CI / push-validation (pull_request) Successful in 40s
CI / helm (pull_request) Successful in 49s
CI / build (pull_request) Successful in 55s
CI / lint (pull_request) Successful in 1m9s
CI / quality (pull_request) Successful in 1m20s
CI / typecheck (pull_request) Successful in 1m35s
CI / security (pull_request) Successful in 1m47s
CI / integration_tests (pull_request) Successful in 3m8s
CI / unit_tests (pull_request) Successful in 4m38s
CI / e2e_tests (pull_request) Successful in 5m10s
CI / docker (pull_request) Successful in 1m35s
CI / benchmark-regression (pull_request) Failing after 1m22s
CI / coverage (pull_request) Failing after 22m56s
The A2aEventQueue class had no thread-safety guarantees for its internal
shared mutable state (_events, _subscriptions, _is_closed). When multiple
threads accessed the queue concurrently — e.g. one thread publishing events
while another iterated over subscriptions or read event lists — the lack of
locking could cause RuntimeError: dictionary changed size during iteration
and similar crashes.

This fix adds a threading.RLock to A2aEventQueue that guards all mutating
and reading operations (__init__, is_closed, publish, subscribe_local,
unsubscribe, get_events, close). The EventBusBridge class also receives
its own RLock for thread-safe start/stop operations.

Signed-off-by: CleverThis <hal9000@cleverthis.com>
2026-05-08 12:15:42 +00:00