🤖 Fix /compact multiline parsing bug #268
Merged
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.
Problem
Multiline content after the
/compactcommand was being incorrectly parsed as flags, causing rejection or unexpected behavior.Example of bug:
This would error with:
-t requires a positive number, got shouldinstead of treating the entire line as the continue message.Root Cause
The parser was tokenizing the entire input (including content after newlines) and passing all tokens to minimist for flag parsing. This meant any text after a newline that looked like a flag (e.g.,
-t,-c,--anything) would be interpreted as a flag instead of message content.Solution
Changed the
/compacthandler to:rawInputat the first newlineThis ensures content after newlines is never interpreted as flags.
Testing
New test cases added:
-t,-c)All existing tests pass (25/25 slash command tests, 537 total tests)
Generated with
cmux