自动化运行健康审查
run-health-review
停滞监视器与自动化健康审查。拉取近期运行、合并、无操作率、失败、速率限制命中以及卡住的 PR;对每种停滞进行分类;只提出一项变更或“不变更”;并接管被遗弃的工作。当无人值守交付停滞(“为什么一夜之间就卡住了”“N 小时没有合并”“前几天还很快,现在变慢了”)、某个自动化失败或其产出下降、遭遇速率限制或配额用尽,或在 agent 无人值守运行期间按计划执行时使用。
- License 许可
- MIT
- 所属仓库
- github/lever
- 最近更新
- 2026-11-06
- Stars
- ★ 292
- Forks
- 15
01 前言 Front Matter
- name
- run-health-review
- description
- Stall watchdog and automation health review. Pulls recent runs, merges, no-op rate, failures, rate-limit hits and stuck PRs; classifies each stall; proposes exactly one change or "no change"; and takes over orphaned work. Use when unattended delivery stalled ("why did it stall overnight", "no merges in N hours", "it was fast the first few days, now slow"), when an automation fails or its output drops, when rate limits or quotas are hit, or on a schedule while agents run unattended.
- user-invocable
- false
03 SKILL.md 正文
run-health-review
Unattended work fails quietly. A host restarts and children sit idle, a quota runs out at 2am, a prompt drifts, the pool empties, CI goes red and every worker politely no-ops. Without a watchdog, the human computes "time since last merge" by eye every morning. This skill makes that check a job: measure health from GitHub state, name the stall, change one thing (or nothing), and pick up work that was left half-done.
When to use
- "Why did delivery stall overnight?", "nothing merged for 8 hours", "this was great the first few days, now it's slow".
- An automation failed (
automation_failed) or its useful-output rate dropped. - 403/429 rate-limit errors, or CI minutes or another quota ran out.
- On a schedule: every 30–60 minutes during an active unattended run; weekly for automations at steady state.
When not to use
- Nothing is running unattended. Use
progress-contractfor attended work. - A single PR is red. That is
pr-shepherd's job.
Steps
- Set the window and baseline. Default: last 24 h vs the prior 7-day daily average.
- Pull health signals, read-only, in one pass:
- Time since last merge to the default branch (the headline watchdog metric) and since the last release.
- Merged PRs, open PRs by state: green-unmerged, red, conflicted, waiting on review, draft; age of each.
- Ready-pool size (see
keep-the-pool-full). - Per automation or worker: runs,
ACTED / NOOP / BLOCKEDmix, failures by reason (reported,crashed,timed_out), latest revision and date. - Rate-limit and quota hits: 403/429 counts, CI minutes, API calls per merged PR.
- Idle or interrupted sessions and branches with no commits since the stall began.
- Stay silent if healthy. If time since last merge is under
STALL_THRESHOLDand no signal crossed its threshold, endNOOP(healthy)and post nothing. - Classify each stall with the taxonomy below. Cite the evidence for each (the run, PR, log line or count). One stall can have one primary cause; list secondary causes, don't act on them.
- Take over orphaned work if
TAKEOVERallows (protocol below). - Propose one change, or none. Pick the single change with the largest expected effect on the headline metric. State the prediction ("time since last merge back under 45 min within 24 h") and how you will check it. "No change" is a valid outcome when the stall was transient or the cause is outside your control; say what you'll watch instead.
- Route human-only blockers once. Permissions, budget increases, sign-ins and policy calls go in a single list with a recommended answer, surfaced in the next scheduled report. Never ask the same question twice; never block a stream on it.
- Report in the status format:
time since last merge: x → y, merged count, stalls by class, the one change (or "no change") with its prediction, takeovers, human-only list. Next run, check last run's prediction first.
Stall taxonomy
| Class | Signal | Typical one change |
|---|---|---|
| Supply | Pool empty or low; workers NOOP(no eligible work) |
Run keep-the-pool-full; raise its target |
| CI | Main red, or PRs red on the same job | Route to main-red triage; quarantine a proven flake |
| Rate limit (secondary) | 403 or 429 with a rate-limit body or Retry-After; bursts of content-creating writes from many lanes on one identity | Classify as retryable, not permission. Record "not attempted, retry after <absolute time>". Pace all lanes through one budget; serialize writes |
| Quota (primary) | Hourly API, CI-minute or credit cap exhausted | Lower concurrency or trigger breadth; adopt the shared API budget below |
| Permission | BLOCKED on a missing tool, scope or ruleset |
One human-only request; or remove the step that needs it |
| Prompt drift | Rising BLOCKED or invalid outputs after a revision; humans overriding outputs |
Revert to the last good revision, or propose one contract-rule change |
| Orphaned | Branch or PR with an owner that stopped (host restart, interrupted session) | Take over (below) |
| Trigger | Eligible items with no run (filter too narrow); or many runs per item (too broad) | Adjust one trigger filter; add a sweep |
| Review / merge | Green PRs waiting on threads or approvals | Thread-resolution sweep; check the autonomy level is what the human intended |
| Busy-but-idle | Session reports busy, but there has been no new turn or tool call for longer than IDLE_AFTER |
Rekick with what changed and what's expected. Judge liveness by the last tool timestamp, not a status flag |
| Host restart | Coordinator and children went idle at the same time, right after a deploy of the platform they run on | Resume the root first, then its children. Make "resume self" the last step of any self-deploy |
| Self-echo / no-op storm | No-op wakes above 50%, or any wakes triggered by the agent's own writes | Tighten the wake filter (see automate-it step 3) |
| Tool-profile mismatch | A tool fails on every call; a write tool sits in a read-only profile | Remove it, or fix the profile. Every-call failures are a config bug, not flakiness |
Takeover protocol
- Find candidates: open PRs or branches with no commits for longer than
ORPHAN_AFTER, whose owner session or automation is no longer running. - Verify state: head SHA, CI on that SHA, unresolved threads, mergeability, and the linked issue's acceptance check.
- Claim visibly: comment "taking over from <owner> at <sha>: <next step>" and assign yourself (or the worker that will continue).
- Continue from the existing branch. Don't rewrite or force-push someone else's commits; add commits on top.
- If the work is obsolete (superseded, already fixed on main), close it with a one-line reason and a link, only if
TAKEOVERallows closing. - Record the takeover. If the original owner reappears, hand back with the current state.
Shared API budget
Quota is the failure mode that grows with success: more agents, more polling, more calls per merge.
- Inventory callers: every automation, worker and local loop that reads GitHub, with calls per run.
- Set a per-unit budget, for example at most 75 REST calls per merged PR across all callers, and a per-hour ceiling below the token's limit.
- Pace through one budget, not N independent ones. Priority order: merge-path work first, reports last.
- Cut calls before adding retries: read the head SHA only; one batched GraphQL read per wake; bounded pages; cached job lists; wait on events instead of polling.
- Alert on overspend: calls per merged PR above budget, or any 403/429, is a
Rate limitorQuotastall.
Dials
| Dial | Default | Options |
|---|---|---|
STALL_THRESHOLD |
2 h without a merge during active hours, report only | Minutes; per repo |
| Schedule | Hourly during active runs; weekly otherwise | interval; automation_failed |
TAKEOVER |
propose (list candidates, don't act) |
continue (claim and push), continue_and_close |
ORPHAN_AFTER |
2 h without commits and no live owner | Duration |
| Change authority | Propose only | Apply prompt changes via a human; never self-update automations |
| Merge stalled green PRs | Off | On, at the level set in docs/autonomy.md |
| API budget | 75 REST calls per merged PR | Integer; per-hour ceiling |
| Quiet hours | None | No human pings between X and Y; batch into the morning report |
Outputs
- A health report (silent when healthy) with stalls, evidence, one change or "no change", and a prediction.
- Takeover comments and records.
- At most one proposed change per run, for example a
propose_automation_updateor a PR to a prompt file.
To run the weekly automation half unattended, install automations/automation-health.
This skill's own feedback loop
- Headline metric: stall minutes per day (time since last merge above threshold), and human rekicks or "why did it stall?" asks per week (target zero).
- Prediction score: for each proposed change, did the predicted metric move within the window? Keep a running hit rate. If "no change" runs are followed by the same stall twice, escalate the class.
Failure modes it prevents
- The human as the watchdog, computing time since last merge by eye.
- Changing three things at once and learning nothing.
- Half-done PRs left by interrupted sessions.
- Agents exhausting a shared API quota and taking every other agent down with them.
- Asking the same human-only question every hour.
Why this exists
- Morning messages in one long unattended run: "no merged commits in 19 hours", "no commit all night", "lots of draft PRs, nothing merged for 8 hours". The human computed the metric himself for about two weeks before it became a 30-minute job; once encoded, overnight stalls became visible and short.
- Rekicking interrupted child sessions was the top manual chore (at least 7 explicit requests) until it became a rule that the human should never have to ask.
- Scheduled single-shot runs spend 7–13% of runs checking state and exiting. Event-woken, long-lived sessions are different: in one sample, about 62% of wakes were no-ops and about 16% were self-echo. A watchdog must know which kind of lane it is judging.
- CI babysitters once made about 45k API calls in 3 hours and hit the rate limit. The fix was a shared budget and fewer calls per merge, not retries.
- In one fleet of hosted agents, the secondary rate limit was mentioned more than 15 times as often as flaky tests. The damage came from misreading a rate-limited 403 as access-denied and reporting merges as failed. The fix was classification plus one paced budget, not retries.
- Revisions that changed one thing (a model swap, a prompt cut 15% with the same rules) could be judged; "no change" was often the right answer.
04 同仓库更多 Skills
重复纠正根因修复
steer-once
将你反复重复的纠正转化为持久性修复:挖掘你的各类纠正并分类,选择能够预防这些纠正的最低成本层级(指令、技能、lint/CI 检查、测试、自动化或产品 bug 报告),提交一个带证据块的 PR,然后在 K 天后重新度量,并决定保留、升级或回滚。由于会创建 PR,因此仅在 `/lever steer` 或明确要求(“挖掘我的纠正”“为什么我总跟你说 X”“我不是给过你一个技能来做这个吗”),或当 prompt-mirror 在 3 个及以上会话中报告同一类纠正且你表示同意时才运行。
大规模代码重构流水线
refactor-pipeline
以三个独立通道——生产者(producer)、打包者(packager)和牧羊人(shepherd)——运行大规模的机械式重构(crate 或 package 拆分、模块提取、API 迁移、死代码删除),这些通道仅通过 git 和 PR 栈进行协调。它会推送分支并创建 PR,因此仅在 `/lever refactor` 或明确要求(“拆分此 crate”“拆分这个单体”“这个模块太大了,把它精简一下”“迁移所有调用方”)时运行。
Copilot 提示词习惯分析
prompt-mirror
挖掘本地 Copilot 会话历史,返回一份关于你如何指导智能体的评分卡,并附上三条建议,用你自己的前后对比消息加以说明。由于它读取你的私有历史,因此仅在 `/lever mirror` 或明确请求(“我的提示词水平如何?”、“指导我改进”、“挖掘我的会话”、“我总是在重复什么?”、每周自我复盘)时运行。
长时任务进度契约跟踪
progress-contract
推动长时间运行或委派的任务进展,让人类无需轮询。它会发布带有 ETA 及各自所需证据的里程碑,仅在发生重大变化时发送报告,为每项声明标注证据等级,记录 ETA 准确性,监控距上次合并的时间,并在宣布“完成”之前依据证据对“完成”状态进行审计。适用于任何委派的、耗时数小时或通宵运行的任务,当任务简报设定了报告契约时,或当用户询问“状态如何?”、“预计何时完成?”、“我们进行到哪了?”、“昨晚发生了什么?”、“逐小时汇报”或“你完成了吗?”时。
PR 落地合并驱动
pr-shepherd
通过事件驱动循环推动开放的拉取请求直至落地。每次唤醒时执行一次批量读取,修复红色必填检查的根本原因,处理每一条审查讨论线程,并按照自主性拨盘设定的级别执行落地。由于它会推送代码并可能执行合并,因此仅在 `/lever shepherd`、来自 lever 协调器的移交、被标记为 shepherding 的 PR,或明确请求(“监控 CI 直至通过”、“推送修复直到通过”、“解决审查讨论线程”、“通过即合并”、“照看这个 PR”、“shepherd”)时运行。
Lever 技能统一入口
lever
统一的 lever 命令。`/lever <verb> [args]` 直接运行某个 lever 技能(loop、arms、review、brief、deliver、refactor、backlog、shepherd、land、status、automate、health、mirror、steer、autonomy、spend、setup、help)。`/lever <plain words>` 会为你挑选合适的动词,用一行说明所选动词,然后执行。该技能还会读取和写入 `~/.copilot/lever.yml` 中用户的个人拨盘设置。当用户键入 /lever、询问“我应该使用哪个 lever 技能?”,或想查看或更改其自主性(autonomy)或支出(spend)拨盘时使用。