fix(commands): no tumbar la recuperación de cola por una carpeta de workspace inválida - #278
Closed
cursor[bot] wants to merge 1 commit into
Closed
Conversation
_list_workspaces includes every outputs/ subdirectory. A backup folder such as "old copy" made restore_recovery raise 422 and blocked list, resume and discard for every leftover. Co-authored-by: ignaciodelcano+dcl <ignaciodelcano+dcl@gmail.com>
This was referenced Sep 9, 2026
Owner
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resumen ejecutivo
Qué cambia
Listar, reanudar o descartar la cola de recuperación ya no falla con 422 si
outputs/contiene una subcarpeta cuyo nombre no es un workspace válido. Esa carpeta se omite; el resto de leftovers se recuperan igual.Para qué sirve
_list_workspacesincluye cualquier subdirectorio deoutputs/(no solo workspaces creados por la API). Una copia de seguridad comoold copyobackup.oldhacía querestore_recoverylevantara 422 y bloqueaba vídeo, audio e imagen.Impacto para el usuario
Tras un crash, la recuperación de cola vuelve a listar y reanudar el trabajo válido aunque exista una carpeta extra en
outputs/.Riesgo
Estado
Summary
ImageGenerationCommands.restore_recoveryiterates every name from_list_workspaces(). That helper lists every non-hidden subdirectory ofoutputs/, while_registryonly acceptsdefaultor[A-Za-z0-9][A-Za-z0-9_-]*. A folder such asold copy,backup.old, orcaféraisedHTTPException(422, invalid_workspace).GET /api/v1/jobs/recovery,POST .../resumeandPOST .../discardall callrestore_recoveryfirst, so one stray folder failed the entire recovery API — including unrelated video leftovers.Concrete trigger after #275:
outputs/old copynext to a real workspace._restore_recoverynow skips a 422 from_registryand continues with valid workspace names. Leftover rows whose ownworkspacefield is invalid were already withheld by_recovery_task.Overview
Crash leftovers stay in
DurableGenerationQueue. Recovery endpoints restore interrupted admissions from each listed workspace, then filter the queue. Invalid listed folder names are no longer a hard failure of that restore pass. Valid interrupted image admissions still project into the queue; native video leftovers still pass through the filter.Detailed changes
Backend
app/services/image_generation_commands.py:_restore_recoverycatchesHTTPException422 from_registryand continues. Other errors, including storage 503, still abort the batch so discard cannot delete unverified records.UI and Wizard
Unchanged.
Data, provenance and compatibility
No receipt or admission schema change. A leftover that belongs to a valid workspace is still recovered when a sibling
outputs/folder has an illegal name.Files and ownership
app/services/image_generation_commands.py— restore skip for invalid listed namestests/test_image_generation_commands.py— service-level invalid names + HTTP list/discard with mixed foldersIntentionally untouched: queue storage, admission writes, HTTP/MCP submit, UI Generate.
Validation
Date (UTC): 2026-09-09
Base SHA: 57c980c (
feat/shared-generation-commands)Head SHA: c4fefc5
Validation scope: focused
python scripts/verify_clean_repo.pypython -m compileall -q app/services/image_generation_commands.py→ cleanFocused Python tests:
.venv/bin/python -m pytest tests/test_image_generation_commands.py tests/test_image_command_restart_boundaries.py tests/test_task_command_admission.py tests/test_studio_image_commands.py -q→ 70 passed, 0 failedcd ui && npm run i18n:checkUI tests: N/A (backend recovery only)
cd ui && npm run lint -- --max-warnings=0cd ui && npm run buildgit diff --check(clean commit)E2E/smoke: N/A — no browser or GPU path; restore skip is covered by the focused suite
Code quality
main: pending CICI and review
CI of this HEAD: pending
Independent agent review of this HEAD: pending
Human merge click (operational, not code review): pending
Reviewed at current HEAD
Earlier review; HEAD has changed since (stale)
Pending
Unavailable
Coste de la tarea
Notes and limitations
This stacks on #275. It does not change how an individual leftover with a bad
workspacefield is withheld (_recovery_taskalready returnsFalse). Storage failures still 503 so discard cannot delete unverified records.Follow-up work
#276 and #277 remain open on this feature branch and are out of scope here.
Checklist