From 4eba63ce83d899542fb740a16f53727cddbecdf8 Mon Sep 17 00:00:00 2001 From: Aditya Sheth Date: Thu, 19 Nov 2026 19:41:38 +0530 Subject: [PATCH 1/2] Stop the CI k8s sandbox on stop_sandbox even without the sandbox label (ENG-227126) stop_sandbox sent the sandbox.yml stop only together with removing a `sandbox` label it found in the event payload. A sandbox can be running with no label (removed by hand after its start was asked for), and the payload's labels are the PR's when the run is created, not when the comment was posted, so such a sandbox could not be stopped and ran to its time limit. The US stop is now sent on every stop_sandbox; the label is still removed when present, and regional stops stay tied to their labels. The launcher's stop is idempotent, so a stop with nothing running does nothing. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01GodBYdczeSv48XzK3eeCzj --- entrypoint.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/entrypoint.sh b/entrypoint.sh index 23b0ab5..2b0a922 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -376,7 +376,6 @@ if [[ $comment_body == "stop_sandbox" ]]; then case $label in sandbox) remove_label "sandbox" - sandbox_k8s_request stop ;; "sandbox :eu:") remove_label "sandbox%20:eu:" @@ -428,4 +427,9 @@ if [[ $comment_body == "stop_sandbox" ]]; then ;; esac done + # The US sandbox is stopped whether or not its label is on: a sandbox can be running with + # none (the label was removed by hand after its start was asked for), and the labels read + # above are the PR's when this run was created, not when the comment was posted. A stop + # with nothing running does nothing. + sandbox_k8s_request stop fi From 9e9cd1aa0a2680d2527b8f19964ba2aade8d29d5 Mon Sep 17 00:00:00 2001 From: Aditya Sheth Date: Thu, 19 Nov 2026 20:16:01 +0530 Subject: [PATCH 2/2] stop_sandbox: one stop in every region (region all) instead of one per label found The per-label regional stops had the same gap as the US one: a regional sandbox whose label was gone, or not in the event's labels, was never stopped. One dispatch with sandbox.yml's region `all` stops the PR's sandbox wherever it runs. Labels found are still removed. Needs the vscode sandbox.yml that accepts `all` on master first. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01GodBYdczeSv48XzK3eeCzj --- entrypoint.sh | 32 +++++++++++++------------------- 1 file changed, 13 insertions(+), 19 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index 2b0a922..bc680fa 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -65,10 +65,10 @@ ci_k8s_request() { # ci_k8s_request : start a CI k8s run of this # that already has that region's label asks for a start too (see the needs_sandbox branch). # Never fails the action. # -# A regional label (`sandbox :australia:` from needs_sandbox:ap) passes its region, the +# A regional label (`sandbox :australia:` from needs_sandbox:ap) starts in its region, the # needs_sandbox suffix (eu, ca, gov, uae, wu, ap). Which regions have a CI k8s sandbox is # sandbox.yml's own list (its region input's options): it rejects any other (HTTP 422), -# which leaves the fleet's sandbox alone. +# which leaves the fleet's sandbox alone. stop_sandbox stops in every region at once (`all`). sandbox_k8s_request() { # sandbox_k8s_request [region]: start or stop this PR's CI k8s sandbox [[ "${SANDBOX_K8S_TRIGGER:-false}" == "true" ]] || return 0 local region="${2:-}" inputs ref @@ -379,28 +379,22 @@ if [[ $comment_body == "stop_sandbox" ]]; then ;; "sandbox :eu:") remove_label "sandbox%20:eu:" - sandbox_k8s_request stop eu ;; "sandbox :maple_leaf:") remove_label "sandbox%20:maple_leaf:" - sandbox_k8s_request stop ca ;; "sandbox :classical_building:") remove_label "sandbox%20:classical_building:" - sandbox_k8s_request stop gov ;; "sandbox :united_arab_emirates:") - remove_label "sandbox%20:united_arab_emirates:" - sandbox_k8s_request stop uae - ;; + remove_label "sandbox%20:united_arab_emirates:" + ;; "sandbox :us:") - remove_label "sandbox%20:us:" - sandbox_k8s_request stop wu - ;; + remove_label "sandbox%20:us:" + ;; "sandbox :australia:") - remove_label "sandbox%20:australia:" - sandbox_k8s_request stop ap - ;; + remove_label "sandbox%20:australia:" + ;; sandbox:${alternate_python_version}) remove_label "sandbox:${alternate_python_version}" ;; @@ -427,9 +421,9 @@ if [[ $comment_body == "stop_sandbox" ]]; then ;; esac done - # The US sandbox is stopped whether or not its label is on: a sandbox can be running with - # none (the label was removed by hand after its start was asked for), and the labels read - # above are the PR's when this run was created, not when the comment was posted. A stop - # with nothing running does nothing. - sandbox_k8s_request stop + # The CI k8s sandbox is stopped in every region (sandbox.yml's region `all`), whatever labels + # were found above: a sandbox can be running with its label gone (removed by hand after its + # start was asked for), and those labels are the PR's when this run was created, not when the + # comment was posted. A region with nothing running is left as it is. + sandbox_k8s_request stop all fi