MAESTRO: Fix image-only prompts skipping session init (PR #928 concept)

Image-only prompts have empty text content, causing session-init handler
to skip session creation entirely. Use '[media prompt]' placeholder so
sessions still get created and tracked in memory.

Closes PR #928 (applied directly due to merge conflicts with outdated base).
Credit: @iammike for identifying the issue.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Alex Newman
2026-02-05 23:47:12 -05:00
parent 3eb0154d58
commit 576d407c00
2 changed files with 6 additions and 6 deletions
+4 -5
View File
@@ -19,12 +19,11 @@ export const sessionInitHandler: EventHandler = {
return { continue: true, suppressOutput: true, exitCode: HOOK_EXIT_CODES.SUCCESS };
}
const { sessionId, cwd, prompt } = input;
const { sessionId, cwd, prompt: rawPrompt } = input;
// Gracefully handle empty prompts (user submitted blank input)
if (!prompt || !prompt.trim()) {
return { continue: true, suppressOutput: true };
}
// Handle image-only prompts (where text prompt is empty/undefined)
// Use placeholder so sessions still get created and tracked for memory
const prompt = (!rawPrompt || !rawPrompt.trim()) ? '[media prompt]' : rawPrompt;
const project = getProjectName(cwd);
const port = getWorkerPort();