Skip to content

ActionResponse validation failure results in hang not error #337

Description

@benclifford

Describe the problem.

When I (deliberately) cause ActionResponse validation to fail, pytest hangs rather than failing. Here's a stack trace.

I'm not too fussed about that happening in the test suite, but hangs-rather-than-errors should not happen in a user facing situation.

-------------------------------------------------------- live log call --------------------------------------------------------
INFO     academy.exchange.client:client.py:160 Registered AgentId<28db4b7d> in exchange
DEBUG    academy.manager:manager.py:358 Launching agent (attempt: 1; retries: 0; AgentId<28db4b7d>; <class 'tests.unit.agent_test.test_agent_launch_alongside.<locals>.ParentAgent'>)
DEBUG    academy.runtime:runtime.py:422 Starting agent... (AgentId<28db4b7d>; Agent<ParentAgent>)
INFO     academy.manager:manager.py:175 Initialized manager (AgentId<28db4b7d>)
INFO     academy.runtime:runtime.py:467 Running agent (AgentId<28db4b7d>; Agent<ParentAgent>)
INFO     academy.manager:manager.py:510 Launched agent (AgentId<28db4b7d>; <class 'tests.unit.agent_test.test_agent_launch_alongside.<locals>.ParentAgent'>)
DEBUG    academy.handle:handle.py:241 Invoking action launch_child with invocation id 0cb97806-02a5-4b90-aab9-b1dae838c9cd
DEBUG    academy.handle:handle.py:264 Sending action request from UserId<1c21d411> to AgentId<28db4b7d> (action='launch_child')
DEBUG    academy.exchange.client:client.py:178 Sent ActionRequest to AgentId<28db4b7d>
DEBUG    academy.handle:handle.py:274 Waiting for result of action launch_child with invocation id 0cb97806-02a5-4b90-aab9-b1dae838c9cd
DEBUG    academy.exchange.client:client.py:223 Received ActionRequest from UserId<1c21d411> for AgentId<28db4b7d>
DEBUG    academy.runtime:runtime.py:356 Invoking "launch_child" action on AgentId<28db4b7d>
INFO     academy.exchange.client:client.py:160 Registered AgentId<458d6c71> in exchange
DEBUG    academy.manager:manager.py:358 Launching agent (attempt: 1; retries: 0; AgentId<458d6c71>; <class 'tests.unit.agent_test.test_agent_launch_alongside.<locals>.ChildAgent'>)
DEBUG    academy.runtime:runtime.py:422 Starting agent... (AgentId<458d6c71>; Agent<ChildAgent>)
INFO     academy.manager:manager.py:175 Initialized manager (AgentId<458d6c71>)
INFO     academy.runtime:runtime.py:467 Running agent (AgentId<458d6c71>; Agent<ChildAgent>)
INFO     academy.manager:manager.py:510 Launched agent (AgentId<458d6c71>; <class 'tests.unit.agent_test.test_agent_launch_alongside.<locals>.ChildAgent'>)
ERROR    academy.logging:__init__.py:34 Background task raised an exception.
Traceback (most recent call last):
  File "/home/benc/parsl/academy/academy/academy/runtime.py", line 238, in _execute_action
    ActionResponse(action=body.action, result=result),
    ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/benc/parsl/academy/virtualenv-trixie/lib/python3.13/site-packages/pydantic/main.py", line 250, in __init__
    validated_self = self.__pydantic_validator__.validate_python(data, self_instance=self)
pydantic_core._pydantic_core.ValidationError: 1 validation error for ActionResponse
action
  Extra inputs are not permitted [type=extra_forbidden, input_value='launch_child', input_type=str]
    For further information visit https://errors.pydantic.dev/2.12/v/extra_forbidden

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/benc/parsl/academy/academy/academy/logging/__init__.py", line 32, in execute_and_log_traceback
    return await fut
           ^^^^^^^^^
  File "/home/benc/parsl/academy/academy/academy/runtime.py", line 243, in _execute_action
    await asyncio.shield(self._send_response(response))
                                             ^^^^^^^^
UnboundLocalError: cannot access local variable 'response' where it is not associated with a value
DEBUG    academy.runtime:runtime.py:295 Started action with tag 35935cbb-1331-482c-ad1c-47f9a6ce3805

How did you install and run the code?

Version

dbd6a7a

Python Version

Python 3.13.5

OS and Platform

Linux academy-dev-trixie-108 6.1.0-25-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.106-3 (2024-08-26) x86_64 GNU/Linux

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions