Repository navigation
Fix check_looping_torrents — read decypharr log file, not docker CLI - #6
Merged
Merged
Conversation
The retry-storm detector has been a silent no-op since at least the v1.1.6 pin: it shelled out to subprocess.run(["docker", "logs", ...]) but the babysitarr container has only the docker socket mounted, no docker CLI. FileNotFoundError got swallowed by a bare `except`, the function returned 0 actions for months, and uncached-release storms ran unchecked until indexers gave out and emails fired about deleted files. Fix: - Read /decypharr-config/logs/decypharr.log directly (already mounted; same path check_symlink_loops uses). New helpers `_read_decypharr_log_tail` and `_count_processing_hashes` are module-level and testable in isolation. - Both bounds on the log window so tests can anchor `_now` to a fixture timestamp. - ANSI-strip defensively in the hash extractor — the production log format puts color escapes between `Hash=` and the hex value. Add tests/test_log_parsing.py with a real captured storm sample (tests/fixtures/decypharr_storm_sample.log) so format drift fails CI loudly. Wire the test job into the existing GitHub workflow as a required `needs:` for build, and run it on PRs too. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2 of 5 tasks
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
check_looping_torrentshas been a silent no-op since at least the v1.1.6 pin (May 2026). It shelled out tosubprocess.run(["docker", "logs", ...])but the babysitarr container has only the docker socket mounted — no docker CLI binary. The resultingFileNotFoundErrorwas caught by a bareexceptand the function returned 0 actions for months. Uncached-release retry storms (movies with no cached releases on Real-Debrid) ran unchecked until indexers gave out and the deleted-without-import email finally fired.All-time action tally before this fix:
What changed
/decypharr-config/logs/decypharr.logdirectly (already mounted; same pathcheck_symlink_loopsuses)._read_decypharr_log_tailand_count_processing_hashesat module scope, testable in isolation. Both window bounds so tests can anchor_nowto a fixture timestamp. ANSI-strip defensively in the hash extractor (production logs put color escapes betweenHash=and the hex value).tests/test_log_parsing.pywith 7 tests covering: hash extraction, ANSI handling, window filtering, fixture presence, end-to-end storm detection. Fixturetests/fixtures/decypharr_storm_sample.logis a real 6-hour capture of an active storm (Nymphomaniac Vol II, Remarkably Bright Creatures, Lorne, Tafiti/A Desert, etc).needs: test.Test plan
python -m unittest discover -v tests— 7/7 pass on plex-serverrequestsdocker logs babysitarrforFound N looping torrentswarnings on the next stormACTION: blocklist_loopentries start appearing🤖 Generated with Claude Code