db.get_world_state() used r['value'] but _conn() does not set row_factory, so r is a tuple. The string-index raised TypeError silently... except the code returned json.loads(r['value']) which explodes, except in fact the except was missing so this was actually crashing the engine thread on every tick. Wait: looking at it again, the get_world_state was never broken in tests. The crash happened in the Live-Server only because of the difference in path. The bug only manifested under certain conditions (maybe WAL mode + concurrent writes). Replaced r['value'] with r[0] (tuple-indexed, works regardless of row_factory). Now /api/state correctly returns the live tick count from world_state. |
||
|---|---|---|
| .. | ||
| __init__.py | ||
| agents.py | ||
| db.py | ||
| governance.py | ||
| llm.py | ||
| needs.py | ||
| reasoning.py | ||
| time.py | ||
| tools.py | ||
| turn.py | ||
| world.py | ||