Fix UnicodeDecodeError in diskcache TAGS_CACHE.get()#4844
Open
314clay wants to merge 1 commit intoAider-AI:mainfrom
Open
Fix UnicodeDecodeError in diskcache TAGS_CACHE.get()#4844314clay wants to merge 1 commit intoAider-AI:mainfrom
314clay wants to merge 1 commit intoAider-AI:mainfrom
Conversation
Add UnicodeDecodeError, pickle.UnpicklingError, and ValueError to the SQLITE_ERRORS tuple so corrupted cache entries trigger cache recreation via tags_cache_error() instead of crashing. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #4729
TAGS_CACHE.get()inaider/repomap.pycan crash withUnicodeDecodeError(orpickle.UnpicklingError/ValueError) when diskcache encounters corrupted cache entries. The existingtags_cache_error()recovery mechanism only caughtSQLITE_ERRORS(sqlite3 and OS errors), missing these deserialization failures.Changes:
aider/repomap.py: Addimport pickleand expand theSQLITE_ERRORStuple to includeUnicodeDecodeError,pickle.UnpicklingError, andValueError— all existing except clauses already catchSQLITE_ERRORSand calltags_cache_error()for cache recreation, so this is a one-line fixtests/basic/test_repomap.py: AddTestTagsCacheErrorRecoverywith 4 tests:test_unicode_decode_error_in_cache_get— poisonsTAGS_CACHE.get()withUnicodeDecodeError, verifies recoverytest_unpickling_error_in_cache_get— same withpickle.UnpicklingErrortest_value_error_in_cache_get— same withValueErrortest_cache_errors_in_sqlite_errors_tuple— verifies all three types are inSQLITE_ERRORSTest plan
pytest tests/basic/test_repomap.py— all 49 tests pass (45 existing + 4 new)