@@ -3440,6 +3440,10 @@ const (
34403440 maxClaudeInitialImageBytes = 10 * 1024 * 1024
34413441)
34423442
3443+ func shouldSeedClaudeInitialImages (provider string , task Task ) bool {
3444+ return provider == "claude" && task .PriorSessionID == ""
3445+ }
3446+
34433447func (d * Daemon ) claudeInitialImages (ctx context.Context , task Task , taskLog * slog.Logger ) []agent.InputImage {
34443448 attachments := make ([]AttachmentMeta , 0 , len (task .IssueAttachments )+ len (task .ChatMessageAttachments ))
34453449 attachments = append (attachments , task .IssueAttachments ... )
@@ -3453,10 +3457,10 @@ func (d *Daemon) claudeInitialImages(ctx context.Context, task Task, taskLog *sl
34533457 if len (images ) >= maxClaudeInitialImages {
34543458 break
34553459 }
3456- if attachment .ID == "" || ! strings . HasPrefix ( strings . ToLower ( attachment .ContentType ), "image/" ) {
3460+ if attachment .ID == "" || ! isClaudeInitialImageMediaType ( attachment .ContentType ) {
34573461 continue
34583462 }
3459- meta , data , err := d .client .DownloadAttachment (ctx , attachment .ID )
3463+ _ , data , err := d .client .DownloadAttachment (ctx , attachment .ID )
34603464 if err != nil {
34613465 taskLog .Warn ("claude initial image download failed" , "attachment_id" , attachment .ID , "error" , err )
34623466 continue
@@ -3466,16 +3470,7 @@ func (d *Daemon) claudeInitialImages(ctx context.Context, task Task, taskLog *sl
34663470 continue
34673471 }
34683472 mediaType := attachment .ContentType
3469- if meta != nil && meta .ContentType != "" {
3470- mediaType = meta .ContentType
3471- }
3472- if ! strings .HasPrefix (strings .ToLower (mediaType ), "image/" ) {
3473- continue
3474- }
34753473 filename := attachment .Filename
3476- if meta != nil && meta .Filename != "" {
3477- filename = meta .Filename
3478- }
34793474 images = append (images , agent.InputImage {
34803475 Filename : filename ,
34813476 MediaType : mediaType ,
@@ -3485,6 +3480,15 @@ func (d *Daemon) claudeInitialImages(ctx context.Context, task Task, taskLog *sl
34853480 return images
34863481}
34873482
3483+ func isClaudeInitialImageMediaType (mediaType string ) bool {
3484+ switch strings .ToLower (strings .TrimSpace (mediaType )) {
3485+ case "image/jpeg" , "image/png" , "image/gif" , "image/webp" :
3486+ return true
3487+ default :
3488+ return false
3489+ }
3490+ }
3491+
34883492// gateResumeToReusedWorkdir clears the task's prior session unless the task
34893493// runs in the exact workdir the session was recorded against, and reports
34903494// whether that workdir was reused. CLI backends key their session stores to
@@ -4135,7 +4139,7 @@ func (d *Daemon) runTask(ctx context.Context, task Task, provider string, slot i
41354139 ThinkingLevel : thinkingLevel ,
41364140 OpenclawMode : openclawMode ,
41374141 }
4138- if provider == "claude" {
4142+ if shouldSeedClaudeInitialImages ( provider , task ) {
41394143 execOpts .InitialImages = d .claudeInitialImages (ctx , task , taskLog )
41404144 }
41414145 // Some providers do not reliably load the per-task runtime config files we
0 commit comments