H1: When a turn finished and a goal followup existed, the finally block set running=False (under history_lock), then the goal followup code re-acquired the lock and set running=True. Between these two lock acquisitions, a notification poller or concurrent prompt.submit could acquire the lock, see running=False, and start a second turn on the same session — leading to interleaved history writes. Fix: instead of releasing and re-acquiring the turn guard, keep running=True across the finally→goal-followup boundary. Only set running=False in the finally when there is NO goal followup to chain. This eliminates the TOCTOU window entirely. All 183 TUI tests pass, including goal command tests. |
||
|---|---|---|
| .. | ||
| __init__.py | ||
| entry.py | ||
| event_publisher.py | ||
| render.py | ||
| server.py | ||
| slash_worker.py | ||
| transport.py | ||
| ws.py | ||