@@ -3267,6 +3267,10 @@ const (
32673267 maxClaudeInitialImageBytes = 10 * 1024 * 1024
32683268)
32693269
3270+ func shouldSeedClaudeInitialImages (provider string , task Task ) bool {
3271+ return provider == "claude" && task .PriorSessionID == ""
3272+ }
3273+
32703274func (d * Daemon ) claudeInitialImages (ctx context.Context , task Task , taskLog * slog.Logger ) []agent.InputImage {
32713275 attachments := make ([]AttachmentMeta , 0 , len (task .IssueAttachments )+ len (task .ChatMessageAttachments ))
32723276 attachments = append (attachments , task .IssueAttachments ... )
@@ -3280,10 +3284,10 @@ func (d *Daemon) claudeInitialImages(ctx context.Context, task Task, taskLog *sl
32803284 if len (images ) >= maxClaudeInitialImages {
32813285 break
32823286 }
3283- if attachment .ID == "" || ! strings . HasPrefix ( strings . ToLower ( attachment .ContentType ), "image/" ) {
3287+ if attachment .ID == "" || ! isClaudeInitialImageMediaType ( attachment .ContentType ) {
32843288 continue
32853289 }
3286- meta , data , err := d .client .DownloadAttachment (ctx , attachment .ID )
3290+ _ , data , err := d .client .DownloadAttachment (ctx , attachment .ID )
32873291 if err != nil {
32883292 taskLog .Warn ("claude initial image download failed" , "attachment_id" , attachment .ID , "error" , err )
32893293 continue
@@ -3293,16 +3297,7 @@ func (d *Daemon) claudeInitialImages(ctx context.Context, task Task, taskLog *sl
32933297 continue
32943298 }
32953299 mediaType := attachment .ContentType
3296- if meta != nil && meta .ContentType != "" {
3297- mediaType = meta .ContentType
3298- }
3299- if ! strings .HasPrefix (strings .ToLower (mediaType ), "image/" ) {
3300- continue
3301- }
33023300 filename := attachment .Filename
3303- if meta != nil && meta .Filename != "" {
3304- filename = meta .Filename
3305- }
33063301 images = append (images , agent.InputImage {
33073302 Filename : filename ,
33083303 MediaType : mediaType ,
@@ -3312,6 +3307,15 @@ func (d *Daemon) claudeInitialImages(ctx context.Context, task Task, taskLog *sl
33123307 return images
33133308}
33143309
3310+ func isClaudeInitialImageMediaType (mediaType string ) bool {
3311+ switch strings .ToLower (strings .TrimSpace (mediaType )) {
3312+ case "image/jpeg" , "image/png" , "image/gif" , "image/webp" :
3313+ return true
3314+ default :
3315+ return false
3316+ }
3317+ }
3318+
33153319// gateResumeToReusedWorkdir clears the task's prior session unless the task
33163320// runs in the exact workdir the session was recorded against, and reports
33173321// whether that workdir was reused. CLI backends key their session stores to
@@ -3972,7 +3976,7 @@ func (d *Daemon) runTask(ctx context.Context, task Task, provider string, slot i
39723976 ThinkingLevel : thinkingLevel ,
39733977 OpenclawMode : openclawMode ,
39743978 }
3975- if provider == "claude" {
3979+ if shouldSeedClaudeInitialImages ( provider , task ) {
39763980 execOpts .InitialImages = d .claudeInitialImages (ctx , task , taskLog )
39773981 }
39783982 // Some providers do not reliably load the per-task runtime config files we
0 commit comments