1. Troubleshooting and failure recovery

Troubleshooting and failure recovery

How to fix gate failures, index concurrency conflicts, and missing staged changes.

When the quality gate fails or blocks, it prints the exit code and primary reasons directly to stderr. This guide explains where to find detailed evidence and how to resolve common problems.

Quick diagnostic table

Exit codeStatusMeaningFirst action
0PassAll checks and agent tasks passed.Proceed with commit or merge.
1FailA test failed, linting broke, or the QA agent found a critical defect.Inspect test logs or agent findings in summary.md.
2BlockedEnvironmental issue, concurrency conflict, timeout, or missing release criteria.Check whether the index changed, tools are missing, or release criteria are incomplete.

Where to find evidence on disk

Every QA run saves its full context under .qa-reports/runs/<runId>/:

.qa-reports/runs/qa-run-1773729900000-a1b2c3d4/
├── gate-result.json   # Full JSON payload with timings, hashes, and findings
├── summary.md         # Readable Markdown summary of the gate decision
├── receipt.json       # Signed token (present only on passing runs)
└── evidence/
    ├── ev-qa-run-1-check-output.txt    # Captured stdout and stderr from tests
    ├── ev-qa-run-2-candidate-staged.diff # The exact git diff tested
    └── ev-qa-run-3-agent-session-transcript.txt # Full conversation log with the QA agent

When diagnosing a failure, start by opening summary.md. It lists the blocking reasons and failed criteria in plain text.


Common failure scenarios

1. No staged changes detected

Terminal error:

No staged changes detected in git index. Stage candidate changes with 'git add' before running qa:commit.

Why this happens: The pre-commit runner tests the Git staging index, not working files on disk. If you made edits but did not run git add, the index tree is identical to the base commit or empty.

How to fix it:

  1. Stage your intended changes: git add <files> or git add -A.
  2. Run the check again: pnpm qa.
  3. If you want to unstage them afterward, run git restore --staged ..

2. Automatic QA auto-run is OFF notice

Terminal output:

[QA COMMIT GATE] Automatic QA auto-run is OFF. To run a full assessment, run: pnpm qa

Why this happens: The configuration in tooling/qa/policy/switch.json has autoRun: "off". This is intentional during daily development so that local commits do not pause waiting for AI agent reviews.

How to handle it:

  • If you just want to make a local commit, no action is needed. The hook allows the commit to proceed.
  • If you want to run the full QA assessment before committing, run pnpm qa.
  • If you want hooks to run QA automatically on every commit, open tooling/qa/policy/switch.json and change "autoRun": "off" to "autoRun": "on".

3. Formatting failures and the auto-repair loop

Terminal error:

[QA COMMIT GATE: FAIL] (exit code: 1)
Failures:
  - Suite 'pnpm-check' exited with code 1: prettier formatting check failed

Why this happens: One or more files staged in Git violate Prettier formatting rules.

How to fix it:

You can fix it manually with pnpm format, or let the QA runner repair it automatically:

pnpm qa --repair

When --repair is passed, the runner detects staged formatting issues, formats the files, updates the Git staging blobs, and re-evaluates the gate without altering unstaged working tree changes.


4. Concurrent index modification

Terminal error:

[QA COMMIT GATE: BLOCKED] (exit code: 2)
Gate blocked: host staging index was modified during QA assessment.

Why this happens: The QA runner captures your staged Git index at the start of the run. Right before evaluating the gate, it checks whether the index hash changed. If you ran git add, modified a staged file, or ran an automated tool in another terminal while tests were executing, the runner detects the mismatch.

How to fix it:

  1. Check git status to see what is currently staged.
  2. Finish staging all intended files with git add.
  3. Avoid touching Git staging while pnpm qa is actively running.

5. Missing or outdated Google Antigravity CLI

Terminal error:

✖ agy (not installed or not in PATH)
Fatal pre-commit QA error: agy process failed

Why this happens: The independent QA agent runs using /opt/homebrew/bin/agy or the agy binary in your PATH. If Antigravity is not installed, or its version is below 1.1.9, the runner cannot launch the reviewer.

How to fix it:

  1. Verify whether agy is installed: which agy.
  2. Check its version: agy --version.
  3. Run pnpm qa:setup to confirm all tool prerequisites pass.

6. Agent critical or major findings

Terminal error:

[QA COMMIT GATE: FAIL] (exit code: 1)
Failures:
  - Agent critical finding [FINDING-01] on LOCATION-01: Address override ignored in lookup service

Why this happens: Deterministic tests passed, but the independent QA reviewer discovered a contract violation, an unhandled error state, or a prompt injection vulnerability in the diff.

How to fix it:

  1. Open .qa-reports/runs/<runId>/summary.md.
  2. Read the finding’s expectedResult and actualResult.
  3. Address the defect in your application code under src/.
  4. Stage the fix and run pnpm qa again.

7. Release gate blocked on unimplemented criteria

Terminal error:

[QA RELEASE GATE: BLOCKED] (exit code: 2)
Release blocked: 28 acceptance criteria are currently unimplemented.

Why this happens: The release runner (pnpm qa:release) checks tooling/qa/manifest/acceptance-manifest.json. It requires all 28 accepted criteria to have passing automated tests before a release artifact can pass. While product features are actively being built, this command purposefully blocks to prevent accidental releases of incomplete code.