Gateway loses model-request events for malformed or non-object upstream JSON
Los mantenedores suelen responder en 2 días
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 20/100
Línea de trabajo
Read agentlightning.server.proxy.forward_request and the existing endpoint cases in tests/server/test_proxy_response.py and tests/server/test_endpoints.py. Start by reproducing the malformed JSON and non-object response cases using the offline setup described in the issue. Done means these responses return a gateway error, record a model-request event, preserve upstream HTTP error statuses, and release the in-flight counter; linked PR #658 is already open.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Problem
On main at 05c7fe133175653e48c990546a3509e52dc56512, forward_request assumes the upstream response is a JSON object:
- malformed JSON with
Content-Type: application/jsonraises duringresponse.json(); - JSON arrays, strings, numbers and
nullreach_pop_routed_expertsand fail before_capture_event; - a non-JSON HTTP 200 response becomes
{}and is recorded as a successful model request.
The first two paths lose the model-request event, making a failed rollout harder to diagnose.
Offline reproduction
Replace agentlightning.server.proxy._send_upstream_with_retries with an async function returning httpx.Response(200, text="null", headers={"content-type": "application/json"}). Register a rollout and model, then POST a normal chat-completion request through the gateway. The request raises instead of returning a gateway error, and no model-request event is recorded. A response containing { reproduces the JSON parsing failure; HTTP 200 with HTML reproduces the empty successful response.
Proposed scope
I have a focused local patch and eight endpoint regression cases. The patch returns a structured upstream-response error for malformed/non-object/non-JSON responses, maps invalid responses below HTTP 400 to 502, and preserves existing upstream HTTP error statuses. It records the error and retry count and releases the in-flight counter. Valid object responses keep their current path.
Would this error/status contract be appropriate for a PR?
Validation
Windows, Python 3.12.14; FastAPI 0.162.0, HTTPX 0.28.1, pytest 9.1.1. Dependencies were installed from the declared ranges, not the frozen lockfile. No model calls or GPU use.
- Eight new cases: 8 failed before the patch.
python -m pytest -q tests/server/test_proxy_response.py tests/server/test_endpoints.py tests/test_client.py --tb=short: 51 passed after the patch.- Server/controller/examples/client tests: patched 101 passed, 9 failed; unchanged upstream 93 passed, the same 9 failed. These failures reference POSIX
os.killpg, unavailable on Windows. - Ruff lint/format and
git diff --check: passed.
I searched open PRs for upstream JSON response handling and non-JSON handling. #587 concerns request bodies; #574 concerns stored triplet export. Neither handles this response-ingestion path. AI assistance was used for investigation, the local patch and test execution.
- Lenguaje dominante
- Python
- Estrellas
- 18.8k
- Forks
- 1.7k
- Merge medio
- 3 d 13 h
- PR fusionados (30 d)
- 10
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
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de microsoft/agent-lightning
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
microsoft/agent-lightning#661 ·
Los mantenedores suelen responder en 2 días
-
RayPPOTrainer._dump_generations() missing gts argument in _train_step callPosiblemente ocupada @yunkai-yyk la tomó hace 252 días. Abiertobug v0.x verl
Dificultad 1/5 Menos de una hora Aptitud para principiantes 68/100
microsoft/agent-lightning#492 ·
Los mantenedores suelen responder en 2 días
-
enhancement store v0.x
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
microsoft/agent-lightning#372 · 10 comentarios ·
Los mantenedores suelen responder en 2 días
-
Terminal rollout projection drops numeric dataset ID zeroPosiblemente ocupada @notoufa la tomó hace 2 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 45/100
microsoft/agent-lightning#659 ·
Los mantenedores suelen responder en 2 días
-
Dificultad 3/5 1-2 días Aptitud para principiantes 48/100
microsoft/agent-lightning#650 · 1 comentario ·
Los mantenedores suelen responder en 2 días
Todos los issues de microsoft/agent-lightning
Issues similares
-
Context/namespace resources fail in-cluster: "Invalid kube-config file. No configuration found."Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
-
bug documentation
Dificultad 1/5 Menos de una hora Aptitud para principiantes 88/100
awslabs/visual-asset-management-system#880 ·
Los mantenedores suelen responder en 1 día
-
netbox status: needs owner type: documentation
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
netbox-community/netbox#23533 ·
Los mantenedores suelen responder en 1 día
-
app: scripts status: backlog type: documentation
Dificultad 2/5 1-3 horas Aptitud para principiantes 86/100
netbox-community/netbox-scripts#68 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 91/100
marin-community/marin#10765 ·
Los mantenedores suelen responder en 1 día