/lorenzh:waiting-for-cifrom lorenzh
Waiting on CI runs, PR checks, package registries and background processes without hanging. Use when an agent must wait for a GitHub Actions run or PR checks to finish, wait until a published version appears on npm or another registry, wait for a background job or another agent, stop a background process or local server, or when a wait loop never ends, an agent has gone silent or finished without a completion notice, or a PR check or CI job failed and its log is empty or the cause is unclear.
Ships in lorenzh. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Wait for an external result with a command that ends on its own, and check real state instead of guessing.
Every wait has an end condition the waiting command can see, and a timeout.
| Waiting for | Command |
|---|---|
| One workflow run | timeout 60m gh run watch <run-id> --exit-status (exit code is the run's result; 124 is the deadline) |
| All checks on a PR | timeout 30m gh pr checks <n> --watch --fail-fast |
| Merge a PR once CI is green | A bounded loop (step 2) over the rollup check below |
| The run a push started | Find the run for that commit (below), then watch it as above |
| A process you started | Its PID: timeout 30m bash -c 'while kill -0 <pid> 2>/dev/null; do sleep 10; done' |
| A process found by name | pgrep -f '[p]attern' (bracket the first letter) to get the PID, then wait on the PID |
| A version on a registry | The bounded loop in step 2 |
The deadlines are tunable defaults; pick one per wait, never none.
To find the run a push started, match it to the pushed commit and the workflow, not to "the latest run": an older or unrelated run on the same branch can be the latest. The run takes a few seconds to appear, so wait for it with a limit:
sha=$(git rev-parse HEAD)
for i in $(seq 1 30); do
id=$(gh run list --workflow <workflow> --commit "$sha" --json databaseId -q '.[0].databaseId')
[ -n "$id" ] && break
sleep 10
done
[ -n "$id" ] || { echo "no run for $sha"; exit 1; }
Never wait with while pgrep -f "<pattern>"; do ...; done. The loop's own shell has <pattern> on its command line, so pgrep always finds it and the loop never ends. The bracket form [p]attern still matches the target process but not the literal [p]attern text in the shell's command line. A PID is better still.
Never kill by pattern from a command that contains that pattern. In the measured case, pkill -f '<pattern>' matched its caller's shell and ended it with exit 144. To stop a process you waited on or started, kill <pid>; for a server, take the PID from its port: kill $(ss -ltnp | grep ':<port> ' | grep -o 'pid=[0-9]*' | cut -d= -f2).
Before a script merges on green, read checks with gh pr view <n> --repo <owner>/<repo> --json headRefOid,statusCheckRollup. Older gh has no gh pr checks --json; a script that pipes that error into its check reads "no output" as green, or never merges. Green means all of these:
gh pr view <n> --repo <owner>/<repo> --json headRefOid,statusCheckRollup | jq -e --arg sha "<expected-sha>" '
.headRefOid == $sha and (.statusCheckRollup | length > 0) and
all(.statusCheckRollup[]; (.status // "COMPLETED") == "COMPLETED" and
((.conclusion // .state) | IN("SUCCESS","SKIPPED","NEUTRAL")))'
The rollup holds check runs (status, conclusion) and commit status contexts (state only); the // covers both, so a successful status context (state: SUCCESS) counts as green.
Done when the wait command is chosen and it ends by itself when the result is in.
A poll without a limit hangs forever when the result never comes (a failed publish, a wrong version string). Use a fixed number of tries:
ok=; last=
for i in $(seq 1 30); do
last=$(npm view <pkg>@<dist-tag> version 2>/dev/null)
[ "$last" = "<version>" ] && ok=1 && break
sleep 20
done
[ -n "$ok" ] || { echo "timeout: <pkg>@<dist-tag> is '$last', want <version>"; exit 1; }
echo ready
30 tries at 20 seconds is 10 minutes, a default you can tune. The loop keeps the last value and exits non-zero on a timeout, so a caller cannot mistake a timeout for success. Stop the work that depends on the result and report the last value. Registry CDNs lag: npm view can show the old version for a few minutes after a successful publish.
Done when the loop printed ready, or the timeout is reported with the last observed value.
Start waits longer than about two minutes with the harness background option, so the session stays responsive and receives a completion notice. Do not use nohup ... &: the measured run produced no completion notice. Note the PID or job id and the log path. If the harness has no background option, report the missing capability and ask how to proceed.
Start the wait from a directory that outlives it, not from a worktree that may be removed meanwhile. Pass --repo <owner>/<repo> to every gh call except gh api, which has no --repo flag; its repos/<owner>/<repo>/… path names the repository. Once its working directory is gone, gh fails with "Unable to read current working directory".
Done when the wait runs in the background and its PID or job id and log path are noted.
When a background wait, a run or another agent goes quiet, look before you report:
gh run view <run-id> --json status,conclusion,jobs.kill -0 <pid> and the tail of its log.A silent agent may have finished, crashed or be stuck in a loop. Report what the check showed, not what you expect.
Never read empty output as success; verify the state the command should have changed. Older gh has no gh pr update-branch. Use gh api -X PUT repos/<owner>/<repo>/pulls/<n>/update-branch, then confirm that gh pr view <n> --json headRefOid shows a new head SHA.
Done when the report states each wait's observed status.
When a job failed and its log is empty or the cause is unclear, find the cause before you change the PR:
Read the raw job log. Get the job id from gh run view <run-id> --json jobs, then run gh api repos/{owner}/{repo}/actions/jobs/<job-id>/logs. It holds the step output even when gh run view <run-id> --log-failed or --log prints nothing, and names the failing test or step.
Compare the failure with the PR's changed files: gh pr view <n> --json files -q '.files[].path'.
Check the default branch's recent runs of the same workflow:
default=$(gh repo view --json defaultBranchRef -q .defaultBranchRef.name)
gh run list --branch "$default" --workflow <workflow> -L 5 --json conclusion,headSha,createdAt
If the default branch fails the same test, report it as broken there, not caused by the PR, and leave the PR unchanged.
Run that single test locally 5 times (a tunable default).
If unrelated tests time out, check whether the CI runner shares its machine with heavy local jobs (a self-hosted runner next to parallel agents or builds). Compare per-file test durations of a green run and the slow run; a slowdown spread over all files points at the machine, not the change.
For a failure unrelated to the diff, or a timeout or network error on a step that passed before, rerun only the failed jobs once with gh run rerun <run-id> --failed and watch with a deadline. A second failure is real; report its log.
If the unrelated test passes on the rerun, offer to open an issue for the flaky test instead of changing the PR.
Done when the report states each wait's observed status and, for a failed job, includes its raw log evidence and whether the failure matches the PR diff.
An agent can finish without the harness telling you. Once its expected time has passed (a tunable default: twice the time similar tasks took, at least 10 minutes), stop waiting for the notice. Read references/silent-agents.md and check its transcript, its result and its runtime status before you name a state.
Done when each silent agent is reported as done (with its result), working (with its pending or latest call), stuck (with the repeated call) or failed (with its last message).
Load dispatching-codex. A nohup or & wrapper's completion notice does not mean Codex finished.
Check the -o answer file, the log's model: line and the process instead.
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub lorenzh/skills --plugin lorenzh27 skills in this plugin
/checking-before-publishingPrivacy check for anything about to go public. Use when about to post an issue or PR comment, opening a PR, committing, pushing, publishing a release, blog post or README, or sharing screenshots, GIFs, videos or terminal recordings; when relaying a subagent's text to a public place; or when the user asks to "check for private data", "scrub" or "redact" something before sharing./cloning-voices-with-kittenttsVoice cloning with KittenTTS 2 from a short recording and text. Use when users say "kitten tts", "Stimme klonen", "clone my voice", "sprich diesen Text mit meiner Stimme", or "text to speech with my voice" and want a speech WAV.
/competing-implementations