Generate clean 2D game sprites & animation atlases — component-row pipeline: state rows, alpha cleanup, frame extraction, runtime atlases. Codex/Claude skill.
fix: keep the OpenAI empty-key refusal naming the codex login; stub the codex login in codex runs
Soohong Kim3b5d540e3251
diff --git a/sprite_gen/gen/base.py b/sprite_gen/gen/base.pyindex ff3d53b..d354a3e 100644--- a/sprite_gen/gen/base.py+++ b/sprite_gen/gen/base.py@@ -95,17 +95,18 @@ def provider_subprocess_env(env: Mapping[str, str] | None = None) -> dict[str, s}-def env_api_key(name: str, env: Mapping[str, str] | None = None, *, who: str) -> str | None:+def env_api_key(name: str, env: Mapping[str, str] | None = None, *, who: str, also: str = "") -> str | None:"""The API key in the environment variable `name` (`env`, default `os.environ`),None when it is not set. Set but empty is refused, naming it: an empty key is a- mistake to show, not an absence to route around. The one reading of a provider- key; what a missing key means (another route, or a refusal) is the caller's."""+ mistake to show, not an absence to route around; `also` is said after it. The one+ reading of a provider key; what a missing key means (another route, or a refusal)+ is the caller's."""source = os.environ if env is None else envkey = (source.get(name) or "").strip()if key:return keyif name in source:- raise SystemExit(f"{who}: {name} is set but empty; give it a value or unset it")+ raise SystemExit(f"{who}: {name} is set but empty; give it a value or unset it{also}")return Nonediff --git a/sprite_gen/gen/openai_provider.py b/sprite_gen/gen/openai_provider.pyindex e1ac9bb..d5c16c7 100644--- a/sprite_gen/gen/openai_provider.py+++ b/sprite_gen/gen/openai_provider.py@@ -108,7 +108,8 @@ def resolve_credential(env: dict[str, str] | None = None) -> str:"""Return the OpenAI API key (`base.env_api_key`), or fail loud naming the variable that is missing.This provider never falls back to the codex ChatGPT login: that is `codex`'s route, and it needsan interactive browser sign-in that a container does not have."""- key = env_api_key(AUTH_ENV, env, who="openai-gen")+ key = env_api_key(AUTH_ENV, env, who="openai-gen",+ also=". This provider never falls back to the codex ChatGPT login.")if key:return keyraise SystemExit(diff --git a/tests/gen/test_gen.py b/tests/gen/test_gen.pyindex 753422f..20dc4e7 100644--- a/tests/gen/test_gen.py+++ b/tests/gen/test_gen.py@@ -331,6 +331,7 @@ def test_codex_empty_rollout_fails_loud_on_tool_non_exposure(tmp_path: Path, monstderr = ""monkeypatch.setattr(codex_provider.subprocess, "run", lambda cmd, **kwargs: _Completed())+ monkeypatch.setattr(codex_provider, "codex_login", lambda: codex_provider.CodexLogin(codex_provider.AUTH_SOURCE_LOGIN))monkeypatch.setattr(codex_provider,"_resolve_rollout",@@ -371,6 +372,7 @@ def test_codex_prompt_reaches_the_child_process(tmp_path: Path, monkeypatch) ->return _Completed()monkeypatch.setattr(codex_provider.subprocess, "run", _fake_run)+ monkeypatch.setattr(codex_provider, "codex_login", lambda: codex_provider.CodexLogin(codex_provider.AUTH_SOURCE_LOGIN))monkeypatch.setattr(codex_provider,"_resolve_rollout",@@ -1050,6 +1052,7 @@ def test_codex_generate_reports_transparent_background_claim(tmp_path: Path, monreturn _Completed()monkeypatch.setattr(codex_provider.subprocess, "run", _fake_run)+ monkeypatch.setattr(codex_provider, "codex_login", lambda: codex_provider.CodexLogin(codex_provider.AUTH_SOURCE_LOGIN))monkeypatch.setattr(codex_provider, "_resolve_rollout", lambda sid, root, *, preexisting: tmp_path / "x.jsonl")