Skip to content

bug: AI Fallback logic overrides user's manual edits #665

Description

@sahare77

Description
If the OpenRouter API fails, the backend falls back to a deterministic draft. However, if the user had manually edited the email body in the UI, the fallback logic might incorrectly overwrite their edits during the launch phase.

Steps to Reproduce

  1. Configure campaign without AI key.
  2. Edit email step manually in the builder.
  3. Launch campaign.
  4. Observe the sent emails use the fallback template instead of manual edits.

Expected Behavior
The AI generation should only happen when explicitly requested via the "AI Generate" button, OR it should respect a flag use_ai_generation=True. It should not unconditionally overwrite the content field.

Implementation Hints

# backend/campaigns/tasks.py
if step.use_ai:
    content = generate_with_ai(...)
else:
    content = step.content

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions