Skip to content

fix: coerce neuron.events_retention_size to int for RotatingFileHandler#158

Open
Tmalone1250 wants to merge 1 commit intoentrius:testfrom
Tmalone1250:test
Open

fix: coerce neuron.events_retention_size to int for RotatingFileHandler#158
Tmalone1250 wants to merge 1 commit intoentrius:testfrom
Tmalone1250:test

Conversation

@Tmalone1250
Copy link
Copy Markdown

Fixes #154

Summary

  • Changed type=str to type=int for the --neuron.events_retention_size argument in allways/utils/config.py.
  • This ensures that argparse returns an integer instead of a string when parsing the command line.

Why

The string value was being passed directly to RotatingFileHandler(maxBytes=...) in allways/utils/logging.py. The standard library's logging handler requires an integer to perform the internal if maxBytes > 0 comparison, triggering a TypeError and crashing the logging thread at startup if a string was provided.

Behavior note

Users providing --neuron.events_retention_size via CLI will no longer experience a fatal crash during initialization. The logging rotation will now correctly enforce the specified byte limit.

Net

-1 line (+1 line with corrected type) in allways/utils/config.py.

Test plan

  • ruff check allways/ neurons/ and ruff format --check - both clean.
  • pytest tests/ - no new failures vs. current test branch.
  • Manual smoke: executed local reproduction script demonstrating the TypeError is resolved.
  • Verified via native regression test (logs attached/available).

Attachments

reproduce_issue_154.py
pre_fix_failure.log
post_fix_success.log

The --neuron.events_retention_size argument was incorrectly defined with
type=str in allways/utils/config.py. This caused a TypeError when the
parsed string value was passed to RotatingFileHandler(maxBytes=...) in
allways/utils/logging.py, which requires an integer for comparison.

Fixes entrius#154
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.

Crash in RotatingFileHandler when --neuron.events_retention_size is set via CLI

1 participant