Skip to content

fix(engine): handle non-numeric user and group IDs gracefully and support update_github_token config#122

Open
Rat0323 wants to merge 2 commits into
Renyus:masterfrom
Rat0323:fix-session-id-non-numeric-value-error
Open

fix(engine): handle non-numeric user and group IDs gracefully and support update_github_token config#122
Rat0323 wants to merge 2 commits into
Renyus:masterfrom
Rat0323:fix-session-id-non-numeric-value-error

Conversation

@Rat0323

@Rat0323 Rat0323 commented Jun 3, 2026

Copy link
Copy Markdown

This PR fixes a ValueError: invalid literal for int() with base 10 crash/warning log that spams when session_memory_summarizer or reflection runs daily background summaries on non-QQ platforms or WebUI sessions (which use alphanumeric user/session IDs like Rat or webchat!...).

By catching ValueError during the integer casting of the private user ID / group ID, the history fetch functions will now return an empty list ([]) gracefully and skip querying the OneBot API for incompatible text-based IDs, preventing execution failures and console warning spams.

Also fixes a mock-event truthiness issue in test_result_clean.py unit tests where standard MagicMock() objects returned truthy values for any attribute accesses, breaking the newly added is_at_or_wake_command check inside should_clean_result logic.

Additionally, adds support for an optional update_github_token config setting under the update_notify group. If configured, it includes the Bearer token in update check commits requests to lift GitHub's unauthenticated API rate limits and avoid spams of 403 Rate Limit Exceeded warnings on shared or high-frequency checking IPs.

@Rat0323 Rat0323 force-pushed the fix-session-id-non-numeric-value-error branch from 124bd84 to 6650525 Compare June 3, 2026 23:21
@Rat0323 Rat0323 changed the title fix(engine): handle non-numeric user and group IDs gracefully in history fetches fix(engine): handle non-numeric user and group IDs gracefully and support update_github_token config Jun 3, 2026
@Rat0323

Rat0323 commented Jun 15, 2026

Copy link
Copy Markdown
Author

I added a follow-up commit (fb5388e) to make this PR easier to review and verify.

What changed:

  • Added regression coverage for non-numeric private/session scope IDs in both DailyBatchProcessor and SessionMemorySummarizer.
  • Verified that invalid IDs such as private_Rat and webchat_session return an empty history page without calling the OneBot history APIs.
  • Added coverage for update_github_token, including the expected Authorization: Bearer ... request header.
  • Added matching changelog entries for both fixes.

Validation run locally:

python -m unittest tests.test_reflection tests.test_session_memory_summarizer tests.test_scheduler tests.test_result_clean tests.test_config_contract
python -m py_compile engine\reflection.py engine\session_memory_summarizer.py scheduler\tasks.py config.py tests\test_reflection.py tests\test_session_memory_summarizer.py tests\test_scheduler.py

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.

1 participant