watch-ci
npx skills add https://github.com/langwatch/langwatch --skill watch-ci
Agent 安装分布
Skill 文档
Watch CI
Monitor the current branch’s PR for CI failures and review comments. Fix issues automatically and loop until clean.
Flow
ââ⺠gh pr checks --watch (blocks, zero tokens)
â â
â pass â¼ fail
â ââââââ´âââââ
â â â
â â Read logs, diagnose, fix, push
â â â
â ââââââ¬âââââ
â â
â Check for unaddressed review comments
â â
â none â¼ found
â ââââââ´âââââ
â â â
â â Address comments, push
â â â
â ââââââ¬âââââ
â â
â â¼
â CI still running? ââyesââ⺠loop back
â â
â no, all green
â â¼
â Done â
ââââââââââââââââââââââââââââââââââ
Steps
1. Find the PR
gh pr view --json number,title,headRefName,url --jq '{number, title, headRefName, url}'
If no PR exists for the current branch, tell the user and exit.
2. Wait for CI
Run this and let it block â it costs zero tokens while waiting:
gh pr checks --watch --fail-fast 2>&1
This blocks until all checks complete. Capture the exit code and output.
3. Handle CI result
If CI passes (exit 0): proceed to step 4.
If CI fails (exit non-zero):
- Get the failed check names from the output
- Fetch the logs for each failed run:
gh run view <run-id> --log-failed 2>&1 | tail -200 - Diagnose the root cause from the logs
- Fix the issue â edit files, run tests locally to verify
- Commit and push:
git add -A && git commit -m "fix: address CI failure - <brief description>" git push origin HEAD - Go back to step 2 (wait for CI again)
Max 3 fix attempts. If CI still fails after 3 pushes, report the situation to the user and stop.
4. Check for review comments
gh pr view --json reviewDecision,reviews,comments --jq '{
reviewDecision,
reviews: [.reviews[] | select(.state != "APPROVED" and .state != "DISMISSED") | {author: .author.login, state: .state, body: .body}],
comments: [.comments[] | {author: .author.login, body: .body}]
}'
Also check inline review comments:
gh api repos/{owner}/{repo}/pulls/{number}/comments --jq '[.[] | select(.position != null) | {path: .path, line: .line, body: .body, author: .user.login}]'
If there are unaddressed review comments or changes requested:
- Read and understand each comment
- Make the requested changes
- Commit and push
- Go back to step 2
If review is clean or approved: proceed to step 5.
5. Report
Print a summary:
- PR URL
- CI status (green)
- Review status
- What was fixed (if anything)
If $ARGUMENTS contains --once, stop here. Otherwise, ask the user if they want to keep watching.