Skip to content

PUP-583: Gate codex-imagegen skill on Codex OAuth, add namespace tags - #749

Merged
mpfaffenberger merged 1 commit into
mpfaffenberger:mainfrom
thomwebb:feat/codex-imagegen-auth-gate-and-tags
Aug 11, 2026
Merged

PUP-583: Gate codex-imagegen skill on Codex OAuth, add namespace tags#749
mpfaffenberger merged 1 commit into
mpfaffenberger:mainfrom
thomwebb:feat/codex-imagegen-auth-gate-and-tags

Conversation

@thomwebb

@thomwebb thomwebb commented Aug 10, 2026

Copy link
Copy Markdown
Collaborator

Jira: PUP-583

What

Two related fixes to the built-in codex-imagegen skill (chatgpt_oauth plugin):

  1. Proactively hide the skill when Codex OAuth isn't authenticated, instead of only gating the tool it depends on.
  2. Add namespace tags to its frontmatter, which it previously had none of.

Why

codex_imagegen (the tool) was already gated on auth via _advertise_imagegen_tool:

def _advertise_imagegen_tool(agent_name: str | None = None) -> list[str]:
    del agent_name
    if not _is_codex_oauth_authenticated():
        return []
    return ["codex_imagegen"]

But codex-imagegen (the skill) was registered unconditionally via _register_imagegen_skill, with no equivalent check. An unauthenticated user could still see the skill in /skills list and the namespace directory, activate_skill it, and get instructions telling the model to call codex_imagegen(...) -- a tool that isn't actually wired into any agent for them. The skill's own content already anticipates this ("If authentication is missing, tell the user to run /codex-auth"), but that's a reactive fallback that only works if the model correctly diagnoses the failed tool call, not a proactive fix.

Separately: the skill had no tags: field at all. Under namespace_skill_search (#713), an untagged skill falls into the generic General namespace alongside every other untagged skill -- exactly the crowded/unhelpful bucket the authoring guide (also from #713/#714) tells skill authors to avoid landing in.

How it works

  1. _register_imagegen_skill() now checks _is_codex_oauth_authenticated() before returning the skill registration, mirroring _advertise_imagegen_tool exactly. Logged out -> skill doesn't register at all.
  2. refresh_skill_cache() is called from both the login and logout paths so this takes effect immediately instead of requiring a process restart:
    • After /codex-auth / /chatgpt-auth succeeds (alongside the existing set_model_and_reload_agent call).
    • After /codex-logout / /chatgpt-logout, alongside the existing _reload_active_agent() call that already does the equivalent job for tool unbinding.
  3. Added tags to IMAGEGEN_SKILL.md: image-generation (first tag -> namespace), codex, gpt-image, artwork.

Testing

  • Updated test_imagegen_skill_and_tool_registration to authenticate before asserting the skill registers (previously asserted unconditionally).
  • Added test_imagegen_skill_is_not_registered_when_logged_out (mirrors the existing tool-side test of the same name pattern).
  • Added test_logout_reloads_agent_to_unbind_imagegen assertion that refresh_skill_cache() is now also called, plus a new test_logout_does_not_refresh_skills_when_already_logged_out to confirm no-op behavior when there was nothing to unbind.
  • Added test_auth_command_refreshes_skill_cache for the login path.
  • 33/33 tests pass in code_puppy/plugins/chatgpt_oauth/test_plugin.py.
  • Broader regression sweep: 235 tests pass across test_plugin_meta.py, test_builtin_plugin_lock.py, test_agent_skills*.py, and test_namespace_skill_search_plugin.py -- no interaction effects with the namespace/skills work in PUP-582: Add namespace_skill_search plugin: model-agnostic namespace + on-demand skill search #713/PUP-581: Split code-puppy-agent skill into topic reference docs, add namespace_skill_search coverage #714.
  • ruff check / ruff format --check clean.

Related

Builds on the tag-order guidance from #713's docs/AGENT_SKILLS.md update and #714's code-puppy-agent skill work -- this is Code Puppy's own built-in skill following the advice both of those PRs give to everyone else.

The codex-imagegen skill was always registered regardless of auth
state, even though the codex_imagegen tool it teaches the model to
call is already gated on Codex OAuth (_advertise_imagegen_tool returns
[] when logged out). This let a model activate the skill, try the
tool call, and only then discover auth was missing.

- Gate _register_imagegen_skill() the same way _advertise_imagegen_tool
  already is: unauthenticated -> skill doesn't register at all.
- Call refresh_skill_cache() after both the /codex-auth login flow and
  the logout flow, so the skill appears/disappears immediately instead
  of requiring a process restart -- mirroring the existing agent reload
  that already does this for the tool side.
- Added tags to IMAGEGEN_SKILL.md's frontmatter (image-generation,
  codex, gpt-image, artwork). It previously had none, which meant it
  fell into namespace_skill_search's generic 'General' namespace
  alongside every other untagged skill.
@thomwebb thomwebb self-assigned this Aug 10, 2026
@thomwebb thomwebb changed the title Gate codex-imagegen skill on Codex OAuth, add namespace tags PUP-583: Gate codex-imagegen skill on Codex OAuth, add namespace tags Aug 11, 2026
@mpfaffenberger
mpfaffenberger merged commit bfcf43f into mpfaffenberger:main Aug 11, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants