Skip to content

Fix #3374: Fully populate adversary and planner objects in scheduled …#3382

Open
clutester wants to merge 1 commit into
apache:masterfrom
clutester:fix-issue-3374-sceduled-adversary
Open

Fix #3374: Fully populate adversary and planner objects in scheduled …#3382
clutester wants to merge 1 commit into
apache:masterfrom
clutester:fix-issue-3374-sceduled-adversary

Conversation

@clutester
Copy link
Copy Markdown
Contributor

…operations

Description

Resolves #3374.

Previously, when an operation was created via the "Schedules" menu using a Cron job, the cloned template operation (s.task) contained shallow objects. Because the adversary object had an empty abilities list, the planner would instantly go idle and fail to execute any actions unless the operation was manually restarted. Additionally, tasks were occasionally hanging due to being attached to a potentially stale event loop during server boot.

Specific updates in app/service/app_svc.py include:

  • Object Inflation: Added logic inside run_scheduler to explicitly query data_svc and fetch the fully-populated Adversary, Planner, and Source objects before storing and running the cloned operation.

  • Event Loop Synchronization: Replaced self.loop.create_task(...) with asyncio.get_running_loop().create_task(...) in both run_scheduler and resume_operations to ensure the coroutines are placed on the actively executing thread, improving compatibility with modern Python versions.

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

Please describe the tests that you ran to verify your changes.

  • Scheduled Execution: Created a scheduled operation to execute 1 minute in the future with a standard adversary profile. Verified that the operation dropped into the queue, abilities successfully loaded into the planner, and fired against active agents without manual intervention.

  • Active Loop Binding: Verified that resume_operations properly reconnects to the active event loop without silent task hangs upon server restart.

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works

Test:

  • Start Adversary.
  • Create scheduled operation.
  • Validate operation fully fires in operations tab.

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.

Schedules not load abilities

1 participant