Centralize workspace runtime lifecycle#228
Conversation
Runtime launch, tmux ownership recording, missing-session cleanup, stop fallback, and delete-time stopping were split across server handlers and workspace internals. This creates a small lifecycle coordinator so callers ask for runtime transitions instead of reimplementing process-plus-persistence choreography. The result gives launch, stop, missing-session reconciliation, and workspace delete the same durable cleanup rules from one module, reducing handler branching and keeping future workspace runtime changes behind a single API. Validation: go test ./internal/workspace -run TestRuntimeLifecycle -shuffle=on; go test ./internal/server -run 'TestWorkspaceRuntime|TestWorkspaceDelete' -shuffle=on; go test ./internal/workspace -shuffle=on; git diff --cached --check. Full go test ./internal/workspace ./internal/server -shuffle=on was attempted earlier and hit unrelated host process pressure in tmux process-leak stress coverage. Co-authored-by: OpenAI Codex <noreply@openai.com>
roborev: Combined Review (
|
Roborev caught that the lifecycle refactor made workspace deletion return 503 when runtime lifecycle support was absent. Preserve the previous behavior by falling back to workspace deletion without a runtime stop step when no lifecycle coordinator is configured. Validation: go test ./internal/server -run 'TestWorkspaceDelete(FallsBackWhenRuntimeLifecycleNilE2E|StopsRuntimeSessionsE2E|DirtyKeepsRuntimeSessionsE2E)' -shuffle=on; git diff --check. Co-authored-by: OpenAI Codex <noreply@openai.com>
roborev: Combined Review (
|
The delete fallback for servers without RuntimeLifecycle now keeps the legacy stopping marker and StopWorkspace hook when a runtime manager exists. This avoids deleting workspace records while shell or agent sessions keep running.
roborev: Combined Review (
|
The retry-ready test now checks that no second setup attempt is recorded instead of racing on total setup-event count, and runtime delete tests wait for launched sessions to be observable before deleting.
roborev: Combined Review (
|
Summary
How this makes the code better