Skip to content

fix: skip an empty r/all head listing instead of crashing the bot - #100

Merged
Toldry merged 2 commits into
masterfrom
claude/project-thread-wz5dwe
Oct 16, 2026
Merged

Toldry merged 2 commits into
masterfrom
claude/project-thread-wz5dwe

Conversation

@Toldry

@Toldry Toldry commented Oct 16, 2026

Copy link
Copy Markdown
Owner

Requested by Querent · project thread

Before: when Reddit returned an empty r/all comment listing to the head poll, fetch_head raised RuntimeError('The r/all comment listing returned no comments'). main.handle_exception re-raises unknown errors, so the process exited and Docker restarted the container. On the VM that had happened 71 times by 2026-10-16 21:32 UTC. Each restart also SIGKILLed any docker compose exec bot python -m racb --process-one run, which then stopped mid-log with exit code 137 and no error message.

After: an empty listing skips that one poll. It logs a WARNING once per streak and an INFO line when comments come back. The next poll queues every block up to the head it finds, so no comment is missed.

How: fetch_head returns None for an empty listing, and CommentReader.poll_head returns early on None and counts the streak in empty_head_polls. I added unit tests for the skip, for the catch-up afterwards, and for run() continuing past an empty listing. AGENTS.md and the changelog fragment are updated too.


Generated by Claude Code

Reddit sometimes returns no comments for the head poll. fetch_head raised a
RuntimeError that handle_exception re-raises, so the process exited and Docker
restarted it in a loop, which also SIGKILLed any `exec`'d --process-one run.
fetch_head now returns None and poll_head skips that poll.

Co-Authored-By: Toldry <toldry@gmail.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019ddUNNyEKK7YQuAyfKfGwi
@Toldry Toldry self-assigned this Oct 16, 2026
Co-Authored-By: Toldry <toldry@gmail.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019ddUNNyEKK7YQuAyfKfGwi
@Toldry
Toldry merged commit 4353666 into master Oct 16, 2026
4 checks passed
Toldry added a commit that referenced this pull request Oct 16, 2026
fetch_head now returns None for an empty listing (#100), which the live
comment reader test did not expect, so it failed with a TypeError and
blocked the deploy of v3.1.1.

Co-Authored-By: Toldry <toldry@gmail.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019ddUNNyEKK7YQuAyfKfGwi
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.

2 participants