#1679
[BUG] A state file that is not UTF-8 fails the hydrate instead of starting empty
The tool state files are written UTF-8 with ensure_ascii=False, so a write interrupted in the middle of a multi-byte character leaves a file that is readable but not decodable. UnicodeDecodeError is a ValueError, so it does not match a handler listing (OSError, json.JSONDecodeError) - and the exception escapes the hydrate call that runs at scan start.
Reproduced on this checkout with a state file holding {"truncated": "\xff\xfe"}:
| store | before |
|---|---|
hydrate_todos_from_disk | UnicodeDecodeError escapes |
hydrate_notes_from_disk | UnicodeDecodeError escapes |
hydrate_threat_models_from_disk | UnicodeDecodeError escapes |
hydrate_coverage_from_disk | UnicodeDecodeError escapes |
load_user_mcp_configs | UnicodeDecodeError escapes |
Each of those already has the "log, start empty" behaviour; only the catch list is short.
Expected: a state file that cannot be decoded is treated like one that cannot be parsed - logged, and the store starts empty - so one damaged file does not stop the run.
Activity
0No activity yet.