orchestrate: report the cause of a Codex failure in dispatch.json, with the reset time of a usage limit
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 56/100
Research direction
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.
Written by the indexing model from the issue text.
Description
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:
The other dispatch gave only a time of day:{"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."}}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):
- For
--host codexwith a non-zero exit status, read the last event with"type":"turn.failed"(or else the last"type":"error") fromevents.jsonl. Parse each line as JSON. Do not use a text search of the file, because the file contains the spec. - Add a field
causetodispatch.json:usage_limit,max_output_tokensorother. Copy the error message into a fielderror. - For
usage_limit, parse the time aftertry again atintoretry_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, setretry_atto null and keeperror. - Optional: a flag
--wait-for-reset. Onusage_limit, the launcher sleeps untilretry_atplus about two minutes. Then it launches again, with the same arguments, into<output-dir>-retry<N>. Leave a limit on the number of retries. - 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 eachcause.
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 runpython3 scripts/build.py, becauseplugins/is generated. - This repository requires an independent review of each change to agent behavior (
AGENTS.md).
- Dominant language
- Python
- Stars
- 0
- Forks
- 0
- Avg merge
- 29m
- Merged PRs (30d)
- 57
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from j3ko/agent-plugins
-
next
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
j3ko/agent-plugins#80 ·
Maintainers usually reply within 1 day
-
next
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
j3ko/agent-plugins#79 ·
Maintainers usually reply within 1 day
-
roles: cut the start-up reading of a Codex role (bootstrap lines, fix-up Read section, setup step)Opennext
Difficulty 4/5 3-5 days Newbie friendliness 45/100
j3ko/agent-plugins#81 ·
Maintainers usually reply within 1 day
-
next
Difficulty 3/5 1-2 days Newbie friendliness 68/100
j3ko/agent-plugins#78 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 55/100
j3ko/agent-plugins#76 ·
Maintainers usually reply within 1 day
All issues in j3ko/agent-plugins
Similar issues
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
jxxghp/MoviePilot#7699 ·
Maintainers usually reply within 1 day
-
bug TAG: unit tests
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
learningequality/ricecooker#898 ·
-
bug:unconfirmed
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Heroic-Games-Launcher/HeroicGamesLauncher#6187 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 1-3 hours Newbie friendliness 82/100
BCStudentSoftwareDevTeam/cas#491 ·
Maintainers usually reply within 8 days
-
task
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
freelawproject/litigant-portal#1285 ·
Maintainers usually reply within 2 days