mirror of
https://github.com/block/buzz.git
synced 2026-11-26 19:21:50 +00:00
run_identity_transition previously sampled has_active_scope before acquiring workspace_transition and skipped the lock entirely on the no-scope path. That left a None -> Some activation race: a concurrent apply_workspace could commit a new active scope between the pre-branch sample and the durable identity commit, so the import would drain nothing while a live scope existed. Route both the mesh-llm and non-mesh paths through workspace_transition unconditionally, and move the active/no-scope decision inside import_identity_blocking, derived from a scope snapshot taken under the held guard. Sampling under the guard closes the race: apply_workspace and identity import now serialize on workspace_transition, so no activation can slip between the sample and the commit. No deadlock — apply_workspace takes only workspace_transition (never identity_mutation), so the global order identity_mutation -> workspace_transition has no cycle. Drops the now-redundant has_active_scope bool from import_identity_blocking's signature. Co-authored-by: Will Pfleger <pfleger.will@gmail.com> Signed-off-by: Will Pfleger <pfleger.will@gmail.com>