When I receive a mail on my address root and it has the header X-Spam-Status set to Yes, it’s stored in the Root inbox …
I have tested the script (the full version and the actual source of the received email) with https://sieve-tester.com/ , and the result is correct :
Email is kept in inbox
Performed actions:
* store message in folder: Quarantine
+ create mailbox if it does not exist
Implicit keep:
(none)
The likely cause is that Stalwart’s X-Spam-Status header does not just contain Yes or No, it also appends the numeric score, e.g. X-Spam-Status: Yes, score=13.45. Since your rule uses header :is "X-Spam-Status" "Yes", and :is requires an exact match of the whole header value, it will never match "Yes, score=13.45" in production. Your test on sieve-tester.com almost certainly used a raw email you crafted with a plain X-Spam-Status: Yes header (no score suffix), which is why it matched there but not on real Stalwart-delivered mail.
Fix by matching on a prefix or substring instead of exact equality, for example:
if header :contains "X-Spam-Status" "Yes"
or, to be safe with case/formatting, :matches "Yes*".