fix(e2e): use aggressive cleanup threshold (5 min) for pre-run to prevent quota exhaustion (#2798)

The pre-run stale cleanup (added in #2789) used the same 30-minute max_age
as the post-run cleanup. Orphaned instances from recently-failed runs (< 30 min
old) were not cleaned, causing quota exhaustion on DigitalOcean and other clouds.

Pre-run cleanup now uses _CLEANUP_MAX_AGE=300 (5 min) to aggressively reclaim
orphaned e2e instances before provisioning new ones. Post-run cleanup retains
the 30-minute default. All 5 cloud drivers respect the override.

Fixes #2793

Agent: code-health

Co-authored-by: B <6723574+louisgv@users.noreply.github.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
A 2026-03-19 11:23:55 -07:00 committed by GitHub
parent e4bfd38443
commit 8fef58845c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 9 additions and 9 deletions

View file

@ -212,7 +212,7 @@ _aws_cleanup_stale() {
local region="${AWS_REGION:-us-east-1}"
local now
now=$(date +%s)
local max_age=1800 # 30 minutes in seconds
local max_age="${_CLEANUP_MAX_AGE:-1800}" # default 30 min; pre-run uses shorter
# List all instances
local instances_json

View file

@ -287,7 +287,7 @@ _digitalocean_cleanup_stale() {
local now
now=$(date +%s)
local max_age=1800 # 30 minutes in seconds
local max_age="${_CLEANUP_MAX_AGE:-1800}" # default 30 min; pre-run uses shorter
local droplets_json
droplets_json=$(_do_curl_auth -sf \

View file

@ -243,7 +243,7 @@ _gcp_cleanup_stale() {
local project="${GCP_PROJECT:-}"
local now
now=$(date +%s)
local max_age=1800 # 30 minutes in seconds
local max_age="${_CLEANUP_MAX_AGE:-1800}" # default 30 min; pre-run uses shorter
if [ -z "${project}" ]; then
log_warn "GCP_PROJECT not set — skipping stale cleanup"

View file

@ -229,7 +229,7 @@ _hetzner_teardown() {
_hetzner_cleanup_stale() {
local now
now=$(date +%s)
local max_age=1800 # 30 minutes
local max_age="${_CLEANUP_MAX_AGE:-1800}" # default 30 min; pre-run uses shorter
local response
response=$(_hetzner_curl_auth -sf \

View file

@ -254,7 +254,7 @@ _sprite_teardown() {
_sprite_cleanup_stale() {
local now
now=$(date +%s)
local max_age=1800 # 30 minutes in seconds
local max_age="${_CLEANUP_MAX_AGE:-1800}" # default 30 min; pre-run uses shorter
# List all sprites
local sprite_output