mirror of
https://github.com/element-hq/synapse.git
synced 2026-08-18 02:10:29 +00:00
The current-context storage is asymmetric: reads give the tokio task-local precedence, but the switch primitive only ever writes the OS-thread slot. A switch performed while a scoped task is being polled would therefore be write-only — invisible to current_context() and never restored — silently misattributing everything that follows. That invariant was previously enforced only by comments; check it at the single write chokepoint and log an error if it is ever violated. Also update the module doc, which still described the earlier phase's architecture where Python kept the accounting policy — set_current_context is fully native as of this branch. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JFbRtswu7rsHrttJFauUUb