Repository navigation
fix(errors): keep the generic error code stable across restarts - #338
Merged
Merged
Conversation
The code was built from hash(function_name), and str hash() is salted per process, so the same failure got a new code (CHAT-ERR-975, -324, -195 ...) after every restart of the server and could not be searched for or reported. Use zlib.crc32 instead. Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_018Xun6C4mXUAKbVSmiEEh79
chigwell
approved these changes
Oct 20, 2026
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
The generic error code in
log_and_format_errorwas derived withabs(hash(function_name)) % 1000. Python saltsstr.__hash__per process (PYTHONHASHSEED), so the same failure got a different code after every restart — useless for correlating logs across runs or matching against documented codes.This switches the code to
zlib.crc32(function_name.encode()) % 1000, which is stable across processes for the same input.Testing
tests/test_error_logging.pyasserts the code is reproducible across invocations.🤖 Generated with Claude Code