Skip to content

sim_time: _forwarding_tell reentrancy flag is per-runtime, so a concurrent task's Tell skips sim-timestamp formatting #513

Description

@proboscis

Split out of #507 (minor-findings item 12) on demand; reproduced during the 2026-07-10 audit fix campaign.

Symptom

SimTimeRuntime._forwarding_tell (sim_time.py:44-45, 81-89, 129-134) is a single flag on the runtime, not per-task state. If Tell forwarding suspends mid-flight (e.g. a relay handler outside sim performs Await(asyncio.sleep(...)) while forwarding), a concurrent task's Tell observes _forwarding_tell=True and bypasses sim-timestamp formatting entirely.

Observed in the repro: seen == ['[sim] A', 'B'] — task B's message escaped unformatted.

Fix direction

Track forwarding reentrancy per task (e.g. keyed by task id) or restructure forwarding so the flag never spans a suspension point.

Found by the systematic concurrency audit (#507); reproduced on the fix-time-contract branch, orthogonal to the shipped PRs (#508-#511).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions