Spaces:
Running on Zero
Running on Zero
Commit ·
05c3128
1
Parent(s): 23343cb
fix: add observability log to apply_update JSON parse failure
Browse filesCo-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
memory.py
CHANGED
|
@@ -20,7 +20,8 @@ def apply_update(state: dict, raw_json: str) -> dict:
|
|
| 20 |
start = raw_json.find("{")
|
| 21 |
end = raw_json.rfind("}") + 1
|
| 22 |
update = TurnUpdate.model_validate_json(raw_json[start:end])
|
| 23 |
-
except Exception:
|
|
|
|
| 24 |
update = TurnUpdate()
|
| 25 |
|
| 26 |
state["affinity"] = max(0, min(100, state["affinity"] + update.affinity_delta))
|
|
|
|
| 20 |
start = raw_json.find("{")
|
| 21 |
end = raw_json.rfind("}") + 1
|
| 22 |
update = TurnUpdate.model_validate_json(raw_json[start:end])
|
| 23 |
+
except Exception as e:
|
| 24 |
+
print(f"[apply_update] JSON parse failed: {e!r} | raw: {raw_json[:120]!r}")
|
| 25 |
update = TurnUpdate()
|
| 26 |
|
| 27 |
state["affinity"] = max(0, min(100, state["affinity"] + update.affinity_delta))
|