@1aboveio/skills 1.0.30 → 1.0.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.codex-plugin/plugin.json +1 -1
- package/.codex-plugin/resources.json +140 -138
- package/package.json +4 -4
- package/skills/app-dev/airflow/SKILL.md +1 -1
- package/skills/app-dev/android-development/SKILL.md +1 -1
- package/skills/app-dev/app-debug/SKILL.md +1 -1
- package/skills/app-dev/better-auth/SKILL.md +1 -1
- package/skills/app-dev/data-catalog/SKILL.md +1 -1
- package/skills/app-dev/data-quality/SKILL.md +1 -1
- package/skills/app-dev/ios-foundation/SKILL.md +1 -1
- package/skills/app-dev/maestro/SKILL.md +1 -1
- package/skills/app-dev/monorepo/SKILL.md +1 -1
- package/skills/app-dev/nextjs-fullstack/SKILL.md +1 -1
- package/skills/app-dev/prisma-setup/SKILL.md +1 -1
- package/skills/app-dev/pyspark/SKILL.md +1 -1
- package/skills/app-dev/python-backend/SKILL.md +1 -1
- package/skills/app-dev/shadcn/SKILL.md +1 -1
- package/skills/app-dev/zod-v4/SKILL.md +1 -1
- package/skills/cicd/cloud-build/SKILL.md +1 -1
- package/skills/cicd/cloud-debug/SKILL.md +1 -1
- package/skills/cicd/cloud-deploy/SKILL.md +1 -1
- package/skills/cicd/docker/SKILL.md +1 -1
- package/skills/cicd/github-actions/SKILL.md +41 -127
- package/skills/cicd/github-actions/references/audit-and-cleanup.md +148 -116
- package/skills/cicd/github-actions/references/audit-profile-optimize.md +3 -151
- package/skills/cicd/github-actions/references/ci-case-studies.md +3 -10
- package/skills/cicd/github-actions/references/pipeline.md +5 -6
- package/skills/cicd/github-actions/references/runners.md +5 -9
- package/skills/cicd/github-actions/references/speed-and-audit.md +31 -116
- package/skills/cicd/github-flow/SKILL.md +1 -1
- package/skills/cicd/google-cloud/SKILL.md +1 -1
- package/skills/cicd/mergify/SKILL.md +4 -1
- package/skills/cicd/mergify/references/watch-contract.md +73 -16
- package/skills/cicd/mergify/scripts/batch-health.mjs +98 -0
- package/skills/cicd/mergify/scripts/read-delivery-attention.mjs +17 -0
- package/skills/cicd/mergify/scripts/watch-pr-delivery-core.mjs +58 -22
- package/skills/cicd/podman/SKILL.md +1 -1
- package/skills/content/article-review/SKILL.md +1 -1
- package/skills/content/article-to-image/SKILL.md +1 -1
- package/skills/content/flowchart-svg/SKILL.md +1 -1
- package/skills/content/image-gen/SKILL.md +1 -1
- package/skills/content/mermaid/SKILL.md +1 -1
- package/skills/content/wechat-article-writer/SKILL.md +1 -1
- package/skills/content/wechat-publisher/SKILL.md +1 -1
- package/skills/content/wechat-search/SKILL.md +1 -1
- package/skills/content/xai-search/SKILL.md +1 -1
- package/skills/core/distill-writing/SKILL.md +1 -1
- package/skills/core/doc-to-md/SKILL.md +1 -1
- package/skills/core/editorial-review/SKILL.md +1 -1
- package/skills/core/house-style/SKILL.md +1 -1
- package/skills/core/plain-language/SKILL.md +1 -1
- package/skills/core/polish-cn/SKILL.md +1 -1
- package/skills/core/reg-parser/SKILL.md +1 -1
- package/skills/core/terminology/SKILL.md +1 -1
- package/skills/core/write-doc/SKILL.md +1 -1
- package/skills/core/write-report/SKILL.md +1 -1
- package/skills/engineering/better-review/SKILL.md +1 -1
- package/skills/engineering/e2e-test/SKILL.md +1 -1
- package/skills/engineering/engineering/SKILL.md +1 -1
- package/skills/engineering/engineering-runtime/SKILL.md +1 -1
- package/skills/engineering/engineering-runtime/coherence/workflow.json +13 -13
- package/skills/engineering/ensure-coverage/SKILL.md +1 -1
- package/skills/engineering/golden-path/SKILL.md +1 -1
- package/skills/engineering/harness-runtime/SKILL.md +1 -1
- package/skills/engineering/resolve-issues/SKILL.md +1 -1
- package/skills/engineering/resolve-release/SKILL.md +1 -1
- package/skills/engineering/rush-issues/SKILL.md +1 -1
- package/skills/engineering/rush-release/SKILL.md +1 -1
- package/skills/engineering/test-quality/SKILL.md +1 -1
- package/skills/risk-compliance/compliance-audit/SKILL.md +1 -1
- package/skills/risk-compliance/contract-compare/SKILL.md +1 -1
- package/skills/risk-compliance/contract-review/SKILL.md +1 -1
- package/skills/risk-compliance/doc-authenticity/SKILL.md +1 -1
- package/skills/risk-compliance/fraud-detection/SKILL.md +1 -1
- package/skills/risk-compliance/payment-analysis/SKILL.md +1 -1
- package/skills/risk-compliance/portfolio-payment-analysis/SKILL.md +1 -1
- package/skills/risk-compliance/similar-domain/SKILL.md +1 -1
- package/skills/risk-compliance/tld-detection/SKILL.md +1 -1
|
@@ -1,124 +1,39 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
node <github-actions>/scripts/ci-run-audit.mjs --repo <owner/repo> --runs 60
|
|
21
|
-
# Optional replay:
|
|
22
|
-
node <github-actions>/scripts/ci-run-audit.mjs --repo <owner/repo> --runs 60 --save runs.json
|
|
23
|
-
node <github-actions>/scripts/ci-run-audit.mjs --from runs.json --json
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
| Section | Finds | Typical fix |
|
|
27
|
-
|---|---|---|
|
|
28
|
-
| Re-proved trees | matching workflow/job run-tree metadata: PR → queue → main; tested checkout unverified | queue → main: drop the `push: main` trigger, don't build reuse; PR → queue: run each heavy check in one lane; changed queue trees still validate |
|
|
29
|
-
| Catch yield | per job: failures, sole catches, flakes; jobs with no sole catch over 20+ code states | merge, move off the PR lane, or retire |
|
|
30
|
-
| Overlap | a job whose every failure coincided with another job failing | read one log of each; merge or fix the shared fixture |
|
|
31
|
-
| Setup share | jobs that are ≥70% overhead | fold them into one job |
|
|
32
|
-
| Critical path | PR wait p50/p90 and which job finishes last | inspect that job's dependency chain; optimize the evidenced execution or scheduling bottleneck |
|
|
33
|
-
| Stuck + queue | jobs past 6h; runner queue time | fix the runner; add `timeout-minutes` |
|
|
34
|
-
|
|
35
|
-
Read it as candidates, not verdicts. A job with no catches may guard a rare, costly path
|
|
36
|
-
(security, money); a date- or network-dependent job (quarantine expiry, live smoke) may
|
|
37
|
-
repeat on the same tree on purpose. Pass `--ignore-job <regex>` for repo-specific roll-up
|
|
38
|
-
jobs so they do not make every failure look shared. First org run (2026-09-27): four of
|
|
39
|
-
seven repos spent 40–48% of passing job-minutes re-proving identical trees, and one had 14
|
|
40
|
-
jobs hung for 24h.
|
|
41
|
-
|
|
42
|
-
## Speed
|
|
43
|
-
|
|
44
|
-
- **Caching.** GitHub-hosted: `setup-node` with `cache: pnpm`, `setup-uv` with
|
|
45
|
-
`enable-cache: true`. Self-hosted: prefer the runner-local pnpm store and uv cache over
|
|
46
|
-
`actions/cache`. A restore over the network measured 5m30s against a 21 s cold install.
|
|
47
|
-
Measure before adding a cache; `actions/cache` is remote, so on a LAN fleet it is
|
|
48
|
-
usually the wrong fix. Read each job's warm/cold status from its install log (the
|
|
49
|
-
store's reused-package count) before blaming downloads. With a LAN proxy and warm
|
|
50
|
-
per-slot stores, installs took 4–19 s; the rest was repeated work (duplicate type
|
|
51
|
-
checks, sequential DB prepare scripts, cold framework builds), not downloads.
|
|
52
|
-
- **One type-check gate.** A framework build that type-checks (`next build`) inside every
|
|
53
|
-
test shard repeats the standalone, incremental `tsc` gate: 49 s × 5 shards plus 22 s in
|
|
54
|
-
the build job, against ~5 s for the gate. Disable the build's type check with a CI-only
|
|
55
|
-
flag in those jobs, keep the standalone gate required, and confirm its tsconfig covers
|
|
56
|
-
the same files. Never drop type checking from CI: local checks get skipped. Same for
|
|
57
|
-
lint-during-build versus a lint gate.
|
|
58
|
-
- **Lockfile policy checks.** A supply-chain or policy check over the lockfile can be most
|
|
59
|
-
of the install (35–41 s, ~80%). Run it when the lockfile or its policy inputs differ
|
|
60
|
-
from an already-verified base, including in the queue when the batch changes them;
|
|
61
|
-
skip it on PRs whose lockfile matches base. Or give it a persistent metadata cache if
|
|
62
|
-
it supports one.
|
|
63
|
-
- **Build once, fan out.** Build in one job, `upload-artifact` (with `include-hidden-files: true`
|
|
64
|
-
for `.next`), shard e2e with `--shard=${{ matrix.shard }}/N`, `fail-fast: false`, and roll up
|
|
65
|
-
in the gate.
|
|
66
|
-
- **Timeout ladder.** Every job has `timeout-minutes`. Install budget < step timeout < job
|
|
67
|
-
timeout, with measured headroom for startup, diagnostics and cleanup between the inner
|
|
68
|
-
and outer limits. The job timeout is the only hang limit: the merge queue sets none
|
|
69
|
-
(`mergify` skill: `checks_timeout: null`). A job without
|
|
70
|
-
a timeout on a self-hosted slot can hold it for hours to days; self-hosted jobs lack
|
|
71
|
-
the six-hour cap GitHub-hosted jobs have.
|
|
72
|
-
- **Concurrency.**
|
|
1
|
+
# Execution recipes
|
|
2
|
+
|
|
3
|
+
For the audit procedure, evidence rules and prioritization, use
|
|
4
|
+
[CI audit and cleanup](audit-and-cleanup.md). Read these recipes only when the evidence
|
|
5
|
+
identifies the corresponding cost.
|
|
6
|
+
|
|
7
|
+
- **Dependency downloads:** on GitHub-hosted runners consider `setup-node` with
|
|
8
|
+
`cache: pnpm` or `setup-uv` with `enable-cache: true`. Fleet stores and proxy integration
|
|
9
|
+
are defined in [runners.md#packages-and-caches](runners.md#packages-and-caches).
|
|
10
|
+
- **Duplicate type/lint work:** retain one qualifying required check, then disable the
|
|
11
|
+
copies in framework builds with a CI-only flag. Confirm equivalent file/config coverage.
|
|
12
|
+
- **Lockfile policy:** run against changes to the lockfile or policy inputs relative to
|
|
13
|
+
a verified base, including a queue batch that changes them. Skip the reload only with
|
|
14
|
+
an existing repo command; otherwise retain it. A supported persistent metadata cache
|
|
15
|
+
is another candidate.
|
|
16
|
+
- **Build artifacts:** when compatible consumers can reuse one build, use
|
|
17
|
+
`upload-artifact` with `include-hidden-files: true` for `.next`. For E2E shards use
|
|
18
|
+
`--shard=${{ matrix.shard }}/N`, `fail-fast: false`, and aggregate in the existing gate.
|
|
19
|
+
- **Superseded PRs:** use a workflow/ref concurrency group and cancel only PR runs:
|
|
73
20
|
```yaml
|
|
74
21
|
concurrency:
|
|
75
22
|
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
|
76
23
|
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
|
|
77
24
|
```
|
|
78
|
-
Never cancel deploy, publish
|
|
79
|
-
- **Retries
|
|
80
|
-
pass-on-retry
|
|
81
|
-
- **
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
sibling containers. Test-content cleanup belongs to `test-quality` through the
|
|
90
|
-
[cleanup method](audit-and-cleanup.md#cleanup-method).
|
|
91
|
-
- **Disposable Postgres.** Configure self-hosted jobs with infra's slot-pod helper
|
|
92
|
-
and supplied endpoint, following the [PostgreSQL workflow templates](postgres-workflows.md).
|
|
93
|
-
Infra owns resource enforcement; budget database and test processes together.
|
|
94
|
-
Prefer size-bounded tmpfs when the supported helper/storage contract permits it;
|
|
95
|
-
it changes no durability setting. Profile launch, readiness and schema preparation separately. Turn
|
|
96
|
-
durability off only when measured and not testing persistence/recovery. Poll health
|
|
97
|
-
every 1–2 s, not 10 s (a 10 s interval wasted ~15 s per job), with retries that keep
|
|
98
|
-
the total timeout. Many sequential SQL prepare scripts (27–49 s per job) are CPU and
|
|
99
|
-
round-trip bound, so tmpfs does not fix them: run them in one session, parallelize the
|
|
100
|
-
independent ones, or restore a snapshot keyed on a hash of the schema and prepare
|
|
101
|
-
inputs. [runners.md](runners.md#services-and-networking).
|
|
102
|
-
- **Failure artifacts only.** Playwright: `screenshot: 'only-on-failure'`,
|
|
103
|
-
`trace: 'retain-on-failure'`, `video: 'off'`. Upload artifacts `if: failure()`.
|
|
25
|
+
Never cancel deploy, publish or post-deploy runs; builds can finish out of order.
|
|
26
|
+
- **Retries:** none on PRs; at most one in the queue lane. Log `[flake-retry]` so a
|
|
27
|
+
pass-on-retry remains visible.
|
|
28
|
+
- **Database preparation:** profile launch, readiness and schema preparation separately.
|
|
29
|
+
Poll readiness every 1-2 seconds with retries preserving the total timeout. Batch SQL
|
|
30
|
+
in one session, parallelize independent scripts, or key snapshots on every schema and
|
|
31
|
+
preparation input. Use the [PostgreSQL interface](postgres-workflows.md); tmpfs does
|
|
32
|
+
not fix round-trip-bound SQL. Durability reduction needs measurement and tests that
|
|
33
|
+
do not require persistence/recovery semantics.
|
|
34
|
+
- **Browser artifacts:** `screenshot: 'only-on-failure'`, `trace: 'retain-on-failure'`,
|
|
35
|
+
`video: 'off'`; upload on failure and preserve producer failures.
|
|
104
36
|
|
|
105
37
|
## SLA
|
|
106
38
|
|
|
107
|
-
|
|
108
|
-
teardown. Apply the [audit checklist and cleanup method](audit-and-cleanup.md) to jobs
|
|
109
|
-
above that target. Also apply these inclusive full-run limits:
|
|
110
|
-
|
|
111
|
-
| Run type | Maximum duration |
|
|
112
|
-
|---|---|
|
|
113
|
-
| Overall workflow run | ≤ 20 min |
|
|
114
|
-
| Merge-queue admission | ≤ 5 min |
|
|
115
|
-
| Queue validation | ≤ 15 min |
|
|
116
|
-
|
|
117
|
-
For merge-queue workflows, use the applicable admission or queue limit. Measure from
|
|
118
|
-
run creation through completion, including scheduling, dependency waits, E2E, builds,
|
|
119
|
-
artifacts and teardown. Break out wait and execution for diagnosis; do not sum parallel
|
|
120
|
-
job times or stop timing at an earlier gate while reporting jobs still run. Queue
|
|
121
|
-
residence before the validation workflow is created is a separate measurement.
|
|
122
|
-
|
|
123
|
-
Over either job or run budget -> inspect the critical path and scheduling, fix the
|
|
124
|
-
cause, and verify both limits. Several individually fast jobs can still form a slow run.
|
|
39
|
+
See the authoritative [timing targets](audit-and-cleanup.md#timing-targets).
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: github-flow
|
|
3
3
|
description: "Deliver a committed change to done: push, open a PR, wait for its checks, and merge through the repo's flow (direct push, pull request, or merge queue). Use whenever you commit or finish a change, when CONTRIBUTING.md has a Delivery section, and for asks like 'commit this', 'push it', 'open a PR', 'ship it', 'land it', 'get it merged', 'is my PR green', 'wait for CI', 'merge once the checks pass', 'confirm it really merged'. Every wait here runs the bundled scripts/watch-checks.mjs: never hand-roll a gh pr view or gh pr checks --watch polling loop, and never call a branch merged without the merge commit. Also: declare a repo's delivery flow, or write the CI conventions and Delivery section into CONTRIBUTING.md on request. NOT for writing workflow YAML (github-actions), Mergify config or a stuck queued PR (mergify), cutting a release (resolve-release), or PRs that resolve-issues or rush-issues deliver."
|
|
4
|
-
release-version: 0.50.
|
|
4
|
+
release-version: 0.50.12
|
|
5
5
|
---
|
|
6
6
|
**Updates:** Once/session run `node <skill-base-dir>/release-check.mjs`.
|
|
7
7
|
# GitHub Flow
|
|
@@ -5,7 +5,7 @@ description: >
|
|
|
5
5
|
project management. Use when configuring GCP resources, managing service
|
|
6
6
|
accounts, setting up IAP access, configuring VPC networks, managing secrets,
|
|
7
7
|
or debugging cloud infrastructure.
|
|
8
|
-
release-version: 0.50.
|
|
8
|
+
release-version: 0.50.12
|
|
9
9
|
---
|
|
10
10
|
**Updates:** Once/session run `node <skill-base-dir>/release-check.mjs`.
|
|
11
11
|
# Google Cloud Platform (GCP) Skill
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: mergify
|
|
3
3
|
description: "Mergify merge queue and stacked PRs (`mergify stack`): config, rules, queue status, delivery. Use whenever a merge queue or stack is involved, including plain asks ('watch #123 till it merges', 'where is #412', 'push this stack'): `gh pr view`/`gh pr checks` cannot see a dequeue; use `mergify queue show`, and `watch_delivery` (else the bundled watcher) to watch. Also: stack hooks ('use mergify stack push'), a missing Change-Id; authoring or debugging `.mergify.yml`, queue rules, merge protections, batch size, the queue-only ruleset; enqueue policy (`@mergifyio queue` vs `auto_merge_conditions`); a push dequeuing a queued PR; bypass actors; freezing a branch. Failures: a PR stuck, queued but never merging, or merged unqueued; CI green on GitHub but unmet in Mergify; a batch going red or bisecting; a queue check missing not failing. Outranks the vendor mergify-* skills. NOT for pushing a PR in a repo without stack hooks (github-flow), workflow YAML (github-actions), or GCP deploy pipelines (cloud-deploy)."
|
|
4
|
-
release-version: 0.50.
|
|
4
|
+
release-version: 0.50.12
|
|
5
5
|
---
|
|
6
6
|
**Updates:** Once/session run `node <skill-base-dir>/release-check.mjs`.
|
|
7
7
|
# Mergify Merge Queue
|
|
@@ -80,6 +80,9 @@ node ~/.agents/skills/mergify/scripts/watch-pr-delivery.mjs --repo <owner/repo>
|
|
|
80
80
|
```
|
|
81
81
|
|
|
82
82
|
- Enqueue first; the watch never enqueues.
|
|
83
|
+
- Before parking, establish the [queued-health attention handoff](references/watch-contract.md#queued-health-and-attention-handoff).
|
|
84
|
+
A terminal-only `watch_delivery` callback needs a separate subscription to the watch's
|
|
85
|
+
`--attention-file`; report an unavailable live channel rather than claiming stderr notifies you.
|
|
83
86
|
- When it ends, read the last log line (`{"ciProfileSummary":true,…}`), not just the exit code,
|
|
84
87
|
and pass any slow job to the user.
|
|
85
88
|
- A `for i in $(seq …); do gh pr view …` loop is the failure that keeps recurring: it cannot see
|
|
@@ -175,6 +175,63 @@ so the newest batch wins over stale comment fallback.
|
|
|
175
175
|
|
|
176
176
|
## Watcher Requirements
|
|
177
177
|
|
|
178
|
+
### Queued Health And Attention Handoff
|
|
179
|
+
|
|
180
|
+
Lifecycle and delivery health are separate. A completed failing current-batch check
|
|
181
|
+
reports attention while lifecycle stays `QUEUED`; Mergify still owns retries, bisection
|
|
182
|
+
and real dequeue. The watcher continues until its existing terminal condition or bound.
|
|
183
|
+
|
|
184
|
+
Each readable active queue observation supplies the current batch relationship. The
|
|
185
|
+
watcher reads that batch's exact head and check rollup in one bounded call. It never
|
|
186
|
+
uses a retained old batch to infer live health. Queue session/entry, original head,
|
|
187
|
+
batch number/head, check identity, execution ID/link and start time bind the evidence.
|
|
188
|
+
Newest same-check executions replace older failures, including same-SHA reruns.
|
|
189
|
+
An unreadable batch reports `unavailable` and retains `lastReadable` and open incidents;
|
|
190
|
+
it supplies neither progress, success, failure nor dequeue evidence.
|
|
191
|
+
|
|
192
|
+
Health states are `running`, `check-failed`, `failed-producer-missing-gate`,
|
|
193
|
+
`missing-gate`, `healthy`, `unknown`, and `unavailable`. Pass repeatable
|
|
194
|
+
`--required-check <exact-name>` for required gates; simple resolved queue-rule
|
|
195
|
+
`check-success=<name>` merge conditions are also accepted. With no known required
|
|
196
|
+
checks the watcher cannot assert a missing gate. Conditional rules need explicit
|
|
197
|
+
caller-resolved names. A failed producer and absent gate do not prove that the checks
|
|
198
|
+
API failed: this rollup path reports the narrower fact, not publication failure.
|
|
199
|
+
|
|
200
|
+
**The supervisor boundary is explicit.** This repository ships the watcher, not the
|
|
201
|
+
installed harness's `watch_delivery` tool or its native attention channel. A caller
|
|
202
|
+
that receives only terminal callbacks must set up the following handoff before
|
|
203
|
+
parking; stderr transitions alone do not deliver attention:
|
|
204
|
+
|
|
205
|
+
1. Allocate a unique `--attention-file <absolute-path>` per watch in a caller-owned
|
|
206
|
+
run directory. The watcher appends and fsyncs NDJSON events there, including under
|
|
207
|
+
`--quiet`. Without the option it allocates a temporary journal and reports its path;
|
|
208
|
+
that fallback preserves evidence but does not establish a live supervisor subscription.
|
|
209
|
+
2. Subscribe through the supervisor's native file/event attention facility, or use a
|
|
210
|
+
supervised command watcher running
|
|
211
|
+
`node <mergify>/scripts/read-delivery-attention.mjs <file> <line-cursor>`.
|
|
212
|
+
The reader returns `{cursor,events}` and exits 0 when events exist, 4 when there are
|
|
213
|
+
none, and 2 for unavailable/invalid input. It tolerates an incomplete trailing line.
|
|
214
|
+
Register/rearm this subscription at the configured observation interval or faster,
|
|
215
|
+
alongside the still-running delivery task. This is an event subscription, not a
|
|
216
|
+
second lifecycle poller. If the harness has neither facility, report the unsupported
|
|
217
|
+
live notification boundary before waiting; do not claim a terminal callback covers it.
|
|
218
|
+
3. Deliver `attention` immediately with its batch/head/attempt, failed producer run
|
|
219
|
+
URL, missing gates and suggested investigation. Persist the cursor after delivery;
|
|
220
|
+
deduplicate delivery by watch journal plus event position. Rearm for retries,
|
|
221
|
+
recovery, supersession and observation outages. Never rerun or mutate delivery
|
|
222
|
+
automatically. The installed `watch_delivery` adapter must implement this handoff
|
|
223
|
+
before its terminal-only callback can satisfy live attention.
|
|
224
|
+
|
|
225
|
+
Identical evidence produces one attention event. New failure executions, active retry,
|
|
226
|
+
recovery and replacement produce transitions. Repeated polls and readability changes
|
|
227
|
+
do not reset the stall clock; new readable check evidence does. The terminal
|
|
228
|
+
`deliveryHealth` retains every incident and run link, its blocked duration, retry or
|
|
229
|
+
supersession resolution and recovery time. Blocked duration runs from observed failure
|
|
230
|
+
to observed retry/replacement/recovery (or watch end if still open), including unreadable
|
|
231
|
+
gaps. This is observation time, not an estimate of unobserved failure time. Queue wait
|
|
232
|
+
stays in `ciProfile.phases`; CI job execution remains in `ciProfile.jobs`. An `ok`
|
|
233
|
+
job-duration profile says nothing about whether delivery had a recovered incident.
|
|
234
|
+
|
|
178
235
|
- Run as one background task or one script invocation; do not spend foreground turns polling.
|
|
179
236
|
- Retry transient `gh`, GraphQL, and Mergify CLI failures. EOF, TLS handshake timeouts, and temporary API failures are not dequeue signals — an unreadable read is *no information*, not a "not queued" observation, and must not advance the counter that settles `DEQUEUED`. Retain that source's last readable stall-state contribution instead; a readable sibling can still report genuine progress and reset the change clock.
|
|
180
237
|
- Bound every subprocess read on its own timeout, in addition to the stall/ceiling bounds below — those are only evaluated after a poll returns, so an unbounded read can hang the watcher past both of them.
|
|
@@ -204,7 +261,9 @@ Options:
|
|
|
204
261
|
| `--admission-stall-minutes` | `3` | pre-admission terminal stall bound — no observable change *before this process has observed membership* is `STALLED` with `reason: "admission-stall"`. Shorter on purpose: after enqueue, queue entry should appear quickly, and a dead admission path must not wait out the full post-entry bound. Capped at `--stall-minutes` so a caller that shortens the post-entry bound keeps both phases tight. Applies only while no non-Mergify check is pending; while CI runs, the post-entry bound applies, so a CI-gated admission needs no relaunch |
|
|
205
262
|
| `--max-minutes` | `60` | absolute safety ceiling; bounds the watch even while the queue keeps reporting change, so a busy queue whose position keeps moving cannot keep the stall clock resetting forever. **60 minutes is also a hard maximum** — a larger value exits `2` rather than being silently clamped, because a caller that believes it has a four-hour watch and has one hour is worse off than one told plainly to relaunch. An hour without a verdict is a queue to hand back to a human or relaunch. The sibling `resolve-issues` watcher enforces the same ceiling; a cap honoured by one of two watchers is not a cap |
|
|
206
263
|
| `--slow-job-minutes` | `5` | warn when a single CI job runs longer than this (see [CI profile](#ci-profile)) |
|
|
207
|
-
| `--quiet` | off | suppress delivery/readability transition records on stderr (slow-job warnings and
|
|
264
|
+
| `--quiet` | off | suppress delivery/readability transition records on stderr (the durable health journal, slow-job warnings and closing profile still remain) |
|
|
265
|
+
| `--attention-file` | temporary journal | caller-owned unique event journal for the live supervisor handoff above |
|
|
266
|
+
| `--required-check` | resolved simple merge conditions | repeatable exact required-check name; resolve conditional policy at the caller |
|
|
208
267
|
|
|
209
268
|
Output streams:
|
|
210
269
|
|
|
@@ -216,23 +275,21 @@ Output streams:
|
|
|
216
275
|
Each regular-poll subprocess read (`gh pr view`, `mergify queue show`) also carries its own bounded
|
|
217
276
|
timeout — a small multiple of `--interval-seconds`, clamped to never exceed the **effective
|
|
218
277
|
phase stall bound** (pre-admission: `--admission-stall-minutes`; post-entry: `--stall-minutes`)
|
|
219
|
-
capped by `--max-minutes`, then divided by the
|
|
220
|
-
`gh pr view` + `mergify queue show`).
|
|
278
|
+
capped by `--max-minutes`, then divided by the maximum reads made per poll (3 here:
|
|
279
|
+
original `gh pr view` + `mergify queue show` + current batch `gh pr view`). These reads together cannot outlive the bound that will
|
|
221
280
|
actually fire `STALLED` on this poll — so a hung pre-admission poll cannot outlive the short
|
|
222
281
|
admission clock, and a post-entry poll is not permanently clamped to the admission value.
|
|
223
|
-
At
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
in queue membership, the absence counter, or the stall clock.
|
|
282
|
+
At dequeue one additional bounded batch read enriches the settled verdict. Other terminal
|
|
283
|
+
paths reuse the last live batch read when available, or read once for profiling. Batch
|
|
284
|
+
health never participates in queue membership or the absence counter.
|
|
227
285
|
Those stall/ceiling bounds are only evaluated after a poll returns, and a single hung read
|
|
228
|
-
cannot alone consume more than
|
|
286
|
+
cannot alone consume more than a third of a small stall/ceiling bound. (The sibling watcher makes
|
|
229
287
|
one read per poll, so its clamp divides by 1 and the single-read guarantee is the whole bound
|
|
230
288
|
there.)
|
|
231
289
|
|
|
232
|
-
The `--interval-seconds` default is already set for scale.
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
(At the former 30s default it was 240/hour, or about 20 watchers.) The cost is at most 90s of
|
|
290
|
+
The `--interval-seconds` default is already set for scale. Up to three API calls per poll at
|
|
291
|
+
90s is 120/hour per watched PR; budget fan-out against the token's remaining quota.
|
|
292
|
+
The cost is at most 90s of
|
|
236
293
|
extra merge-detection latency against a queue that takes minutes per batch — a cheap trade.
|
|
237
294
|
Shorten it only for a single foreground watch where that latency actually matters.
|
|
238
295
|
|
|
@@ -248,11 +305,11 @@ The script emits JSON on stdout. The caller is responsible for recording the del
|
|
|
248
305
|
|
|
249
306
|
## CI profile
|
|
250
307
|
|
|
251
|
-
Every watch
|
|
252
|
-
|
|
308
|
+
Every watch profiles the CI it waited on. Timings reuse the original-PR and batch-health
|
|
309
|
+
reads, whose check runs carry their start and finish times.
|
|
253
310
|
|
|
254
|
-
- **Jobs.** Every non-Mergify check run on the PR
|
|
255
|
-
|
|
311
|
+
- **Jobs.** Every observed non-Mergify check run on the PR and current batch. Failed attempts
|
|
312
|
+
remain after reruns. Mergify's own checks are left out; their duration is queue wait, not CI work.
|
|
256
313
|
A job still running is timed up to now, so a slow job shows up while it is still running.
|
|
257
314
|
- **Slow-job warning.** A job that runs longer than `--slow-job-minutes` (default 5) gets one
|
|
258
315
|
`{"warning":"slow-ci-job","name",…,"durationSec","thresholdSec","detailsUrl"}` line on stderr,
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { openSync, writeSync, fsyncSync, closeSync, readFileSync } from 'node:fs'
|
|
2
|
+
|
|
3
|
+
const FAIL = new Set(['FAILURE', 'ERROR', 'CANCELLED', 'TIMED_OUT', 'ACTION_REQUIRED', 'STARTUP_FAILURE'])
|
|
4
|
+
const RUNNING = new Set(['QUEUED', 'IN_PROGRESS', 'PENDING', 'EXPECTED', 'WAITING', 'REQUESTED'])
|
|
5
|
+
|
|
6
|
+
// Check-run IDs distinguish same-SHA executions; start times order reruns when the
|
|
7
|
+
// rollup contains both attempts. Never let an older completed failure beat a retry.
|
|
8
|
+
export function latestChecks(checks = [], head) {
|
|
9
|
+
const latest = new Map()
|
|
10
|
+
for (const check of checks) {
|
|
11
|
+
if (check.headSha && check.headSha !== head) continue
|
|
12
|
+
const name = check.name || check.context
|
|
13
|
+
if (!name || name.startsWith('Mergify Merge ')) continue
|
|
14
|
+
const key = `${check.app?.slug || check.app?.id || ''}|${check.workflowName || ''}|${name}`
|
|
15
|
+
const rank = [Number(check.runAttempt || 0), Date.parse(check.startedAt || check.createdAt || '') || 0, Number(check.databaseId || check.id) || 0]
|
|
16
|
+
const prior = latest.get(key)
|
|
17
|
+
const different = prior ? rank.findIndex((n, i) => n !== prior.rank[i]) : -1
|
|
18
|
+
if (prior && rank.every((n, i) => n === prior.rank[i])) {
|
|
19
|
+
// Ambiguous duplicates are unavailable, not proof of a current failure.
|
|
20
|
+
if (JSON.stringify(check) !== JSON.stringify(prior.check)) latest.set(key, { rank, check: { name, status: 'UNKNOWN' } })
|
|
21
|
+
} else if (!prior || (different >= 0 && rank[different] > prior.rank[different])) {
|
|
22
|
+
latest.set(key, { rank, check })
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return [...latest.values()].map(({ check }) => ({
|
|
26
|
+
name: check.name || check.context,
|
|
27
|
+
identity: `${check.app?.slug || check.app?.id || ''}|${check.workflowName || ''}|${check.name || check.context}`,
|
|
28
|
+
execution: check.id || check.databaseId || check.detailsUrl || check.targetUrl || check.startedAt || null,
|
|
29
|
+
startedAt: check.startedAt || check.createdAt || null,
|
|
30
|
+
status: String(check.status && check.status !== 'COMPLETED' ? check.status : (check.conclusion || check.state || check.status || 'UNKNOWN')).toUpperCase(),
|
|
31
|
+
detailsUrl: check.detailsUrl || check.targetUrl || null,
|
|
32
|
+
})).sort((a, b) => a.identity.localeCompare(b.identity))
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export function observeBatchHealth({ previous = {}, batch = {}, binding, requiredChecks = [], nowMs }) {
|
|
36
|
+
const incidents = (previous.incidents || []).map((entry) => ({ ...entry }))
|
|
37
|
+
const unavailable = batch.readable === false || !binding?.head || !Array.isArray(batch.checks)
|
|
38
|
+
if (unavailable) return { ...previous, state: 'unavailable', available: false, error: batch.error || 'Current batch/head/check evidence unavailable', incidents,
|
|
39
|
+
events: previous.available === false ? [] : [{ type: 'observation-unavailable', binding, atMs: nowMs }], changed: false }
|
|
40
|
+
const checks = latestChecks(batch.checks, binding.head)
|
|
41
|
+
const missingRequiredChecks = requiredChecks.filter((name) => !checks.some((c) => c.name === name))
|
|
42
|
+
const failedProducers = checks.filter((c) => FAIL.has(c.status))
|
|
43
|
+
const key = JSON.stringify([binding, checks, missingRequiredChecks])
|
|
44
|
+
const changed = key !== previous.key
|
|
45
|
+
const state = failedProducers.length ? (missingRequiredChecks.length ? 'failed-producer-missing-gate' : 'check-failed')
|
|
46
|
+
: checks.some((c) => RUNNING.has(c.status)) ? 'running'
|
|
47
|
+
: missingRequiredChecks.length ? 'missing-gate' : checks.length && checks.every((c) => ['SUCCESS', 'NEUTRAL', 'SKIPPED'].includes(c.status)) ? 'healthy' : 'unknown'
|
|
48
|
+
const events = []
|
|
49
|
+
if (previous.available === false) events.push({ type: 'observation-restored', binding, state, atMs: nowMs })
|
|
50
|
+
const bindingKey = JSON.stringify(binding)
|
|
51
|
+
const evidenceKey = JSON.stringify([binding, failedProducers, missingRequiredChecks])
|
|
52
|
+
// A retry ends the observed blocked interval, but recovery requires readable
|
|
53
|
+
// successful evidence. Replacement is supersession, never successful recovery.
|
|
54
|
+
for (const incident of incidents.filter((entry) => entry.endedMs == null)) {
|
|
55
|
+
const same = incident.bindingKey === bindingKey
|
|
56
|
+
const stillFailed = same && failedProducers.some((c) => incident.failedProducers.some((old) => old.identity === c.identity && old.execution === c.execution && old.startedAt === c.startedAt))
|
|
57
|
+
if (!stillFailed) {
|
|
58
|
+
incident.endedMs = nowMs
|
|
59
|
+
incident.resolution = !same ? 'superseded' : state === 'healthy' ? 'recovered' : 'retry-or-evidence-changed'
|
|
60
|
+
events.push({ type: incident.resolution, incidentId: incident.id, binding, state, atMs: nowMs })
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
if (failedProducers.length && !incidents.some((entry) => entry.evidenceKey === evidenceKey)) {
|
|
64
|
+
const incident = { id: incidents.length + 1, binding, bindingKey, evidenceKey, failedProducers, missingRequiredChecks, startedMs: nowMs, endedMs: null, resolution: null }
|
|
65
|
+
incidents.push(incident)
|
|
66
|
+
events.push({ type: 'attention', incidentId: incident.id, binding, state, failedProducers, missingRequiredChecks,
|
|
67
|
+
action: 'Inspect the failed producer run; consider an authorized rerun after confirming the current batch and execution.', atMs: nowMs })
|
|
68
|
+
}
|
|
69
|
+
if (changed && !events.length) events.push({ type: 'health-transition', binding, state, atMs: nowMs })
|
|
70
|
+
if (state === 'healthy') {
|
|
71
|
+
for (const incident of incidents.filter((entry) => entry.bindingKey === bindingKey && entry.resolution === 'retry-or-evidence-changed' && !entry.recoveredMs)) {
|
|
72
|
+
incident.recoveredMs = nowMs
|
|
73
|
+
events.push({ type: 'recovered', incidentId: incident.id, binding, state, atMs: nowMs })
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
return { state, available: true, error: null, binding, checks, requiredChecks, requiredChecksKnown: requiredChecks.length > 0, missingRequiredChecks, failedProducers, key, changed, incidents, events,
|
|
77
|
+
lastReadable: { state, binding, checks, atMs: nowMs } }
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export function healthSummary(health, endMs) {
|
|
81
|
+
return { ...health, incidents: (health.incidents || []).map((incident) => ({ ...incident,
|
|
82
|
+
blockedDurationMs: Math.max(0, (incident.endedMs ?? endMs) - incident.startedMs) })) }
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export function appendHealthEvents(path, events) {
|
|
86
|
+
const fd = openSync(path, 'a', 0o600)
|
|
87
|
+
try {
|
|
88
|
+
for (const event of events) writeSync(fd, `${JSON.stringify(event)}\n`)
|
|
89
|
+
fsyncSync(fd)
|
|
90
|
+
} finally { closeSync(fd) }
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
// The supervisor persists the returned line cursor only after delivering the events.
|
|
94
|
+
export function readHealthEvents(path, after = 0) {
|
|
95
|
+
const text = readFileSync(path, 'utf8')
|
|
96
|
+
const lines = text.split('\n').slice(0, -1)
|
|
97
|
+
return { cursor: lines.length, events: lines.slice(after).map((line) => JSON.parse(line)) }
|
|
98
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { readHealthEvents } from './batch-health.mjs'
|
|
3
|
+
|
|
4
|
+
const [path, cursor = '0'] = process.argv.slice(2)
|
|
5
|
+
if (!path || !/^\d+$/.test(cursor)) {
|
|
6
|
+
console.error('Usage: read-delivery-attention.mjs <attention-file> [line-cursor]')
|
|
7
|
+
process.exitCode = 2
|
|
8
|
+
} else {
|
|
9
|
+
try {
|
|
10
|
+
const result = readHealthEvents(path, Number(cursor))
|
|
11
|
+
console.log(JSON.stringify(result))
|
|
12
|
+
process.exitCode = result.events.length ? 0 : 4
|
|
13
|
+
} catch (error) {
|
|
14
|
+
console.error(JSON.stringify({ state: 'unavailable', error: error.message }))
|
|
15
|
+
process.exitCode = 2
|
|
16
|
+
}
|
|
17
|
+
}
|