plugin: the agent-output readers crash on a JSON line that is not an object
Los mantenedores suelen responder en 1 día
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 25/100
Línea de trabajo
Read plugin/probe.py (run_session and inspect_session), plugin/sidecall.py (codex_call and copilot_call), and plugin/toolcheck.py (_init_tools); the report names each affected reader and the failure case. Check the regression tests mentioned in the linked pull request, then confirm malformed or non-object JSON lines are skipped while valid events still work. Pull request #183 is already open.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
What happens
Five readers of agent CLI output parse each line with json.loads and then call .get on the result, without the isinstance(ev, dict) check — the same gap #150 closed for the trace readers (and #181 for the cursor pair):
plugin/probe.pyrun_session— Copilot-p --output-format jsonstdout:ev.get("type")plugin/probe.pyinspect_session— Copilot's ownevents.jsonl:json.loads(line).get("data")(this one also has noexcept ValueError, so a partially-written or corrupt line containing"hook.end"crashes before.getis even reached)plugin/sidecall.pycodex_call—codex exec --jsonstdout:ev.get("item")plugin/sidecall.pycopilot_call— Copilot-pstdout:ev.get("type")plugin/toolcheck.py_init_tools—claude -p --output-format stream-jsonstdout:ev.get("type")
A line that is valid JSON but not an object (null, 42, "text", [1, 2]) — or, for inspect_session, any line with the "hook.end" prefilter that does not parse — raises and kills the whole probe / side call / tool check, instead of skipping the one line.
These are external-process streams, same exposure as the transcripts #150 hardened: anything the CLI or a tool it spawns writes to inherited stdout lands line-shaped in these loops.
Repro
>>> # sidecall.codex_call with a stubbed runner whose stdout is:
"null\n{\"type\":\"item.completed\",\"item\":{\"type\":\"agent_message\",\"text\":\"hi\"}}\n"
AttributeError: 'NoneType' object has no attribute 'get'
Fix
The same one-line isinstance(ev, dict) guard after json.loads in the four loops, plus the ValueError catch in inspect_session. I have it with regression tests ready and will open the PR.
- Lenguaje dominante
- Python
- Estrellas
- 5.6k
- Forks
- 344
- Merge medio
- 14 h 41 min
- PR fusionados (30 d)
- 54
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/TokenEconomizer
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 35/100
microsoft/TokenEconomizer#193 ·
Los mantenedores suelen responder en 1 día
-
pricing: Claude's 1-hour cache writes are priced at 1.25x, but billed at 2xPosiblemente ocupada @anascherif la tomó hoy. Abierto
Dificultad 3/5 1-2 días Aptitud para principiantes 25/100
microsoft/TokenEconomizer#191 ·
Los mantenedores suelen responder en 1 día
-
trace: Claude Code's `<synthetic>` notices count as requests and can make a Claude session price on the fallback curvePosiblemente ocupada @1AbdullahButt la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 20/100
microsoft/TokenEconomizer#189 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 20/100
microsoft/TokenEconomizer#186 ·
Los mantenedores suelen responder en 1 día
-
trace: the cursor readers crash on a JSON line that is not an objectPosiblemente ocupada @rahul05ranjan la tomó hace 1 día. Abierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 25/100
microsoft/TokenEconomizer#180 ·
Los mantenedores suelen responder en 1 día
Todos los issues de microsoft/TokenEconomizer
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
Los mantenedores suelen responder en 1 día
-
Treat corrupt-shape state files as missing in `load_state`Posiblemente ocupada @Qrytics la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
OvertureMaps/overturemaps-py#175 ·
Los mantenedores suelen responder en 1 día
-
enhancement
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 83/100
awslabs/visual-asset-management-system#1278 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
aws-samples/sample-per-model-bedrock#835 ·
Los mantenedores suelen responder en 1 día