orchestrate: report the cause of a Codex failure in dispatch.json, with the reset time of a usage limit

Abierto
#77 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
56/100
Tipo de issue
Nueva funcionalidad
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
python
Área
backend, testing

Línea de trabajo

Start with shared/dev-team/skills/orchestrate/scripts/launch_role.py near the reasons collection, then read tests/test_launch_role.py and the exit status section of references/cross-host.md. Add tests for parsed failure events, both usage limit time formats, and a successful run whose spec mentions the phrase. Done when dispatch.json reports the correct cause and error, includes the expected retry_at for usage limits, and the docs explain the action for each cause.

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

Descripción

next

Problem

When codex exec fails, launch_role.py writes the same two reasons to dispatch.json for each cause:

"reasons": ["codex exit status is 1; see <dispatch>/errors.log", "the report is missing or empty"]

The cause is only in events.jsonl. The orchestrator must find it by hand. On 2026-12-01 (plugin 0.12.2 at b41262e, Codex CLI 0.172.0), one session had 19 Codex dispatches. Three failed, with two different causes:

  • Usage limit (two dispatches). The last two lines of events.jsonl:
    {"type":"error","message":"You’ve hit your usage limit. Upgrade to Pro (https://chatgpt.com/explore/pro), visit https://chatgpt.com/settings/usage to purchase more credits or try again at Dec 1st, 2026 12:50 AM."}
    {"type":"turn.failed","error":{"message":"You’ve hit your usage limit. ... try again at Dec 1st, 2026 12:50 AM."}}
    
    The other dispatch gave only a time of day: try again at 7:48 PM. The message gives no time zone. In this session the times were UTC.
  • Output limit (one dispatch; see #78, about the output size of one command):
    {"type":"error","message":"Incomplete response returned, reason: max_output_tokens"}
    {"type":"turn.failed","error":{"message":"Incomplete response returned, reason: max_output_tokens"}}
    

Each cause needs a different action. For a usage limit, wait until the reset, then launch again with a "state at this launch" note in the spec. For an output limit, launch again at once with a smaller-step instruction. The orchestrator searched events.jsonl with grep 'usage limit'. That search also matched the handoff spec, which events.jsonl echoes, and the spec quoted the words "usage limit". The result was a false alarm. The orchestrator then put a sleep until the reset in a background command, and launched again by hand.

Proposed change

In shared/dev-team/skills/orchestrate/scripts/launch_role.py, near the reasons collection (grep -n 'exit status is' launch_role.py):

  1. For --host codex with a non-zero exit status, read the last event with "type":"turn.failed" (or else the last "type":"error") from events.jsonl. Parse each line as JSON. Do not use a text search of the file, because the file contains the spec.
  2. Add a field cause to dispatch.json: usage_limit, max_output_tokens or other. Copy the error message into a field error.
  3. For usage_limit, parse the time after try again at into retry_at, an ISO 8601 UTC timestamp. Accept both forms: with a date (Dec 1st, 2026 12:50 AM) and with a time only (7:48 PM; use the next occurrence of that time). If the parse fails, set retry_at to null and keep error.
  4. Optional: a flag --wait-for-reset. On usage_limit, the launcher sleeps until retry_at plus about two minutes. Then it launches again, with the same arguments, into <output-dir>-retry<N>. Leave a limit on the number of retries.
  5. Document the new fields in references/cross-host.md ("Exit status": grep -n 'The launcher gives exit status 1' cross-host.md). Tell the orchestrator what to do for each cause.

Tests

In tests/test_launch_role.py, use a fake codex that writes each of the three events.jsonl endings above and exits 1. Check cause, error and retry_at for both time forms. Include a case where the spec text contains "usage limit" and the run succeeds: cause must be absent.

Notes

  • Do the edits in shared/. Then run python3 scripts/build.py, because plugins/ is generated.
  • This repository requires an independent review of each change to agent behavior (AGENTS.md).
Lenguaje dominante
Python
Estrellas
0
Forks
0
Merge medio
29 min
PR fusionados (30 d)
57

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 j3ko/agent-plugins

Todos los issues de j3ko/agent-plugins

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.