[GUI] apps/host tests: startHost readiness fetch has no timeout, so a stuck host hangs the run

Abierto Apto para principiantes
#5,577 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 4 días

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
1/5
Tiempo estimado
Menos de una hora
Aptitud para principiantes
88/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
javascript, node.js
Área
testing

Línea de trabajo

Lee apps/host/tests/agent-host.test.mjs alrededor de startHost() y compara sus comprobaciones de disponibilidad con las solicitudes fetch con límite de tiempo de tests/host-lifecycle.test.mjs y tests/app-ui.test.mjs. Añade un timeout a cada solicitud fetch de disponibilidad para que los intentos fallidos lleguen al catch y al bucle de reintento existentes. Se considera terminado cuando un host que no responde ya no bloquea la consulta de disponibilidad y la prueba muestra el registro del host si falla.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

Area

[GUI] (the desktop app)

Desktop app, Terminal or source?

Source (START-HERE.bat, setup.sh or a build)

What happened

startHost() in apps/host/tests/agent-host.test.mjs waits for the spawned host with up to 100 attempts of fetch() and 200 ms sleeps, but the fetch() has no timeout (agent-host.test.mjs:43 in v0.2.12):

for (let i = 0; i < 100; i++) {
  try { if ((await fetch(`${base}/api/agent/status`)).ok) break; } catch { /* not up yet */ }
  if (child.exitCode !== null) throw new Error(`the host exited: ${log.slice(-500)}`);
  await sleep(200);
}

Node's fetch (undici) has no short default timeout — headersTimeout is 300 s — so a host that accepts the TCP connection but never answers /api/agent/status (a deadlock, a paused process) keeps the await pending for minutes. Neither the 20 s loop budget nor the child.exitCode check can run during that time, so instead of failing with the collected log the run hangs and the failure is reported by the test runner's global timeout, without the host's own output.

Other tests in the same folder already bound their probes: tests/host-lifecycle.test.mjs:87 uses AbortSignal.timeout(1500) and tests/app-ui.test.mjs:124 uses AbortSignal.timeout(2000). The catch in this loop already swallows a rejected fetch, so an aborted attempt would simply count as "not up yet".

Expected: each readiness attempt ends within a bounded time, and a host that never answers fails the test with its log instead of hanging the suite.

Suggested fix: fetch(url, { signal: AbortSignal.timeout(2000) }) in the loop (or Promise.race with a timer). No other change is needed: the abort lands in the existing catch.

Smallest steps or command that reproduce it

Not observed; this is from reading the code. To confirm it, start a fake server that accepts connections on the host's port and never responds, point startHost() at it (or pause the host process after it binds), and run one test: the for loop stays in the first await fetch instead of reaching the 100th iteration after about 20 s.

Reproduction status

Unconfirmed static analysis (I read code or ran a scanner; I did not see it fail)

Strata version

Strata 0.2.12 (tag v0.2.12, commit 123bad4a) · engine 0.1.58

Graphics card, memory and system

RTX 4090 24 GB · 253 GB RAM · Intel Core Ultra 9 285K · Windows 11 25H2 (build 26200.8655) · Node 25.9.0

Lenguaje dominante
C++
Estrellas
11.6k
Forks
1k
Métricas de merge de PR
Sin PR fusionados en 30 d

Preparar el entorno

Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de Niko1221/Strata

Todos los issues de Niko1221/Strata

Issues similares

Más issues de C++

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.