Handle stale workspaces: 409 conflict auto-cleanup + verbose logging
Publish Image / publish (push) Successful in 20s

When the orchestrator restarts, it loses in-memory queue state. If a
stale workspace still exists, createWorkspace now auto-deletes it and
retries instead of failing with 409. Also adds --verbose to Claude Code
invocation for better task log debugging.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Daniel Samson
2026-04-12 13:58:08 +01:00
co-authored by Claude Opus 4.6
parent 4f1d306fdf
commit 06cf4d1b9e
2 changed files with 16 additions and 2 deletions
+12
View File
@@ -50,6 +50,18 @@ export class CoderClient {
},
);
// Handle 409 conflict — stale workspace from a previous orchestrator instance
if (res.status === 409) {
console.log(`[coder] workspace "${name}" already exists — deleting stale workspace and retrying`);
const existing = await this.findWorkspaceByName(name);
if (existing) {
await this.deleteWorkspace(existing.id);
// Wait for deletion to propagate
await new Promise((resolve) => setTimeout(resolve, 5000));
}
return this.createWorkspace(task);
}
if (!res.ok) {
const text = await res.text();
throw new Error(`Coder API error ${res.status}: ${text}`);