claude-memory/graph/solutions/fix-for-play-lock-never-released-on-exception-5d8e1f.md
Cal Corum b140d4d82a migrate: 313 memories from MemoryGraph
- 313 new markdown files created
- 30 relationships embedded
- 313 entries indexed
- State initialized with usage data
2026-02-13 11:11:48 -06:00

1.6 KiB

id type title tags importance confidence created updated relations
5d8e1ff5-3354-4cfa-ab63-bf96b5ce1e01 solution Fix for play lock never released on exception
paper-dynasty
python
discord-bot
sqlalchemy
fix
play-lock
concurrency
critical
0.95 0.8 2026-02-04T15:09:38.128767+00:00 2026-02-04T15:09:38.128767+00:00
target type direction strength
9b70e3d5-d0b6-48c5-88d0-2fbc36f4fd4d SOLVES incoming 0.5
target type direction strength
1c795804-d2bd-4ace-8de8-aea4819424f0 CAUSES outgoing 0.5
target type direction strength
88bbf5f1-2d76-4e68-9c62-ca72e464f5c0 BUILDS_ON outgoing 0.5

Implemented 3-layer defense against stuck play locks: (1) Added release_play_lock() helper function in logic_gameplay.py for manual lock release. (2) Created safe_play_lock() context manager that automatically releases locks on exception via try/except/finally. (3) Added automatic lock release to global error handler in paperdynasty.py @bot.tree.error - on ANY app command exception, checks if there's a locked play in the channel and releases it. This prevents all 13+ stuck locks we found in production. Updated error message from 'auto-unlock will trigger' (which didn't exist) to 'go call dad'. Added comprehensive tests in test_play_locking.py for lock release scenarios. Key files modified: command_logic/logic_gameplay.py (added release_play_lock, safe_play_lock context manager), paperdynasty.py (updated on_app_command_error), cogs/gameplay.py (imported new functions, example usage in end_game_command).