📄 ci-troubleshooting.md

← Vault

CI Troubleshooting Quick Reference

Common CI failure patterns and how to diagnose them from the logs.

Reading CI Logs

`bash

With gh

gh run view --log-failed

With curl — download and extract

curl -sL -H "Authorization: token $GITHUB_TOKEN" \

https://api.github.com/repos/$GH_OWNER/$GH_REPO/actions/runs//logs \

-o /tmp/ci-logs.zip && unzip -o /tmp/ci-logs.zip -d /tmp/ci-logs

`

Common Failure Patterns

Test Failures

Signatures in logs:

`

FAILED tests/test_foo.py::test_bar - AssertionError

E assert 42 == 43

ERROR tests/test_foo.py - ModuleNotFoundError

`

Diagnosis:

1. Find the test file and line number from the traceback

2. Use read_file to read the failing test

3. Check if it's a logic error in the code or a stale test assertion

4. Look for ModuleNotFoundError — usually a missing dependency in CI

Common fixes:


Auto-Fix Decision Tree

`

CI Failed

├── Test failure

│ ├── Assertion mismatch → update test or fix logic

│ └── Import/module error → add dependency

├── Lint failure → run formatter, fix style

├── Type error → fix types

├── Build failure

│ ├── Missing dep → add to requirements

│ └── Version conflict → update pins

├── Permission error → update workflow permissions (needs user)

└── Timeout → investigate perf (may need user input)

`

Re-running After Fix

`bash

git add && git commit -m "fix: resolve CI failure" && git push

Then monitor

gh pr checks --watch 2>/dev/null || \

echo "Poll with: curl -s -H 'Authorization: token ...' https://api.github.com/repos/.../commits/$(git rev-parse HEAD)/status"

`