max_reblog has a hidden default of 5 that overrides run_continuously #56

Closed
opened 2026-06-23 20:16:23 +00:00 by coding-agent-marvin8 · 1 comment
coding-agent-marvin8 commented 2026-06-23 20:16:23 +00:00 (Migrated from codeberg.org)

When run_continuously = true is set in config but max_reblog is not set, zhongli stops after 5 posts because max_reblog has a hardcoded default of 5 in the Configuration struct.\n\nThe field should have no default (i.e. int | None = None), so that:\n- If not set, there is no post limit\n- If set to a positive integer, that limit is honoured regardless of run_continuously\n\nThis removes the silent, surprising behaviour caused by the hidden default.

When `run_continuously = true` is set in config but `max_reblog` is not set, zhongli stops after 5 posts because `max_reblog` has a hardcoded default of `5` in the `Configuration` struct.\n\nThe field should have no default (i.e. `int | None = None`), so that:\n- If not set, there is no post limit\n- If set to a positive integer, that limit is honoured regardless of `run_continuously`\n\nThis removes the silent, surprising behaviour caused by the hidden default.
coding-agent-marvin8 commented 2026-06-23 20:16:37 +00:00 (Migrated from codeberg.org)

Root cause: Configuration.max_reblog has int = 5 as its type annotation and default in config.py. In boost_from_fenliu, the CLI --max-posts argument takes precedence, but when absent (the normal container case), config.max_reblog is used directly — so the undocumented default of 5 silently caps every run.\n\nrun_continuously is parsed but never influences the limit logic.\n\nPlan:\n1. Change max_reblog: int = 5max_reblog: int | None = None in config.py\n2. _should_stop_boosting already treats falsy max_posts as "no limit", so None propagates correctly with no further changes needed\n3. Add/update tests to assert the field is None when omitted from config and that _should_stop_boosting never fires when max_posts is None\n\nBranch: fix/issue-56-max-reblog-no-default

**Root cause:** `Configuration.max_reblog` has `int = 5` as its type annotation and default in `config.py`. In `boost_from_fenliu`, the CLI `--max-posts` argument takes precedence, but when absent (the normal container case), `config.max_reblog` is used directly — so the undocumented default of 5 silently caps every run.\n\n`run_continuously` is parsed but never influences the limit logic.\n\n**Plan:**\n1. Change `max_reblog: int = 5` → `max_reblog: int | None = None` in `config.py`\n2. `_should_stop_boosting` already treats falsy `max_posts` as "no limit", so `None` propagates correctly with no further changes needed\n3. Add/update tests to assert the field is `None` when omitted from config and that `_should_stop_boosting` never fires when `max_posts` is `None`\n\n**Branch:** `fix/issue-56-max-reblog-no-default`
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
marvin8/dujiangyan#56
No description provided.