bramhanandlingala opened a new pull request, #70432:
URL: https://github.com/apache/airflow/pull/70432

   ## Summary
   
   `AnthropicAgentSessionOperator.__init__` validated `message` and `outcome`
   before Jinja templating runs, even though both are `template_fields`. A
   templated `outcome` (e.g. `outcome="{{ params.outcome }}"`) would crash
   at DAG-parse time with `AttributeError: 'str' object has no attribute
   'keys'`, before rendering ever gets a chance to resolve it to a real dict.
   
   ## Fix
   
   `providers/anthropic/src/airflow/providers/anthropic/operators/agent.py`:
   
   - `__init__` now only does plain assignments.
   - The two validation checks (`message`/`outcome` mutual exclusivity, and
     `outcome` requiring `description` + `rubric`) moved to the top of
     `execute()`, after templating has run.
   
   ## Testing
   
   `providers/anthropic/tests/unit/anthropic/operators/test_agent.py`:
   
   - Updated `test_requires_exactly_one_of_message_or_outcome` and
     `test_outcome_requires_description_and_rubric` to construct the operator
     first, then assert the `ValueError` is raised on `.execute()` instead of
     at construction.
   - Added `test_init_does_not_validate_message_or_outcome` to lock in that
     `__init__` accepts any combination without raising.
   
   ## Exemption list
   
   Removed `AnthropicAgentSessionOperator`'s entry from
   `scripts/ci/prek/validate_operators_init_exemptions.txt`, as required by
   the burn-down rule.
   
   Related to #70296


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to