Skip to content

fix(agent): handle corrupt X-Ray state files without crashing agent-write (#60)#76

Merged
MarcoPorcellato merged 2 commits into
mainfrom
fix/60-corrupt-xray-state
Jun 29, 2026
Merged

fix(agent): handle corrupt X-Ray state files without crashing agent-write (#60)#76
MarcoPorcellato merged 2 commits into
mainfrom
fix/60-corrupt-xray-state

Conversation

@MarcoPorcellato

Copy link
Copy Markdown
Owner

Summary

  • Harden SessionAliasRegistry.load_from_disk for empty files, invalid JSON, legacy {"aliases": {...}} wrappers, and non-integer alias keys (skip with warning).
  • Introduce SessionAliasRegistryError in exceptions.py.
  • agent-write catches registry load failures and exits with a clear stderr message; replace production assert with explicit guard.
  • Tests: test_agent_press malformed-state cases + test_agent_write_corrupt_state_file_exits_nonzero.
  • Document resilient X-Ray reload in docs/ARCHITECTURE.md §3.7.

Closes #60

Test plan

  • make all (Ruff, Mypy, pytest)
  • Empty / invalid JSON / wrapper / non-int alias keys covered
  • CLI exits 1 on corrupt .matryca_xray_state.json

Made with Cursor

MarcoPorcellato and others added 2 commits June 29, 2026 19:19
…rite

Harden SessionAliasRegistry.load_from_disk for empty, invalid JSON, legacy
wrapper keys, and non-integer alias keys. KINETIC agent-write catches
SessionAliasRegistryError and replaces the production assert guard.

Closes #60

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@MarcoPorcellato MarcoPorcellato merged commit 28de99f into main Jun 29, 2026
5 checks passed
@MarcoPorcellato MarcoPorcellato deleted the fix/60-corrupt-xray-state branch June 29, 2026 17:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(agent): handle corrupt X-Ray state files without crashing agent-write

1 participant