workspace: stop worker before cleanup delete
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
---
|
||||
title: 'Stop Worker before cleanup deletion'
|
||||
state: 'inprogress'
|
||||
state: 'done'
|
||||
created_at: '2026-07-13T13:58:15Z'
|
||||
updated_at: '2026-07-13T13:58:54Z'
|
||||
updated_at: '2026-07-13T14:05:35Z'
|
||||
assignee: null
|
||||
queued_by: 'yoi ticket'
|
||||
queued_at: '2026-07-13T13:58:54Z'
|
||||
|
||||
@@ -39,4 +39,45 @@ Ticket を `yoi ticket` が queued にしました。
|
||||
State changed to `inprogress`.
|
||||
|
||||
|
||||
---
|
||||
|
||||
<!-- event: implementation_report author: hare at: 2026-07-13T14:05:35Z -->
|
||||
|
||||
## Implementation report
|
||||
|
||||
Changed Worker cleanup execution to stop the selected Worker before Runtime deletion.
|
||||
|
||||
Root cause:
|
||||
- Runtime `delete_worker` rejects active Workers with `worker <id> is running and must be stopped before deletion`.
|
||||
- The cleanup plan can present a Worker as cleanup-eligible when the browser-facing projected state is not `running` (for example execution rejected/unconnected) while Runtime status is still active.
|
||||
- Cleanup execution previously called Runtime delete directly, causing `workspace_cleanup_worker_runtime_delete_rejected`.
|
||||
|
||||
Changes:
|
||||
- `cleanup_runtime_worker_for_execution` now calls `stop_worker` first with a cleanup reason.
|
||||
- If stop is rejected, the cleanup fails with `workspace_cleanup_worker_runtime_stop_rejected` and preserves Runtime diagnostics.
|
||||
- Only after accepted stop does cleanup call Runtime delete and then delete the Backend registry row.
|
||||
- Unknown-worker during stop/delete remains idempotent for stale Backend registry cleanup.
|
||||
|
||||
Manual observation:
|
||||
- Direct Runtime DELETE for worker 1 returned HTTP 400: `worker 1 is running and must be stopped before deletion`.
|
||||
- Direct Runtime stop followed by delete succeeded, confirming the required operation sequence.
|
||||
|
||||
Validation:
|
||||
- `cargo fmt --check`
|
||||
- `git diff --check`
|
||||
- `cargo check -q`
|
||||
- `cargo test -q -p yoi-workspace-server`
|
||||
- targeted cleanup execution test
|
||||
- `nix build .#yoi --no-link`
|
||||
|
||||
|
||||
---
|
||||
|
||||
<!-- event: state_changed author: "yoi ticket" at: 2026-07-13T14:05:35Z from: inprogress to: done reason: cli_state field: state -->
|
||||
|
||||
## State changed
|
||||
|
||||
State changed to `done`.
|
||||
|
||||
|
||||
---
|
||||
|
||||
Reference in New Issue
Block a user