Skip to content

fix: recover from corrupted cache JSON files#245

Open
Gujiassh wants to merge 1 commit intoFujiwaraChoki:mainfrom
Gujiassh:fix/cache-json-recovery
Open

fix: recover from corrupted cache JSON files#245
Gujiassh wants to merge 1 commit intoFujiwaraChoki:mainfrom
Gujiassh:fix/cache-json-recovery

Conversation

@Gujiassh
Copy link
Copy Markdown

@Gujiassh Gujiassh commented Apr 5, 2026

Summary

  • recover gracefully when account/product cache files contain invalid JSON instead of crashing on JSONDecodeError
  • reset corrupted cache files back to empty default payloads so the CLI can continue operating
  • add focused regression coverage for corrupted account and product cache files

Fixes #230.

Testing

  • python3 -m unittest tests.test_cache
  • python3 -m py_compile src/cache.py tests/test_cache.py

Reset account/product cache files to empty defaults when JSON decoding fails so corrupted cache files no longer crash the CLI on startup.

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
@Gujiassh
Copy link
Copy Markdown
Author

Gujiassh commented Apr 6, 2026

Quick validation from my side on the current branch tip:

  • pytest tests/test_cache.py2 passed
  • python3 scripts/preflight_local.py currently stops on a missing local config.json, which looks like expected machine-specific setup rather than a regression from this cache-fallback fix

So the corrupted-cache recovery behavior covered by this PR is locally green on the current branch.

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(cache): JSONDecodeError crashes on corrupted cache files

1 participant