Skip to content

Conversation

@bokelley
Copy link
Contributor

Summary

Fixes "Package missing required package_id for AdCP response" error by ensuring Package objects always have valid AdCP-compliant status values. Changed validation to check object attributes instead of serialized dict, and ensured both approval workflows set status to "draft".

Changes

  • Improved validation in Package.model_dump() to check object attributes (self.package_id, self.status) instead of serialized dict
  • Manual approval flow now sets status="draft" instead of None
  • Configuration approval flow now uses status="draft" instead of TaskStatus.INPUT_REQUIRED

🤖 Generated with Claude Code

bokelley and others added 2 commits November 16, 2025 20:14
**Problem:**
"Package missing required package_id for AdCP response" error occurred
when Package objects were created with status=None or invalid status
values (e.g., TaskStatus.INPUT_REQUIRED).

**Root Cause:**
1. Package.model_dump() validated required fields by checking the
   serialized dict (data.get("package_id")), but exclude_none=True
   (default) would exclude None values, making the check ineffective
2. Two code paths created packages without proper status:
   - Manual approval flow: set status to None
   - Config approval flow: set status to TaskStatus.INPUT_REQUIRED
     (not a valid AdCP Package status)

**Solution:**
1. Changed Package.model_dump() validation to check object attributes
   (self.package_id, self.status) instead of serialized dict
2. Set status="draft" in manual approval flow (line 1870)
3. Changed status from TaskStatus.INPUT_REQUIRED to "draft" in config
   approval flow (line 2239)

**Testing:**
- Validation now properly detects None values even with exclude_none=True
- All Package objects created in response flows have valid AdCP-compliant
  status values ("draft", "active", "paused", "completed")

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
The test was missing the required 'selection_type' field in publisher_properties,
causing schema validation to fail per AdCP spec. Publisher properties require
either selection_type='by_tag' with property_tags or selection_type='by_id'
with property_ids.

This was a pre-existing test issue, not caused by the package status changes.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@bokelley bokelley merged commit 757c0d3 into main Nov 17, 2025
8 checks passed
youbek pushed a commit that referenced this pull request Nov 17, 2025
* Fix: Ensure Package objects always have valid status

**Problem:**
"Package missing required package_id for AdCP response" error occurred
when Package objects were created with status=None or invalid status
values (e.g., TaskStatus.INPUT_REQUIRED).

**Root Cause:**
1. Package.model_dump() validated required fields by checking the
   serialized dict (data.get("package_id")), but exclude_none=True
   (default) would exclude None values, making the check ineffective
2. Two code paths created packages without proper status:
   - Manual approval flow: set status to None
   - Config approval flow: set status to TaskStatus.INPUT_REQUIRED
     (not a valid AdCP Package status)

**Solution:**
1. Changed Package.model_dump() validation to check object attributes
   (self.package_id, self.status) instead of serialized dict
2. Set status="draft" in manual approval flow (line 1870)
3. Changed status from TaskStatus.INPUT_REQUIRED to "draft" in config
   approval flow (line 2239)

**Testing:**
- Validation now properly detects None values even with exclude_none=True
- All Package objects created in response flows have valid AdCP-compliant
  status values ("draft", "active", "paused", "completed")

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Fix: Add missing selection_type to publisher_properties in test

The test was missing the required 'selection_type' field in publisher_properties,
causing schema validation to fail per AdCP spec. Publisher properties require
either selection_type='by_tag' with property_tags or selection_type='by_id'
with property_ids.

This was a pre-existing test issue, not caused by the package status changes.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

---------

Co-authored-by: Claude <noreply@anthropic.com>
danf-newton pushed a commit to Newton-Research-Inc/salesagent that referenced this pull request Nov 24, 2025
…ol#755)

* Fix: Ensure Package objects always have valid status

**Problem:**
"Package missing required package_id for AdCP response" error occurred
when Package objects were created with status=None or invalid status
values (e.g., TaskStatus.INPUT_REQUIRED).

**Root Cause:**
1. Package.model_dump() validated required fields by checking the
   serialized dict (data.get("package_id")), but exclude_none=True
   (default) would exclude None values, making the check ineffective
2. Two code paths created packages without proper status:
   - Manual approval flow: set status to None
   - Config approval flow: set status to TaskStatus.INPUT_REQUIRED
     (not a valid AdCP Package status)

**Solution:**
1. Changed Package.model_dump() validation to check object attributes
   (self.package_id, self.status) instead of serialized dict
2. Set status="draft" in manual approval flow (line 1870)
3. Changed status from TaskStatus.INPUT_REQUIRED to "draft" in config
   approval flow (line 2239)

**Testing:**
- Validation now properly detects None values even with exclude_none=True
- All Package objects created in response flows have valid AdCP-compliant
  status values ("draft", "active", "paused", "completed")

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Fix: Add missing selection_type to publisher_properties in test

The test was missing the required 'selection_type' field in publisher_properties,
causing schema validation to fail per AdCP spec. Publisher properties require
either selection_type='by_tag' with property_tags or selection_type='by_id'
with property_ids.

This was a pre-existing test issue, not caused by the package status changes.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

---------

Co-authored-by: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants