ImageGen generate-batch aborts valid JSONL jobs containing a Unicode line separator in poster text
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 78/100
Research direction
The bug lives in the batch loader of codex-rs/skills/src/assets/samples/imagegen/scripts/image_gen.py, around line 464, where the whole UTF-8 input is split with str.splitlines(), which breaks on U+2028 inside JSON strings. Reproduce with the dry-run commands in the issue using a literal U+2028 versus its \u2028 escape. Done when the literal-character file lists the same two jobs as the escaped one, with the poster text preserved verbatim.
Written by the indexing model from the issue text.
Description
One literal U+2028 LINE SEPARATOR in a poster's text makes generate-batch reject the entire UTF-8 JSONL input before processing any jobs. Escaping the same character as \u2028 allows both jobs to proceed with identical decoded text. This affects producers that emit UTF-8 directly, including Python's json.dumps(..., ensure_ascii=False).
Steps to reproduce From the Codex checkout at de83e7674a69b9ae18544dd1fbf53f31bfe8c640, with Python 3.12.14. Dry-run mode requires no credentials.
d=$(mktemp -d)
python3 - "$d" <<'PY'
import json, sys
from pathlib import Path
jobs = [
{"prompt": "A welcome poster", "text": "OPEN HOUSE\u2028SATURDAY"},
{"prompt": "A second poster"},
]
for filename, escape in [("literal.jsonl", False), ("escaped.jsonl", True)]:
path = Path(sys.argv[1]) / filename
with path.open("w", encoding="utf-8") as f:
for job in jobs:
print(json.dumps(job, ensure_ascii=escape), file=f)
with path.open(encoding="utf-8") as f:
assert list(map(json.loads, f)) == jobs
PY
script=codex-rs/skills/src/assets/samples/imagegen/scripts/image_gen.py
python3 "$script" generate-batch --dry-run --input "$d/literal.jsonl" --out-dir "$d/out1"
python3 "$script" generate-batch --dry-run --input "$d/escaped.jsonl" --out-dir "$d/out2"
Observed The first invocation exits 1 with Invalid JSON on line 1: Unterminated string starting at: line 1 column 40 (char 39). The second lists jobs 1 and 2. The independent parser check passes for both files.
Expected Both batches should process the same two jobs, preserving the verbatim poster text.
Suggested fix Iterate over the UTF-8 file by physical lines instead of calling str.splitlines() on the whole document. The latter treats U+2028 inside a JSON string as a record boundary. Batch loader
- Dominant language
- Rust
- Stars
- 135k
- Forks
- 21.4k
- Avg merge
- 1m
- Merged PRs (30d)
- 997
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
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 openai/codex
-
gitDiffToRemote fails on an unpushed topic branch when the remote default branch contains a slashOpenapp-server bug CLI
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 1 day
-
bug CLI
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Maintainers usually reply within 1 day
-
bug CLI skills
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
Maintainers usually reply within 1 day
-
bug imagen skills
Difficulty 2/5 1-3 hours Newbie friendliness 80/100
Maintainers usually reply within 1 day
-
bug CLI tool-calls
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
Similar issues
-
bug UI
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
wardian-app/Wardian#1746 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
jlcodes99/cockpit-tools#3125 ·
Maintainers usually reply within 2 days
-
bug user-sprint
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Vondor/KassenSturz#967 ·
Maintainers usually reply within 1 day
-
area/ci
Difficulty 1/5 Under an hour Newbie friendliness 62/100
Maintainers usually reply within 1 day
-
[BUG] Incremental sync warns "no stored highest_uid" on every round for folders with no new mailOpenbug
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
rustmailer/bichon#411 ·