Skip to content

Generate clean 2D game sprites & animation atlases — component-row pipeline: state rows, alpha cleanup, frame extraction, runtime atlases. Codex/Claude skill.

docs: refusal line shape and the Unreleased (v2.12.0) entry

Soohong Kim33a6b4a1770c
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 112fc44..42f9536 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,13 @@
All notable public changes to `sprite-gen` are recorded here. Versions track the `version:` field in `SKILL.md` and `pyproject.toml`.
+## Unreleased (v2.12.0) - A refusal names the provider's code, and says when it was the content policy
+
+- A provider refusal line now carries the provider's own code after the status: `openai-gen: image request failed (HTTP 400) code=invalid_value; no retry or provider fallback`. The code is `error.code` (or, for xAI's synchronous errors, a top-level `code`) and is printed only when it matches `^[A-Za-z0-9_.:-]{1,64}$`; the rest of the error body is still never printed on the image paths, since it can echo the prompt, a key or a signed URL. The video verbs read the code out of a failed poll's `error` object too.
+- A code the provider documents as a content-policy block turns the line into `<verb>: refused by the provider's content policy (HTTP <n>) code=<code>; no retry or provider fallback`, so a caller can tell "change the request" from an auth, quota or parameter error by one fixed phrase. OpenAI's `moderation_blocked` is the only such code (the image guide calls `error.code` the stable discriminator); its `moderation_details.moderation_stage` follows as `moderation_stage=input|output|unknown`. xAI's `invalid_argument` is not one: it covers moderation and parameter errors alike.
+- An xAI clip that finishes with `video.respect_moderation: false` is now `<verb>: generation <id> refused by the provider's content policy (HTTP 200) respect_moderation=false; nothing was written` instead of "done but reported no video url". The xAI REST image answer has no moderation field, so a grok image refusal carries its code only.
+- `(HTTP <n>)` is unchanged, so anything that finds the status with `\(HTTP (\d{3})\)` reads these lines as before. The policy table is `sprite_gen/gen/refusal.py` `POLICY_CODES`. Line shape: [docs/gen.md](docs/gen.md).
+
## v2.11.0 - An attack is one strike, and its whole clip is the loop
- `MOTION_TEXT["attack"]` asks for one attack (windup, strike, held impact pose, recovery to the exact starting stance) instead of the same attack twice, and `build_prompt(motion=...)` no longer adds a repeat sentence after a caller's paragraph (`REPEAT_TEXT` is empty; `HOLD_TEXT` still follows it once). The clip is pinned to the canvas as before, so it runs stance -> strike -> stance, and `video-set` cuts it whole with `video-loop --cycle pinned`, as it already did an idle (`PINNED_LOOP_STATES` = idle, attack). The attack keeps its own template (`ACTION_TEXT_STATES`). Before, the one-shot or period search cut a two-strike clip into loops that started mid-strike, held both strikes, or kept only the held pose, and some of those passed the seam gate.
diff --git a/docs/gen.md b/docs/gen.md
index 2b4f068..1b9936d 100644
--- a/docs/gen.md
+++ b/docs/gen.md
@@ -128,8 +128,17 @@ gpt-image models always answer with inline base64 (the API does not accept
forward. The payload is decoded, verified as a PNG and published atomically without
resizing; a missing, malformed or multi-image response fails without replacing an
existing raw output. HTTP 401/403 names the credential; any other non-200 fails
-with the status only — an error body can echo the prompt or a key, so it is not
-printed.
+with the status and the provider's code only — an error body can echo the prompt or
+a key, so it is not printed.
+
+A refusal line is `<verb>: <reason> (HTTP <n>)[ code=<code>][ key=value ...]; …`:
+`code=` is the provider's `error.code` when it matches `^[A-Za-z0-9_.:-]{1,64}$`,
+and `<reason>` is `refused by the provider's content policy` when that code is a
+documented policy block (`sprite_gen/gen/refusal.py` `POLICY_CODES`: openai
+`moderation_blocked`, followed by `moderation_stage=input|output|unknown`). The
+`(HTTP <n>)` part never changes shape. The video verbs use the same `code=` and
+reason, and a clip xAI reports with `respect_moderation: false` is that refusal
+with `respect_moderation=false` in place of a code (docs/video.md).
`--aspect-ratio` picks the `size`. gpt-image has no long-edge preset, so the ratio
maps to one concrete size out of a table that satisfies the documented constraints
diff --git a/docs/video.md b/docs/video.md
index 007911c..6ac5f05 100644
--- a/docs/video.md
+++ b/docs/video.md
@@ -202,6 +202,12 @@ printed or written** — only the download host (`vidgen.x.ai`).
- Imagine quota is a weekly SuperGrok allowance; when it is exhausted the API
refuses the POST and the run fails with that message (no retry loop here).
+- A refused request or a failed poll names the provider's code after the status,
+ `(HTTP 400) code=invalid_argument`, read from a top-level `code` or the `error`
+ object. `invalid_argument` covers moderation and bad parameters alike, so it is
+ not called a content-policy refusal; a clip that comes back `done` with
+ `video.respect_moderation: false` is:
+ `<verb>: generation <id> refused by the provider's content policy (HTTP 200) respect_moderation=false; nothing was written`.
- Duration 1–15 s, resolutions 480p/720p/1080p, the seven aspect ratios above —
from the xAI video docs as of 2026-09-08. Reference-to-video: ≤ 7 images, 720p
max; extension: input 2–15 s, 2–10 s added; editing: input ≤ 8.7 s (docs as of