Skip to content

Commit 196af8f

Browse files
Ark0Nclaude
andcommitted
fix: allow bracket chars in model flag for opus[1m] context window
The model validation regex rejected brackets, silently dropping models like opus[1m]. Also quote the model flag to prevent bash glob expansion. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent a9b22b8 commit 196af8f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/tmux-manager.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,8 +185,8 @@ function buildSpawnCommand(options: {
185185
}): string {
186186
if (options.mode === 'claude') {
187187
// Validate model to prevent command injection
188-
const safeModel = options.model && /^[a-zA-Z0-9._-]+$/.test(options.model) ? options.model : undefined;
189-
const modelFlag = safeModel ? ` --model ${safeModel}` : '';
188+
const safeModel = options.model && /^[a-zA-Z0-9._\-[\]]+$/.test(options.model) ? options.model : undefined;
189+
const modelFlag = safeModel ? ` --model "${safeModel}"` : '';
190190
// Use --resume to restore a previous conversation, otherwise --session-id for new sessions.
191191
// Wrap --resume in a fallback: if it exits non-zero (session not found, corrupt, etc.),
192192
// fall back to a new session with --session-id so the pane doesn't die.

0 commit comments

Comments
 (0)