Repository navigation
fix(godcmd): answer when the plugin priority is not a number - #3303
Merged
zhayujie merged 1 commit intoSep 29, 2026
Merged
Conversation
#setpri checked the argument count and then read the second argument with a bare int(), so "#setpri keyword high" raised ValueError out of on_handle_context. Nothing downstream catches it -- emit_event calls the handler directly and the worker callback only logs -- so the admin got no reply of any kind instead of the usage text every sibling command answers.
4 of 8 tasks
Owner
|
Merged, thanks! A typo in the priority now gets a clear answer, same as #3291 did for Midjourney. |
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.
What
#setpri(设置插件优先级) checked the argument count and then converted the second argument with a bareint(), so a priority typed as a word --#setpri keyword high-- raisedValueErrorout ofon_handle_contextand the admin got no reply at all. The value is now parsed inside atry, an unparsable one is answered through the reply path the command already uses (ReplyType.ERROR, naming what was typed:优先级 high 无效, 应为整数), and the numeric path is unchanged -- including the success text, which still echoes the argument the user wrote.Fixes #3302
Why it was silent rather than an error message
Nothing on the way back catches that exception:
PluginManager.emit_eventinvokes the handler directly (plugins/plugin_manager.py:287-297),ChatChannel._handlehas no try/except around it (channel/chat_channel.py:191-209), and the worker's exception callback only logs it (channel/chat_channel.py:452-453). So the one command that takes a number from the user is the one command that cannot answer a wrong one:reloadp(line 404),enablep(413),disablep(418) andinstallp(427) all reply on a bad argument, and#setprialready replies on a bad argument count -- only the value was unguarded.Checks
pytest tests/test_godcmd_setpri_priority_argument.pyfails on the first case withValueError: invalid literal for int() with base 10: 'high'at plugins/godcmd/godcmd.py:397, i.e. the handler never reaches the reply it is supposed to build.FAILEDset is identical (32 pre-existing failures, all environment-bound on Windows -- scheduler timezone, symlink pruning, thergbackend parity case,/proc/self/environprobes).passedgoes 2256 -> 2259, exactly the three new cases. No other file was touched.ruff check --select F --ignore F403,F405) on both changed files: All checks passed.The new tests stub
BridgeandPluginManager, so no network and no plugin config is written; the plugin itself is pointed at atmp_pathconfig carryingadmin_users.