Skip to content

fix(training-agent): reject creative_assignments: [] on active/paused buys#3286

Draft
bokelley wants to merge 1 commit intomainfrom
claude/issue-2835-reject-creative-clear-on-active-buy
Draft

fix(training-agent): reject creative_assignments: [] on active/paused buys#3286
bokelley wants to merge 1 commit intomainfrom
claude/issue-2835-reject-creative-clear-on-active-buy

Conversation

@bokelley
Copy link
Copy Markdown
Contributor

Closes #2835

update_media_buy with creative_assignments: [] on a package of an active buy caused deriveStatus to return pending_creatives (because hasCreatives === false), emitting an active → pending_creatives transition that is not in MEDIA_BUY_TRANSITIONS. The status.monotonic invariant assertion would reject this transition the moment any storyboard exercises the "buyer replaces all creatives" path.

Fix: Validation guard added in the pre-validation pass (handleUpdateMediaBuy, pre-pass loop). If the buy's derived status is active, paused, or pending_start, clearing all assignments on any package returns VALIDATION_ERROR before any mutation occurs. This is Option 2 from the issue — cleaner than the creaturesWereAttached bit (Option 1) because it keeps deriveStatus and MEDIA_BUY_TRANSITIONS untouched and produces a clear API error the agent under test can observe.

Non-breaking justification: Server-only change in task-handlers.ts; no protocol schema, task definition, or published API surface touched. Changeset --empty.

Pre-PR review:

  • code-reviewer: approved — Option 2 confirmed cleaner; guard placement in pre-pass (before any mutation) correct; comment at mutation site updated to remove the stale "may regress to pending_creatives" language; no schema impact

Triage-managed PR. This bot does not currently iterate on review comments or PR conversation threads (only on the source issue). To unblock:

  • Push fixup commits directly: gh pr checkout <num> → fix → push.
  • Or re-trigger: comment /triage execute on the source issue.

See #3121 for context.

Session: https://claude.ai/code/${CLAUDE_CODE_REMOTE_SESSION_ID}


Generated by Claude Code

… buys

update_media_buy with an empty creative_assignments array on a live buy
caused deriveStatus to return pending_creatives (hasCreatives === false),
emitting an active → pending_creatives transition not in MEDIA_BUY_TRANSITIONS.

Guard added in the pre-validation pass: if the buy is in active, paused, or
pending_start status, clearing all assignments on any package returns
VALIDATION_ERROR before any mutation occurs. Updated the comment at the
mutation site to reflect that the empty-array case is now pre-empted.

Closes #2835

https://claude.ai/code/${CLAUDE_CODE_REMOTE_SESSION_ID}
@bokelley bokelley added the claude-triaged Issue has been triaged by the Claude Code triage routine. Remove to re-triage. label Apr 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

claude-triaged Issue has been triaged by the Claude Code triage routine. Remove to re-triage.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

training-agent: update_media_buy with empty creative_assignments emits non-monotonic active → pending_creatives

2 participants