-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Description
Version: 3.23.14
API Provider: OpenRouter
Model: claude-3-7-sonnet
What happened?
Running a specific gh alias set command with Claude 4 on OpenRouter causes the application to crash with the following error:
chunk-FNONPZGU.js?v=431cafd5:16718 Uncaught Error: Bad substitution: BASH_REM
at parseCommand (command-validation.ts:109:17)
at getCommandDecision (command-validation.ts:393:22)
at ChatView.tsx:927:11
at ChatView.tsx:935:11
at ChatView.tsx:996:34
The error occurs in the command validation system when trying to parse BASH-specific syntax like BASH_REMATCH.
Expected behavior
The command validation should either properly handle BASH-specific syntax or gracefully fail without crashing the application.
Steps to reproduce
- Use Claude 4 on OpenRouter
- Tell roo, run exactly the following command:
gh alias set pr-reviews --clobber '!f() {
url="$1"
if [[ "$url" =~ github\.com/([^/]+/[^/]+)/pull/([0-9]+) ]]; then
repo="${BASH_REMATCH[1]}"
pr="${BASH_REMATCH[2]}"
echo "=== Review Comments for $repo PR #$pr ==="
gh api "repos/$repo/pulls/$pr/reviews" --jq ".[] | {user: .user.login, state: .state, body: .body, submitted_at: .submitted_at}"
echo
echo "=== Line Comments ==="
gh api "repos/$repo/pulls/$pr/comments" --jq ".[] | {user: .user.login, body: .body, path: .path, line: .line, created_at: .created_at}"
else
echo "Error: Please provide a valid GitHub PR URL"
echo "Example: gh pr-reviews https://github.com/owner/repo/pull/123"
echo "Received: $url"
fi
}; f'Additional context
The issue appears to be in the parseCommand function in command-validation.ts which fails to properly handle BASH-specific syntax patterns like BASH_REMATCH.
The command validation system attempts to parse shell commands to determine if they should be allowed, but it doesn't properly handle all shell syntax constructs, particularly those specific to BASH like array indexing with BASH_REMATCH[n].
This crash prevents users from creating useful GitHub CLI aliases that use BASH features.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status