Fix #3374: Fully populate adversary and planner objects in scheduled …#3382
Open
clutester wants to merge 1 commit into
Open
Fix #3374: Fully populate adversary and planner objects in scheduled …#3382clutester wants to merge 1 commit into
clutester wants to merge 1 commit into
Conversation
…duled operations
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
…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.
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:
Test: