Repository navigation
Add Codex-native skill test suite and enhance reviewer roles - #1083
manoelcalixto wants to merge 36 commits into
Conversation
Add Codex-native skill test suite
[codex] add native Codex subagent roles and hermetic Claude tests
fix: make Codex SessionStart hook targeting explicit
# Conflicts: # hooks/session-start
fix: support Codex SessionStart hooks on Windows
[codex] expand native workflow roles and harden role tests
There was a problem hiding this comment.
Pull request overview
This PR makes Codex a first-class test/runtime target for Superpowers by adding a Codex-native test harness (fast + integration), expanding and documenting Codex-native workflow roles (superpowers_*), and improving hook/bootstrap behavior (including a Windows-safe SessionStart wrapper). It also updates existing Claude Code tests/docs to align with the new plugin loading and semantic-eval approach.
Changes:
- Added
tests/codex/suite with isolated HOME/CODEX_HOME, rubric-based semantic tests, and end-to-end integrations that assert structured JSON/session evidence. - Added/expanded native Codex agent role TOMLs (
.codex/agents/*.toml) and updated skill/docs to prefer native roles with fallbacks. - Enhanced SessionStart bootstrap targeting (Codex/Claude) and added a PowerShell wrapper for Windows; updated several skills/docs to reflect headless/non-interactive workflows.
Reviewed changes
Copilot reviewed 43 out of 43 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/codex/test-using-superpowers-bootstrap.sh | New Codex hook contract test (SessionStart output shape + Windows wrapper path). |
| tests/codex/test-subagent-driven-development.sh | New Codex semantic/rubric tests for workflow + role mapping expectations. |
| tests/codex/test-subagent-driven-development-integration.sh | New Codex end-to-end workflow integration test with structured evidence checks. |
| tests/codex/test-native-agent-catalog.sh | New test verifying superpowers_* role TOMLs exist, are installed, and are discoverable by Codex. |
| tests/codex/test-model-config.sh | New test asserting test harness pins Codex model + reasoning effort + SessionStart hook wiring. |
| tests/codex/test-helpers.sh | New Codex test harness (isolated env setup, exec helpers, semantic evaluation helper, assertions). |
| tests/codex/test-document-review-system.sh | New Codex integration test for spec document review behavior. |
| tests/codex/test-brainstorming-clarifying-loop.sh | New Codex behavioral test ensuring brainstorming keeps clarifying loop open-ended. |
| tests/codex/run-skill-tests.sh | New Codex test runner (fast vs --integration, timeouts, verbose mode). |
| tests/codex/README.md | New documentation for running/understanding Codex test suite evidence. |
| tests/claude-code/test-using-superpowers-bootstrap.sh | New Claude/Cursor/fallback bootstrap contract test for hooks/session-start. |
| tests/claude-code/test-subagent-driven-development.sh | Refactored to rubric-based semantic assertions (less brittle than regex matching). |
| tests/claude-code/test-subagent-driven-development-integration.sh | Updates plugin loading and session discovery; broadens subagent tool detection. |
| tests/claude-code/test-helpers.sh | Adds --plugin-dir usage and new session-discovery helper; adds semantic evaluator helper. |
| tests/claude-code/test-document-review-system.sh | Ensures plugin-dir is used for integration execution. |
| tests/claude-code/run-skill-tests.sh | Adds bootstrap + document review tests to the Claude Code runner lists/help. |
| tests/claude-code/README.md | Updates to reflect local --plugin-dir loading and documents new tests. |
| skills/using-superpowers/SKILL.md | Clarifies checklist loop/todo semantics (don’t collapse iterative phases). |
| skills/using-superpowers/references/codex-tools.md | Rewrites Codex mapping around native superpowers_* roles and fallback guidance. |
| skills/subagent-driven-development/SKILL.md | Adds Codex native role mapping section + controller question-handling guidance. |
| skills/requesting-code-review/SKILL.md | Documents Codex preferred reviewer role mapping with fallback behavior. |
| skills/finishing-a-development-branch/SKILL.md | Adds explicit headless-session defaulting behavior to avoid blocking runs. |
| skills/brainstorming/SKILL.md | Reframes clarifying questions as an explicit loop and updates flow diagram. |
| hooks/session-start-codex.ps1 | Adds Windows PowerShell wrapper for Codex SessionStart hooks. |
| hooks/session-start | Adds explicit SUPERPOWERS_HOOK_TARGET targeting for Codex/Claude output shape selection. |
| docs/testing.md | Expands testing guide to cover Codex suite and updates Claude/Codex guidance. |
| docs/README.codex.md | Updates Codex install docs for agent TOML installation + SessionStart hook (incl. Windows). |
| .codex/INSTALL.md | Updates Codex install instructions to include agent TOMLs + SessionStart hook guidance. |
| .codex/agents/superpowers_verifier.toml | Adds native Codex verifier role. |
| .codex/agents/superpowers_spec_reviewer.toml | Adds/updates native Codex spec reviewer role. |
| .codex/agents/superpowers_reviewer.toml | Adds/updates native Codex reviewer role. |
| .codex/agents/superpowers_plan_reviewer.toml | Adds/updates native Codex plan reviewer role. |
| .codex/agents/superpowers_implementer.toml | Adds native Codex implementer role. |
| .codex/agents/superpowers_explorer.toml | Adds native Codex explorer role. |
| .codex/agents/superpowers_doc_reviewer.toml | Adds/updates native Codex document reviewer role. |
| docs/superpowers/specs/2026-04-05-codex-workflow-role-expansion-design.md | Design doc for expanding Codex workflow roles beyond reviewers. |
| docs/superpowers/specs/2026-04-05-codex-windows-hook-wrapper-design.md | Design doc for Windows-safe Codex SessionStart wrapper. |
| docs/superpowers/specs/2026-03-30-codex-native-subagents-design.md | Design doc for native Codex roles + installation model. |
| docs/superpowers/specs/2026-03-26-codex-real-tests-design.md | Design doc for Codex real test suite equivalence. |
| docs/superpowers/plans/2026-04-05-codex-workflow-role-expansion.md | Implementation plan for workflow role expansion work. |
| docs/superpowers/plans/2026-04-05-codex-windows-hook-wrapper.md | Implementation plan for Windows wrapper work. |
| docs/superpowers/plans/2026-03-30-codex-native-subagents.md | Implementation plan for native roles + docs/tests updates. |
| docs/superpowers/plans/2026-03-26-codex-real-tests.md | Implementation plan for Codex test suite creation. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| matches_file=$(mktemp) | ||
|
|
||
| set +e | ||
| find "$CODEX_HOME/sessions" -name "*.jsonl" -type f -exec rg -o --no-messages "$pattern" {} + > "$matches_file" | ||
| status=$? |
There was a problem hiding this comment.
rg (ripgrep) is used for session scanning, but the script never checks that it’s installed (and the suite docs don’t list it as a requirement). On systems without ripgrep, this integration test will fail even if Codex behavior is correct. Consider either adding a preflight command -v rg check with a clear error message, or rewriting these searches using grep -E/find ... -exec grep so the dependency set stays minimal.
| printf 'mode %s %s\n' "$mode" "$path" | ||
| sha256sum "$path" | ||
| else | ||
| printf 'missing %s\n' "$path" | ||
| fi | ||
| done | ||
| ) | sha256sum | awk '{print $1}' |
There was a problem hiding this comment.
This repository fingerprint helper relies on sha256sum, which is not available by default on macOS (it provides shasum -a 256 instead). Since this test is part of the default fast suite, it will fail on those environments. Consider adding a small helper that picks sha256sum when available and otherwise falls back to shasum -a 256 (or openssl dgst -sha256), and use it for both per-file hashing and the final aggregate hash.
| skill_marker=$(grep -F "If you think there is even a 1% chance a skill might apply" "$SKILL_FILE" | head -1) | ||
| description_marker=$(grep -F "description: Use when starting any conversation" "$SKILL_FILE" | head -1) |
There was a problem hiding this comment.
skill_marker/description_marker can become empty if the expected strings ever change or the file is missing; in that case grep -Fq "$skill_marker" will always succeed (empty pattern), producing a false positive. To keep this test reliable, assert both markers are non-empty (or fail fast if the greps return nothing) before using them in output checks.
| skill_marker=$(grep -F "If you think there is even a 1% chance a skill might apply" "$SKILL_FILE" | head -1) | ||
| description_marker=$(grep -F "description: Use when starting any conversation" "$SKILL_FILE" | head -1) |
There was a problem hiding this comment.
skill_marker/description_marker can become empty if the expected strings ever change or the file is missing; in that case grep -Fq "$skill_marker" will always succeed (empty pattern), producing a false positive. Add a check that both markers are non-empty (or fail fast when the greps return nothing) before using them in the output assertions.
| - Claude Code must be installed and available as `claude` command | ||
| - Local dev marketplace must be enabled: `"superpowers@superpowers-dev": true` in `~/.claude/settings.json` | ||
| - Run from the repository root or a test subdirectory, not from a disposable temp checkout of the tests alone | ||
| - Claude Code tests require `claude` plus the local dev marketplace plugin enabled |
There was a problem hiding this comment.
The Requirements section still says Claude Code tests require the local dev marketplace plugin enabled, but the updated Claude Code harness now loads the repo plugin via --plugin-dir (and tests/claude-code/README.md explicitly says a user-level install isn’t required). Please reconcile this doc so contributors don’t do unnecessary setup (either remove the marketplace requirement or clarify when it’s still needed).
| - Claude Code tests require `claude` plus the local dev marketplace plugin enabled | |
| - Claude Code tests require `claude`; the automated harness loads the repository plugin via `--plugin-dir`, so a user-level local dev marketplace plugin install is not required for these test runs |
| timeout "$timeout_seconds" env HOME="$HOME" CODEX_HOME="$CODEX_HOME" codex exec \ | ||
| --json \ | ||
| --dangerously-bypass-approvals-and-sandbox \ | ||
| --skip-git-repo-check \ | ||
| -C "$codex_project_dir" \ | ||
| "$full_prompt" > "$output_file" 2>&1 |
There was a problem hiding this comment.
run_codex_json_to_file always uses --dangerously-bypass-approvals-and-sandbox. Because this helper is used by a fast test (test-brainstorming-clarifying-loop.sh), running the default suite will execute Codex in the most permissive mode, which is a significant footgun for contributors running tests locally. Consider (a) limiting the dangerous flag to the slow integration tests only, (b) adding an explicit opt-in flag in the runner for tests that require it, and/or (c) if Codex supports it, using a less-permissive “bypass approvals” mode that does not disable the sandbox.
This pull request introduces a comprehensive suite of tests for the Codex-native skills, ensuring that skills are loaded correctly and that the implementation adheres to the specified requirements. It also enhances the reviewer roles by adding new roles for document and implementation reviews, improving the overall functionality and maintainability of the Codex system. Additionally, it addresses various bugs and improves the testing framework to ensure robustness and reliability.
Fixes #3, #4, #5