Skip to content

stop_sandbox stops the CI k8s sandbox in every region, whatever labels the PR has (ENG-227126) - #41

Merged
asheth-eightfold merged 2 commits into
masterfrom
fix/asheth/eng-227126
Nov 20, 2026
Merged

asheth-eightfold merged 2 commits into
masterfrom
fix/asheth/eng-227126

Conversation

@asheth-eightfold

@asheth-eightfold asheth-eightfold commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Problem

stop_sandbox sent a sandbox.yml stop only for each sandbox label it found in the event payload, one stop per labelled region. A sandbox can be running with its label gone, and then no stop is sent at all: no reply, and the sandbox runs to its time limit. This happens in two ways:

  • The label is removed by hand after the start was requested.
  • The label is removed between the comment and the run's creation: the payload's label list is a snapshot taken when the run is created, not when the comment was posted.

Fix

On stop_sandbox:

  • Every sandbox label found is removed, as before.
  • Then one dispatch with region: all, whatever labels were found. sandbox.yml stops the PR's sandbox in every region with a CI k8s cluster; a region with nothing running is left as it is.
  • The per-label regional stops are gone.
  • needs_sandbox is unchanged.

Merge order

Merge only after the vscode change that adds all to sandbox.yml's region input is on master. Until then sandbox.yml rejects all (HTTP 422) and stop_sandbox would stop nothing. Rollback: revert this PR first.

Test

Ran entrypoint.sh locally with a stubbed curl and synthetic events:

Case Calls
stop_sandbox, no sandbox label stop all
stop_sandbox, sandbox remove sandbox; stop all
stop_sandbox, sandbox :eu: + sandbox :australia: + sandbox :united_arab_emirates: remove the 3 labels; one stop all
stop_sandbox, sandbox:3.13 remove it; stop all
stop_sandbox, SANDBOX_K8S_TRIGGER off remove sandbox only
needs_sandbox:eu add sandbox :eu:; start eu (unchanged)
needs_sandbox with sandbox on start (unchanged)

🤖 Generated with Claude Code

https://claude.ai/code/session_01GodBYdczeSv48XzK3eeCzj

…l (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 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GodBYdczeSv48XzK3eeCzj
@github-actions

Copy link
Copy Markdown

Dependency Review

✅ No vulnerabilities or license issues found.

Scanned Files

None

…r 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 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GodBYdczeSv48XzK3eeCzj
@asheth-eightfold asheth-eightfold changed the title Stop the CI k8s sandbox on stop_sandbox even without the sandbox label (ENG-227126) stop_sandbox stops the CI k8s sandbox in every region, whatever labels the PR has (ENG-227126) Nov 19, 2026
@asheth-eightfold
asheth-eightfold merged commit 0f81170 into master Nov 20, 2026
2 checks passed
asheth-eightfold added a commit that referenced this pull request Nov 20, 2026
Conflicts in entrypoint.sh against #39 (start on needs_sandbox also when the label is on) and
#41 (stop_sandbox stops every region). Took master's structure and added dev to it:
- needs_sandbox:dev picks `sandbox 🧪` / region dev in master's wanted_label chain, so
  it gets #39's behaviour too;
- stop_sandbox removes `sandbox 🧪`; master's `stop all` already stops dev.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

2 participants