fix(workspace): make Pause/Resume cascade opt-in via ?cascade=true (#1991) #2120

Closed
core-be wants to merge 1 commits from fix/pause-resume-cascade-opt-in-1991 into main
Member

Fixes #1991.

Problem

POST /workspaces/:id/pause and /resume currently implicitly cascade to all descendants. This caused incident internal#722 where a single Pause call terminated 5 EC2-backed workspaces (parent + 4 children).

Fix

  • Default behavior: single-workspace scope only.
  • If descendants exist and ?cascade=true is not set, return 409 Conflict with a descendants list so the caller can decide.
  • ?cascade=true preserves the old recursive behavior.

Changes

  • Pause: checks c.Query("cascade") before stopping descendants
  • Resume: mirrors Pause cascade contract
  • Updated TestPause_WithDescendants to use ?cascade=true
  • Added 4 new tests covering 409 + 200 paths for both handlers

Acceptance criteria verified

  • Pause without cascade=true on a parent workspace returns 409 + descendants list
  • Pause?cascade=true behaves as today (returns 200 with paused_count=N)
  • Resume mirrors Pause contract
  • Test: parent-with-2-children setup; Pause(parent) without cascade returns 409; Pause(parent)?cascade=true returns 200 with paused_count=3

Test plan

cd workspace-server && go test ./internal/handlers/ -run "TestPauseHandler_|TestResumeHandler_|TestPause_WithDescendants|TestResume_" -v

All 16 tests pass.

Fixes #1991. ## Problem POST /workspaces/:id/pause and /resume currently implicitly cascade to all descendants. This caused incident internal#722 where a single Pause call terminated 5 EC2-backed workspaces (parent + 4 children). ## Fix - Default behavior: single-workspace scope only. - If descendants exist and ?cascade=true is not set, return 409 Conflict with a descendants list so the caller can decide. - ?cascade=true preserves the old recursive behavior. ## Changes - Pause: checks c.Query("cascade") before stopping descendants - Resume: mirrors Pause cascade contract - Updated TestPause_WithDescendants to use ?cascade=true - Added 4 new tests covering 409 + 200 paths for both handlers ## Acceptance criteria verified - [x] Pause without cascade=true on a parent workspace returns 409 + descendants list - [x] Pause?cascade=true behaves as today (returns 200 with paused_count=N) - [x] Resume mirrors Pause contract - [x] Test: parent-with-2-children setup; Pause(parent) without cascade returns 409; Pause(parent)?cascade=true returns 200 with paused_count=3 ## Test plan ``` cd workspace-server && go test ./internal/handlers/ -run "TestPauseHandler_|TestResumeHandler_|TestPause_WithDescendants|TestResume_" -v ``` All 16 tests pass.
core-be added 1 commit 2026-06-02 01:47:10 +00:00
fix(workspace): make Pause/Resume cascade opt-in via ?cascade=true
audit-force-merge / audit (pull_request_target) Has been skipped
ci-arm64-advisory / fast-checks (pull_request) Waiting to run
CI / Python Lint & Test (pull_request) Successful in 3s
Block internal-flavored paths / Block forbidden paths (pull_request) Successful in 6s
Harness Replays / detect-changes (pull_request) Successful in 4s
Lint forbidden tenant-env keys / Scan for repo-host token write into tenant workspace surface (pull_request) Successful in 4s
Secret scan / Scan diff for credential-shaped strings (pull_request) Successful in 5s
E2E API Smoke Test / detect-changes (pull_request) Successful in 10s
qa-review / approved (pull_request_target) Failing after 4s
Harness Replays / Harness Replays (pull_request) Successful in 1s
Lint forbidden tenant-env keys / Scan workspace_secrets writers for forbidden env keys (pull_request) Successful in 10s
security-review / approved (pull_request_target) Failing after 4s
Handlers Postgres Integration / detect-changes (pull_request) Successful in 11s
CI / Detect changes (pull_request) Successful in 13s
CI / Canvas (Next.js) (pull_request) Successful in 2s
Lint shellcheck (arm64 pilot) / shellcheck-arm64 (pilot) (pull_request) Successful in 15s
CI / Canvas Deploy Reminder (pull_request) Has been skipped
E2E Staging Canvas (Playwright) / detect-changes (pull_request) Successful in 18s
E2E Chat / detect-changes (pull_request) Successful in 18s
CI / Shellcheck (E2E scripts) (pull_request) Successful in 7s
E2E Chat / E2E Chat (pull_request) Successful in 2s
E2E Staging Canvas (Playwright) / Canvas tabs E2E (pull_request) Successful in 5s
lint-required-no-paths / lint-required-no-paths (pull_request) Successful in 56s
Handlers Postgres Integration / Handlers Postgres Integration (pull_request) Successful in 1m0s
E2E API Smoke Test / E2E API Smoke Test (pull_request) Successful in 2m6s
CI / Platform (Go) (pull_request) Successful in 5m1s
E2E Staging External Runtime / E2E Staging External Runtime (pull_request) Successful in 5m16s
CI / all-required (pull_request) Successful in 2s
sop-checklist / all-items-acked (pull_request) acked: 0/7 — missing: comprehensive-testing, local-postgres-e2e, staging-smoke, +4 — body-unfilled: comprehensive-testing, local-postgres-e2
sop-checklist / na-declarations (pull_request) N/A: (none)
sop-checklist / review-refire (pull_request_target) Has been skipped
sop-checklist / all-items-acked (pull_request_target) Successful in 7s
gate-check-v3 / gate-check (pull_request_target) Successful in 17s
sop-tier-check / tier-check (pull_request_target) Successful in 17s
a5b89524a6
POST /workspaces/:id/pause and /resume currently implicitly cascade to
all descendants. This caused incident internal#722 where a single Pause
call terminated 5 EC2-backed workspaces.

Change default behavior to single-workspace scope. If descendants exist
and cascade=true is not set, return 409 Conflict with a descendants
list so the caller can decide. ?cascade=true preserves the old
recursive behavior.

- Pause: check c.Query(\"cascade\") before stopping descendants
- Resume: mirror Pause's cascade contract
- Update TestPause_WithDescendants to use ?cascade=true
- Add 4 new tests covering 409 + 200 paths for both handlers

Fixes #1991

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
core-be closed this pull request 2026-06-02 01:53:11 +00:00
Some optional checks failed
audit-force-merge / audit (pull_request_target) Has been skipped
ci-arm64-advisory / fast-checks (pull_request) Waiting to run
CI / Python Lint & Test (pull_request) Successful in 3s
Block internal-flavored paths / Block forbidden paths (pull_request) Successful in 6s
Harness Replays / detect-changes (pull_request) Successful in 4s
Lint forbidden tenant-env keys / Scan for repo-host token write into tenant workspace surface (pull_request) Successful in 4s
Secret scan / Scan diff for credential-shaped strings (pull_request) Successful in 5s
Required
Details
E2E API Smoke Test / detect-changes (pull_request) Successful in 10s
qa-review / approved (pull_request_target) Failing after 4s
Harness Replays / Harness Replays (pull_request) Successful in 1s
Lint forbidden tenant-env keys / Scan workspace_secrets writers for forbidden env keys (pull_request) Successful in 10s
security-review / approved (pull_request_target) Failing after 4s
Handlers Postgres Integration / detect-changes (pull_request) Successful in 11s
CI / Detect changes (pull_request) Successful in 13s
CI / Canvas (Next.js) (pull_request) Successful in 2s
Lint shellcheck (arm64 pilot) / shellcheck-arm64 (pilot) (pull_request) Successful in 15s
CI / Canvas Deploy Reminder (pull_request) Has been skipped
E2E Staging Canvas (Playwright) / detect-changes (pull_request) Successful in 18s
E2E Chat / detect-changes (pull_request) Successful in 18s
CI / Shellcheck (E2E scripts) (pull_request) Successful in 7s
E2E Chat / E2E Chat (pull_request) Successful in 2s
E2E Staging Canvas (Playwright) / Canvas tabs E2E (pull_request) Successful in 5s
lint-required-no-paths / lint-required-no-paths (pull_request) Successful in 56s
Handlers Postgres Integration / Handlers Postgres Integration (pull_request) Successful in 1m0s
Required
Details
E2E API Smoke Test / E2E API Smoke Test (pull_request) Successful in 2m6s
Required
Details
CI / Platform (Go) (pull_request) Successful in 5m1s
E2E Staging External Runtime / E2E Staging External Runtime (pull_request) Successful in 5m16s
CI / all-required (pull_request) Successful in 2s
Required
Details
sop-checklist / all-items-acked (pull_request) acked: 0/7 — missing: comprehensive-testing, local-postgres-e2e, staging-smoke, +4 — body-unfilled: comprehensive-testing, local-postgres-e2
sop-checklist / na-declarations (pull_request) N/A: (none)
sop-checklist / review-refire (pull_request_target) Has been skipped
sop-checklist / all-items-acked (pull_request_target) Successful in 7s
gate-check-v3 / gate-check (pull_request_target) Successful in 17s
sop-tier-check / tier-check (pull_request_target) Successful in 17s

Pull request closed

Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: molecule-ai/molecule-core#2120