fix(dashboard): start-llama diagnostics + comfy/queue no longer 500s #7

Merged
mikan merged 1 commits from fix/dashboard-apply-and-queue into master 2026-10-24 01:09:18 +00:00
Collaborator

Две проблемы из фидбэка

Problem 1: Apply doesn't change model

Юзер сообщает: «выберу в панели моделей — показывается что новая модель — но по факту по логам видно что все так же модель по умолчанию».

Самая вероятная причина — model-worker на проде стоит старый image без --json флага, или в request body не приходит новое имя модели.

Этот PR добавляет чисто диагностический вывод, чтобы увидеть что реально происходит:

  • startLlama() теперь пишет в console:
    • [startLlama] model:
    • [startLlama] extraArgs:
    • [startLlama] compose exit:
    • [startLlama] compose output:
  • /api/llama POST пишет:
    • [/api/llama] action: config.model:
    • [/api/llama] merged cfg.model:
    • [/api/llama] startLlama result ok:
  • handleStartLlama() теперь включает последние 500 символов compose логов в toast если start failed.
  • Toast теперь max-w-md и поддерживает multi-line (renders as
    ).

После деплоя запусти docker logs -f gpu-node-win-dashboard пока кликаешь Start Llama — увидишь точно какое имя модели отправляется и что compose выводит.

Problem 2: /api/comfy/queue returns 500 every 5s

Юзер сообщает: «по логам вижу что там какие то проблемы с queue — 500 Internal Server Error каждые 5 сек, даже когда ничего не грузил».

