diff --git a/hive-ag3nt/src/events.rs b/hive-ag3nt/src/events.rs index 448cb806..2a45e7f6 100644 --- a/hive-ag3nt/src/events.rs +++ b/hive-ag3nt/src/events.rs @@ -762,6 +762,15 @@ impl Bus { // statuses that shouldn't touch it (e.g. `needs_login_in_progress` // is a transient mid-flow status; only `needs_login_idle` and // `online` should change the persistent flag). + // + // Known non-atomicity: this is a read-modify-write. Two concurrent + // `emit_status` calls could clobber each other's `needs_login` + // change if they raced between the read and the write. In practice + // this is safe: the turn loop is sequential and the login flow + // (`needs_login_idle` / `online`) only fires outside of active + // turns, so the two callers never overlap. Documented rather than + // locked because adding a Mutex here would be overkill for the + // actual call pattern. let (_, current_needs_login) = read_harness_state(); let new_needs_login = if status == "needs_login_idle" { true