feat: pull worker image on demand at spawn, with SSE progress (closes #38) #41
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/worker-image-pull"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Lets the operator obtain a worker image from the registry during workspace creation — choosing from a bundled catalog of official images or a custom tag — with live pull progress, without leaving the create form. Closes #38 (follow-up to #37, which decoupled onboarding from the worker image).
Approach: pre-pull, then unchanged spawn. A dedicated SSE endpoint pulls + streams progress; the transactional
spawnWorkerand its allowlist validation are left completely untouched. No new worker status, no async/background spawn, no reconcile-loop changes.Flow
NewWorkerCreate → if the chosen tag isn't local, openEventSource('/api/worker-images/pull?tag=…')→ render progress → ondone, call the existingPOST /api/workers. Any pull failure creates no worker row.What's new
pullWorkerImageasync generator (image-pull.ts) — present? →org.nexus.workerlabel check →docker.pull+followProgress→ re-check label. Aborts the pull stream on client disconnect. 6 unit tests.GET /api/worker-images/pull?tag=…(text/event-stream); auth is the global/api/*hook, no extra gate.OFFICIAL_WORKER_IMAGES(Base + Playwright), registry-qualified.pull.tsbrowserEventSourcewrapper;PullProgress.svelteprogress bar.NewWorker.svelte: "Use existing / Pull a new image" mode, catalog + custom-tag, pull-before-spawn.image-tag.ts: shared tag regex extracted from the settings validator.Guarantees by construction
doneif it carriesorg.nexus.worker=true— the exact filterlistWorkerImages/ spawn validation use — so a pulled image always passes the existing allowlist.pullingstatus were explicitly scoped out.Design spec + plan included under
docs/superpowers/.Test Plan
pnpm test— 550 pass (incl. new image-tag / image-pull / worker-images suites)pnpm typecheck— 0 errorspnpm lint— cleanpnpm build— successlz referenced this pull request2026-09-21 20:39:07 +02:00