From 196af8fba73a1e617d5c6cc3ead710398212b944 Mon Sep 17 00:00:00 2001 From: arkon Date: Fri, 3 Apr 2026 04:27:32 +0200 Subject: [PATCH] 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 --- src/tmux-manager.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/tmux-manager.ts b/src/tmux-manager.ts index e4b2aab9..69542bfe 100644 --- a/src/tmux-manager.ts +++ b/src/tmux-manager.ts @@ -185,8 +185,8 @@ function buildSpawnCommand(options: { }): string { if (options.mode === 'claude') { // Validate model to prevent command injection - const safeModel = options.model && /^[a-zA-Z0-9._-]+$/.test(options.model) ? options.model : undefined; - const modelFlag = safeModel ? ` --model ${safeModel}` : ''; + const safeModel = options.model && /^[a-zA-Z0-9._\-[\]]+$/.test(options.model) ? options.model : undefined; + const modelFlag = safeModel ? ` --model "${safeModel}"` : ''; // Use --resume to restore a previous conversation, otherwise --session-id for new sessions. // Wrap --resume in a fallback: if it exits non-zero (session not found, corrupt, etc.), // fall back to a new session with --session-id so the pane doesn't die.