Root cause: model-worker image на проде старый и не поддерживает queue --json (флаг добавлен в PR #5).

Fixes:

  • /api/comfy/queue больше не возвращает 500 на worker failure. Всегда 200 с { ok: false, queue: [], error: }.
  • modelWorkerExec() теперь логирует failures в console.error с args/container/exitCode/stderr.

После деплоя

git pull && sh build.sh
docker compose up -d --force-recreate dashboard model-worker

Если model-worker на старом image (без --json support), в dashboard логах будет видно:

[modelWorkerExec] args=["queue","--json"] container=gpu-node-win-model-worker exitCode=1 stderr=Usage: ... worker.py queue [--watch] [--clear] ...

Решение — пересоздать model-worker:

docker compose up -d --force-recreate model-worker

Verification

  • npm run build — OK, все 19 роутов
  • bash dashboard/validate-build.sh — все 8 COPY источников ✓, standalone ✓
## Две проблемы из фидбэка ### Problem 1: Apply doesn't change model Юзер сообщает: «выберу в панели моделей — показывается что новая модель — но по факту по логам видно что все так же модель по умолчанию». Самая вероятная причина — model-worker на проде стоит старый image без --json флага, или в request body не приходит новое имя модели. Этот PR добавляет чисто диагностический вывод, чтобы увидеть что реально происходит: - startLlama() теперь пишет в console: - [startLlama] model: <name> - [startLlama] extraArgs: <args> - [startLlama] compose exit: <code> - [startLlama] compose output: <full docker compose output> - /api/llama POST пишет: - [/api/llama] action: <action> config.model: <name> - [/api/llama] merged cfg.model: <name> - [/api/llama] startLlama result ok: <bool> - handleStartLlama() теперь включает последние 500 символов compose логов в toast если start failed. - Toast теперь max-w-md и поддерживает multi-line (renders as <pre>). После деплоя запусти docker logs -f gpu-node-win-dashboard пока кликаешь Start Llama — увидишь точно какое имя модели отправляется и что compose выводит. ### Problem 2: /api/comfy/queue returns 500 every 5s Юзер сообщает: «по логам вижу что там какие то проблемы с queue — 500 Internal Server Error каждые 5 сек, даже когда ничего не грузил». Root cause: model-worker image на проде старый и не поддерживает queue --json (флаг добавлен в PR #5). Fixes: - /api/comfy/queue больше не возвращает 500 на worker failure. Всегда 200 с { ok: false, queue: [], error: <reason> }. - modelWorkerExec() теперь логирует failures в console.error с args/container/exitCode/stderr. ## После деплоя git pull && sh build.sh docker compose up -d --force-recreate dashboard model-worker Если model-worker на старом image (без --json support), в dashboard логах будет видно: [modelWorkerExec] args=["queue","--json"] container=gpu-node-win-model-worker exitCode=1 stderr=Usage: ... worker.py queue [--watch] [--clear] ... Решение — пересоздать model-worker: docker compose up -d --force-recreate model-worker ## Verification - npm run build — OK, все 19 роутов - bash dashboard/validate-build.sh — все 8 COPY источников ✓, standalone ✓
super-z-bot added 1 commit 2026-10-24 01:08:21 +00:00
## Two issues from user feedback

### Issue 1: Apply doesn't change model

User reports: 'if I select a model in the panel, it shows as the new model
but logs show the default model is still running'.

Most likely cause: the user has an old model-worker image without the
`--json` flag, OR the request body isn't including the new model name.

The fix here is purely diagnostic — add logging so we can see what's
happening:

- `startLlama()` now logs to console:
  * `[startLlama] model: <name>`
  * `[startLlama] extraArgs: <args>`
  * `[startLlama] compose exit: <code>`
  * `[startLlama] compose output: <full docker compose output>`

- `/api/llama` POST logs:
  * `[/api/llama] action: <action> config.model: <name>`
  * `[/api/llama] merged cfg.model: <name>`
  * `[/api/llama] startLlama result ok: <bool>`

- `handleStartLlama()` now includes the last 500 chars of compose logs
  in the toast message if start failed. Toast component renders multi-line
  messages as `<pre>` so the logs are readable.

- Toast now uses `max-w-md` (was `max-w-sm`) and supports multi-line
  content with `whitespace-pre-wrap`.

After deploying, run `docker logs -f gpu-node-win-dashboard` while
clicking Start Llama — you'll see exactly what model name is being sent
and what docker compose outputs.

### Issue 2: /api/comfy/queue returns 500 every 5s

User reports: 'in logs I see problems with queue — 500 Internal Server
Error'. Even when not downloading anything.

Most likely cause: model-worker image on prod is old and doesn't support
`queue --json` flag (added in PR #5). When `modelWorkerExec('queue',
'--json')` fails with non-zero exit code, `getComfyQueue()` returns
`ok: false`, and the endpoint returns 500. Frontend polls every 5s, so
we get a flood of 500s.

Fixes:

- `/api/comfy/queue` no longer returns 500 on worker failure. Always
  returns 200 with `{ ok: false, queue: [], error: <reason> }` —
  frontend shows empty queue, no error toast.

- `modelWorkerExec()` now logs failures to console.error with:
  * args being called
  * container name
  * exit code
  * stderr (truncated to 500 chars)

  This will show up in `docker logs gpu-node-win-dashboard` so we can
  see if it's a missing --json flag, container not running, etc.

## After deploying

```sh
git pull && sh build.sh
docker compose up -d --force-recreate dashboard model-worker
```

If model-worker is on old image (no --json support), the dashboard logs
will show:

  [modelWorkerExec] args=["queue","--json"] container=gpu-node-win-model-worker
  exitCode=1 stderr=Usage: ... worker.py queue [--watch] [--clear] ...

Recreate model-worker to pick up the new image:

  docker compose up -d --force-recreate model-worker

## Files changed

- dashboard/src/lib/docker.ts:
  * startLlama() now logs model + extraArgs + compose output
  * modelWorkerExec() now logs failures with exit code + stderr
- dashboard/src/app/api/llama/route.ts: logs action + model + result
- dashboard/src/app/api/comfy/queue/route.ts: returns 200 even on failure
- dashboard/src/app/page.tsx:
  * handleStartLlama includes compose logs in toast on failure
  * Toast component supports multi-line messages (renders as <pre>)
mikan merged commit 201f4266b2 into master 2026-10-24 01:09:18 +00:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: mikan/GPU-Node#7