Backend and Database: integrate agent max_hours_before_termination_limit safely into workspaces
MR: Saf add termination validations and limits to w... (!161049 - merged)
Description
After Set timeout fields on agent config model (!158383 - merged) is merged, we can now specify workspace max_hours_before_termination to be within the agent-defined max_hours_before_termination_limit at the time of creation. We would need to make the following set of changes to ensure a a correct implementation:
Acceptance Criteria
Validations needed
-
We need to verify that the workspace's max_hours_before_terminationis always less than or equal to its associated agentmax_hours_before_termination_limitwhen the workspace is created.
Database Data changes
-Users who used env override previously may have set max_hours_before_termination > 8760 which is the PAT maximum lifetime. ENV overrides now only apply to non-production rails environment so this cannot happen but we are adding this data migration for safety concerns in case a user previously used that feature.
-
Add a data migration to cap all existing workspaces max_hours_before_terminationto8760.
Impact Assessment
-
The user that used overrides on already created workspaces to set the max_hours_before_termination> the cap of8760will have their workspaces terminated.
Edited by Safwan Ahmed