fix(cli): guard quick_commands against non-dict values#18850
Open
shellybotmoyer wants to merge 1 commit into
Open
fix(cli): guard quick_commands against non-dict values#18850shellybotmoyer wants to merge 1 commit into
shellybotmoyer wants to merge 1 commit into
Conversation
Without isinstance check, string/int values in quick_commands crash slash command dispatch with AttributeError. Fixes NousResearch#18816
Collaborator
|
Likely duplicate of #18817 — same root cause and fix for quick_commands non-dict guard in cli.py. |
Collaborator
|
Likely duplicate of #18817 - same root cause and fix for quick_commands non-dict guard in cli.py. |
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.
Fix: Guard quick_commands against non-dict values
Problem
cli.py:6584callsqcmd.get("type")on whatever value is inquick_commands— no validation that it's actually a dict. If a user has a string, int, or null value in their quick_commands config, all slash commands matching that key crash withAttributeError: 'str' object has no attribute 'get'.Even worse, a broken quick_commands entry poisons any overlapping skill command, because quick_commands is checked BEFORE skill commands in the dispatch chain.
Reproduction
Then
/foo→Error: 'str' object has no attribute 'get'Fix
Added
isinstance(qcmd, dict)guard before accessing dict methods, matching the pattern already used ingateway/run.py:5214-5215. If the value is not a dict, we log a warning and fall through to plugin/skill command dispatch instead of crashing.Testing
origin/mainFixes #18816