--- name: qa description: Full QA on all session changes using Codex as a second pair of eyes. Use when user says "QA", "full QA", "QA my changes", "QA all your changes", or "use codex to review". Runs git diff, sends changes to Codex for thorough review, and synthesizes findings. --- # QA — Codex-Powered Change Review Thorough QA on all changes in the current working tree using Codex as a second pair of eyes. Detects what changed, sends it to Codex for deep review, and presents actionable findings. ## When to Use - After completing implementation work, before committing - User says "QA", "full QA", "QA my changes", "review with codex" - Any time you want a second opinion on everything you just built ## Process ### Step 1: Gather All Changes ```bash # Get the full picture git status --porcelain git diff --stat git diff --cached --stat # Capture the actual diff (staged + unstaged) git diff HEAD > /tmp/qa-full-diff.patch ``` If changes span many files, also get a summary: ```bash git diff HEAD --name-only ``` ### Step 2: Build Context Before sending to Codex, gather context about what was being built: - What task/feature was being implemented? - What files were touched and why? - Any known areas of concern? Summarize this in 2-3 sentences to give Codex context. ### Step 3: Codex Review (diff-based) Run Codex with the full diff and context. Use `-C` to point at the repo so Codex can read surrounding code. ```bash cat <<'PROMPT' | codex exec --full-auto -C "$(git rev-parse --show-toplevel)" -o /tmp/qa-codex-review.md - You are doing a thorough QA review of the following changes. Be critical — find real bugs, not style nits. ## Context [2-3 sentence summary of what was built] ## Your Review Checklist 1. **Correctness**: Logic errors, off-by-ones, wrong conditions, missing edge cases 2. **Runtime errors**: Null/undefined access, type mismatches, missing imports 3. **Security**: Injection, XSS, secrets in code, unsafe operations 4. **Data integrity**: Race conditions, stale state, missing validation 5. **Integration**: Does this work with the rest of the codebase? Missing wiring? 6. **Regressions**: Could these changes break existing functionality? 7. **Missing pieces**: Anything obviously incomplete or TODO'd? ## Changes to Review $(git diff HEAD) For each issue found, report: - **File:line** — exact location - **Severity** — P1 (bug/security), P2 (likely problem), P3 (minor concern) - **Issue** — what's wrong - **Fix** — how to fix it If the changes look solid, say so — don't manufacture issues. PROMPT ``` **Important**: Set a timeout (3-5 minutes). Codex can run long on large diffs. ### Step 4: Codex Audit (file-based) **This is a separate pass.** Instead of reviewing the diff, Codex reads the actual changed files in the repo and audits them holistically. This catches issues the diff-based review misses — things that look fine in isolation but break in context. Run this in parallel with Step 3 when possible (use Bash tool's `run_in_background`). ```bash # Build the file list from changes CHANGED_FILES=$(git diff HEAD --name-only | tr '\n' ' ') cat < /qa Gathering changes... 12 files changed, +342 lines, -89 lines Sending to Codex for review... Context: "Implemented OAuth2 login flow with PKCE, added token refresh middleware" [Codex reviewing... ~60s] ══════════════════════════════════════════════════════════════ QA REVIEW (via Codex) ══════════════════════════════════════════════════════════════ Files reviewed: 12 Codex verdict: ISSUES FOUND P1 — Bugs & Security ──────────────────────────────────────────────────────────────── 1. src/auth/token.ts:47 — Token stored in localStorage without encryption Fix: Use httpOnly cookie or encrypted session storage P2 — Likely Problems ──────────────────────────────────────────────────────────────── 1. src/middleware/refresh.ts:23 — Race condition if multiple requests trigger refresh simultaneously Fix: Add mutex/queue for token refresh P3 — Minor Concerns ──────────────────────────────────────────────────────────────── None found ══════════════════════════════════════════════════════════════ Fix P1 issues now? [y/N] ```