mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2026-08-12 01:07:46 +00:00
When a napplet issued several consent-gated calls at once (the common case: it reads relays + storage + identity on load), each launched a NappletConsentActivity concurrently. The host can only show one, so the rest were delivered to the single-top activity and silently dropped — their broker calls hung forever (storage stuck pending; a subscription's consent lost, yielding 0 events). Gate the consent-prompt path behind a Mutex on the (per-account, reused) broker so prompts queue one at a time. After taking the lock, re-read the ledger so a sibling request for the same capability honors the just-recorded grant instead of prompting again. Only the prompt is serialized — execute() and already-granted paths stay parallel. Per-use capabilities (payments) still re-prompt every time. Adds a regression test asserting 5 concurrent same-capability requests yield exactly one prompt and never two dialogs at once. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>