Skip to content

feat: Image generation ability should accept post_id for standalone calls #229

@saraichinwag

Description

@saraichinwag

Problem

When calling datamachine/generate-image ability directly (outside a pipeline), the System Agent generates and sideloads the image but does NOT set it as the post's featured image. This is because the deferred retry logic looks for post_id in the pipeline engine data, which doesn't exist for standalone ability calls.

Current behavior

wp_get_ability('datamachine/generate-image')->execute([
    'prompt' => 'A woodpecker...',
    'post_id' => 13391,  // passed but ignored for featured image assignment
]);
// Image generated ✅, sideloaded ✅, featured image NOT set ❌

Expected behavior

If post_id is passed to the ability, the System Agent should use it to set the featured image after sideload — same as it does for pipeline jobs.

Context

Hit this today when generating featured images for 3 orphaned posts (13423, 13404, 13391) via direct ability calls. Had to manually set _thumbnail_id after the jobs completed.

The post_id is already accepted as an input parameter — it just needs to flow through to ImageGenerationTask so the deferred retry can find it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions