ImageGen generate-batch aborts valid JSONL jobs containing a Unicode line separator in poster text

Aperta Adatta ai principianti
#61,442 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
78/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
python
Ambito
tooling

Direzione di ricerca

Il bug si trova nel loader batch di codex-rs/skills/src/assets/samples/imagegen/scripts/image_gen.py, intorno alla riga 464, dove l'intero input UTF-8 viene diviso con str.splitlines(), cosa che si interrompe con U+2028 all'interno delle stringhe JSON. Riproduci il problema con i comandi di dry-run della issue, confrontando un U+2028 letterale con il suo escape \u2028. È completato quando il file con il carattere letterale elenca gli stessi due job del file con l'escape e il testo del poster viene conservato alla lettera.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

bug imagen skills

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

Lingua principale
Rust
Stelle
135k
Fork
21.4k
Merge medio
1m
PR unite (30g)
997

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di openai/codex

Tutte le issue di openai/codex

Issue simili

Altre issue su Rust

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.