@1aboveio/skills 1.0.30 → 1.0.31

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.
Files changed (72) hide show
  1. package/.codex-plugin/plugin.json +1 -1
  2. package/.codex-plugin/resources.json +134 -132
  3. package/package.json +4 -4
  4. package/skills/app-dev/airflow/SKILL.md +1 -1
  5. package/skills/app-dev/android-development/SKILL.md +1 -1
  6. package/skills/app-dev/app-debug/SKILL.md +1 -1
  7. package/skills/app-dev/better-auth/SKILL.md +1 -1
  8. package/skills/app-dev/data-catalog/SKILL.md +1 -1
  9. package/skills/app-dev/data-quality/SKILL.md +1 -1
  10. package/skills/app-dev/ios-foundation/SKILL.md +1 -1
  11. package/skills/app-dev/maestro/SKILL.md +1 -1
  12. package/skills/app-dev/monorepo/SKILL.md +1 -1
  13. package/skills/app-dev/nextjs-fullstack/SKILL.md +1 -1
  14. package/skills/app-dev/prisma-setup/SKILL.md +1 -1
  15. package/skills/app-dev/pyspark/SKILL.md +1 -1
  16. package/skills/app-dev/python-backend/SKILL.md +1 -1
  17. package/skills/app-dev/shadcn/SKILL.md +1 -1
  18. package/skills/app-dev/zod-v4/SKILL.md +1 -1
  19. package/skills/cicd/cloud-build/SKILL.md +1 -1
  20. package/skills/cicd/cloud-debug/SKILL.md +1 -1
  21. package/skills/cicd/cloud-deploy/SKILL.md +1 -1
  22. package/skills/cicd/docker/SKILL.md +1 -1
  23. package/skills/cicd/github-actions/SKILL.md +1 -1
  24. package/skills/cicd/github-flow/SKILL.md +1 -1
  25. package/skills/cicd/google-cloud/SKILL.md +1 -1
  26. package/skills/cicd/mergify/SKILL.md +4 -1
  27. package/skills/cicd/mergify/references/watch-contract.md +73 -16
  28. package/skills/cicd/mergify/scripts/batch-health.mjs +98 -0
  29. package/skills/cicd/mergify/scripts/read-delivery-attention.mjs +17 -0
  30. package/skills/cicd/mergify/scripts/watch-pr-delivery-core.mjs +58 -22
  31. package/skills/cicd/podman/SKILL.md +1 -1
  32. package/skills/content/article-review/SKILL.md +1 -1
  33. package/skills/content/article-to-image/SKILL.md +1 -1
  34. package/skills/content/flowchart-svg/SKILL.md +1 -1
  35. package/skills/content/image-gen/SKILL.md +1 -1
  36. package/skills/content/mermaid/SKILL.md +1 -1
  37. package/skills/content/wechat-article-writer/SKILL.md +1 -1
  38. package/skills/content/wechat-publisher/SKILL.md +1 -1
  39. package/skills/content/wechat-search/SKILL.md +1 -1
  40. package/skills/content/xai-search/SKILL.md +1 -1
  41. package/skills/core/distill-writing/SKILL.md +1 -1
  42. package/skills/core/doc-to-md/SKILL.md +1 -1
  43. package/skills/core/editorial-review/SKILL.md +1 -1
  44. package/skills/core/house-style/SKILL.md +1 -1
  45. package/skills/core/plain-language/SKILL.md +1 -1
  46. package/skills/core/polish-cn/SKILL.md +1 -1
  47. package/skills/core/reg-parser/SKILL.md +1 -1
  48. package/skills/core/terminology/SKILL.md +1 -1
  49. package/skills/core/write-doc/SKILL.md +1 -1
  50. package/skills/core/write-report/SKILL.md +1 -1
  51. package/skills/engineering/better-review/SKILL.md +1 -1
  52. package/skills/engineering/e2e-test/SKILL.md +1 -1
  53. package/skills/engineering/engineering/SKILL.md +1 -1
  54. package/skills/engineering/engineering-runtime/SKILL.md +1 -1
  55. package/skills/engineering/engineering-runtime/coherence/workflow.json +13 -13
  56. package/skills/engineering/ensure-coverage/SKILL.md +1 -1
  57. package/skills/engineering/golden-path/SKILL.md +1 -1
  58. package/skills/engineering/harness-runtime/SKILL.md +1 -1
  59. package/skills/engineering/resolve-issues/SKILL.md +1 -1
  60. package/skills/engineering/resolve-release/SKILL.md +1 -1
  61. package/skills/engineering/rush-issues/SKILL.md +1 -1
  62. package/skills/engineering/rush-release/SKILL.md +1 -1
  63. package/skills/engineering/test-quality/SKILL.md +1 -1
  64. package/skills/risk-compliance/compliance-audit/SKILL.md +1 -1
  65. package/skills/risk-compliance/contract-compare/SKILL.md +1 -1
  66. package/skills/risk-compliance/contract-review/SKILL.md +1 -1
  67. package/skills/risk-compliance/doc-authenticity/SKILL.md +1 -1
  68. package/skills/risk-compliance/fraud-detection/SKILL.md +1 -1
  69. package/skills/risk-compliance/payment-analysis/SKILL.md +1 -1
  70. package/skills/risk-compliance/portfolio-payment-analysis/SKILL.md +1 -1
  71. package/skills/risk-compliance/similar-domain/SKILL.md +1 -1
  72. package/skills/risk-compliance/tld-detection/SKILL.md +1 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@1aboveio/skills",
3
- "version": "1.0.30",
3
+ "version": "1.0.31",
4
4
  "description": "Every 1aboveio skill package in one: install once, then choose which packages Pi loads with npx @1aboveio/skills select.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -28,8 +28,8 @@
28
28
  "nativeCodex": {
29
29
  "schemaVersion": 1,
30
30
  "metadataPath": ".codex-plugin/resources.json",
31
- "metadataDigest": "eb9fcc88b308abd6e1b65985bb5b7ce5396bfeb158c3510f466c2f8155f28694",
32
- "releaseIdentity": "729bf44fc5e0395a4eaa368fb356c764990532eacac13a06a5966ae8a80d274a"
31
+ "metadataDigest": "c17cb452e8b89d3cb0c547d0362559c8ca89ca34ca51dffce4c45240eedcb0f5",
32
+ "releaseIdentity": "708c53b47bb7f1b84c481d81578508aed365248ed620eea6c2e18ace498ab250"
33
33
  },
34
34
  "pi": {
35
35
  "skills": [
@@ -261,7 +261,7 @@
261
261
  ]
262
262
  }
263
263
  ],
264
- "digest": "a28bc0bbd3c9ff367387a0e968cdbe31b79a7e3854793f2d9c1287bc0751ec58"
264
+ "digest": "add5357c8bd17b7953f9049ddbcb4de23d2dc14e8ba586f30f5ec355c6e5737f"
265
265
  },
266
266
  "publishConfig": {
267
267
  "registry": "https://registry.npmjs.org/",
@@ -2,7 +2,7 @@
2
2
  name: airflow
3
3
  description: Airflow DAG architecture and conventions. Use when designing, writing, reviewing, testing, or debugging Airflow DAGs and tasks, including TaskGroups, data intervals, timezone-aware date parameters, CLI validation, environment-based scheduling, and pytest integrity tests.
4
4
  user-invocable: true
5
- release-version: 0.50.10
5
+ release-version: 0.50.11
6
6
  ---
7
7
  **Updates:** Once/session run `node <skill-base-dir>/release-check.mjs`.
8
8
  # Airflow DAG Development Patterns
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: android-development
3
3
  description: "Prove and debug Expo / React Native apps on an owned Android emulator. Use for Android startup/rendering failures, Metro or ADB problems, native harness failures, APK builds, SDK/NDK/JDK workspace setup, native journey validation, and choosing Kotlin/Compose versus React Native for Android flows. Reproduce failed Android CI checkpoints off CI before fixing and redispatching. Standalone invocation offers Project or Session; init persists repo conventions. Maestro journey authoring, UI-driver migration and flow diagnosis belong to maestro. NOT for workflow YAML, CI speed or runners (github-actions), browser tests (e2e-test), iOS (ios-foundation), plain Jest tests, or signing/store release."
4
- release-version: 0.50.10
4
+ release-version: 0.50.11
5
5
  ---
6
6
  **Updates:** Once/session run `node <skill-base-dir>/release-check.mjs`.
7
7
  # Android development
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: app-debug
3
3
  description: "Diagnose runtime failures in deployed Cloud Run services — 5xx/422 errors, tracebacks, Next.js SSR/hydration or Server Action failures, DB/Secret Manager connection errors, cold-start timeouts, container OOM. NOT for build or deploy failures (cloud-debug)."
4
- release-version: 0.50.10
4
+ release-version: 0.50.11
5
5
  ---
6
6
  **Updates:** Once/session run `node <skill-base-dir>/release-check.mjs`.
7
7
  # App Debug
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: better-auth
3
3
  description: "Add or debug Better Auth for Next.js App Router: login, sessions, protected routes, middleware, OAuth (including Feishu/Lark), cookies, Prisma, and Auth.js migration."
4
- release-version: 0.50.10
4
+ release-version: 0.50.11
5
5
  ---
6
6
  **Updates:** Once/session run `node <skill-base-dir>/release-check.mjs`.
7
7
  # Better Auth for Next.js
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: data-catalog
3
3
  description: "Column definitions for warehouse tables, written inside the Spark/PySpark or SQL script that builds each table (CATALOG_TABLE / CATALOG_FIELDS, or a `-- @field` comment block), with a generated markdown catalog in docs/catalog/ and a CI check that fails a PR whose catalog is stale. Use when writing or changing a table script that adds, renames, removes, or changes the meaning of an output column or feature; when asked what a warehouse column or feature means; to set a repo up ('init the data catalog', 'generate the data dictionary', '字段字典', 'add catalog CI'); or to audit existing SQL or Spark scripts for undocumented columns. NOT for implementing or tuning the Spark job itself (pyspark), DAG wiring (airflow), or general workflow YAML (github-actions)."
4
- release-version: 0.50.10
4
+ release-version: 0.50.11
5
5
  ---
6
6
  **Updates:** Once/session run `node <skill-base-dir>/release-check.mjs`.
7
7
  # Data catalog
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: data-quality
3
3
  description: "Check a published warehouse table's data against its data-catalog definitions with read-only SELECTs: columns never filled or stuck at one value, counts below zero, ratios outside 0–1, declared values that never appear and undeclared values that do. Then classify each finding as a wrong definition, wrong code, or wrong data. Use when asked whether a table's data is right, to profile or sanity-check a dwd/ads table, to find dead or constant columns, to check a column's values against its documented list, after a pipeline change ships, or when a data-catalog definition and the data might disagree. NOT for validating a Spark change before it ships (pyspark canary and reconciliation), writing definitions (data-catalog), or monitoring dashboards."
4
- release-version: 0.50.10
4
+ release-version: 0.50.11
5
5
  ---
6
6
  **Updates:** Once/session run `node <skill-base-dir>/release-check.mjs`.
7
7
  # Data quality
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: ios-foundation
3
3
  description: "Set up and prove an Expo / React Native native iOS workspace from an assigned or fresh isolated workspace to a manual Login smoke on an owned iOS Simulator: isolated workspace and private caches, Xcode/runtime/CocoaPods preflight, frozen install with `pod install --deployment`, platform-scoped prebuild, an ad-hoc-signed Debug simulator build, a private simulator by exact UDID, Metro on a free port, a disposable PostgreSQL backend with owned cleanup, and the evidence record (setup proof only; feature work reports the smoke result). Use for 'set up iOS', 'build the iOS app', 'run the app on the iOS simulator', 'add iOS to the React Native app', 'prove the iOS build', or when a pod install, xcodebuild, simulator boot, Metro connection or Keychain session fails. NOT for Android (android-development), signing, TestFlight or App Store release, or general workflow YAML (github-actions)."
4
- release-version: 0.50.10
4
+ release-version: 0.50.11
5
5
  ---
6
6
  **Updates:** Once/session run `node <skill-base-dir>/release-check.mjs`.
7
7
  # iOS foundation
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: maestro
3
3
  description: "Design, run, debug and migrate mobile E2E journeys with Maestro: complete flows and subflows, selectors, parameters, exclusive UI-driver ownership, non-UI authentication/backend helpers and failure evidence. Use for Maestro YAML/CLI/MCP work, slow fragmented mobile journeys, UiAutomation driver collisions, or replacing a hybrid Python/uiautomator2 UI harness. Android-first; use platform-neutral flow guidance for iOS only with its verified device/runtime contract. NOT for Android provisioning/builds (android-development), iOS setup (ios-foundation), browser Playwright tests (e2e-test), or CI workflow YAML (github-actions)."
4
- release-version: 0.50.10
4
+ release-version: 0.50.11
5
5
  ---
6
6
  **Updates:** Once/session run `node <skill-base-dir>/release-check.mjs`.
7
7
  # Maestro
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: monorepo
3
3
  description: Turborepo architecture for shared packages, pnpm workspaces, DAL boundaries, and pipelines.
4
- release-version: 0.50.10
4
+ release-version: 0.50.11
5
5
  ---
6
6
  **Updates:** Once/session run `node <skill-base-dir>/release-check.mjs`.
7
7
  # Turborepo Monorepo Architecture
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: nextjs-fullstack
3
3
  description: "Build or debug Next.js App Router features with React 19 — pages/layouts/route handlers, Server/Client Components, Server Actions, forms, middleware, DAL, strict TypeScript, Zod — plus our conventions: nuqs URL state, SWR cache, Skeleton/Progress + Sonner feedback, drag-and-drop upload, the portal app shell, list pages as filter/sort/paginate tables. shadcn component mechanics: see the shadcn skill."
4
- release-version: 0.50.10
4
+ release-version: 0.50.11
5
5
  ---
6
6
  **Updates:** Once/session run `node <skill-base-dir>/release-check.mjs`.
7
7
  # Next.js 16 Fullstack Development
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: prisma-setup
3
3
  description: Use when adding or debugging Prisma with PostgreSQL, Next.js, or Turborepo, including schema.prisma, prisma.config.ts, client generation, migrations, seeds, relations, adapters, and DAL/database-layer setup. Triggers on phrases like "Prisma schema", "prisma migrate", "schema.prisma", "seed the database", "PrismaClient error", "relation issue", or "database layer".
4
- release-version: 0.50.10
4
+ release-version: 0.50.11
5
5
  ---
6
6
  **Updates:** Once/session run `node <skill-base-dir>/release-check.mjs`.
7
7
  # Prisma v7 Setup Guide
@@ -12,7 +12,7 @@ description: >
12
12
  Connect, spark-submit, Hudi commits, backfills, validate-only canaries,
13
13
  cluster reconciliation, or Spark event-log profiling — including warehouse
14
14
  job timeouts, empty Hudi writes, or EMR/Dataproc performance regressions.
15
- release-version: 0.50.10
15
+ release-version: 0.50.11
16
16
  ---
17
17
  **Updates:** Once/session run `node <skill-base-dir>/release-check.mjs`.
18
18
  # PySpark
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: python-backend
3
3
  description: "Python backend architecture for FastAPI, Tortoise ORM, Pydantic Settings, loguru, and uv. Also: uv.lock installs in CI/Docker via a proxy or mirror (`uv sync --frozen` bypasses it), slow uv installs on runners, relocking"
4
- release-version: 0.50.10
4
+ release-version: 0.50.11
5
5
  ---
6
6
  **Updates:** Once/session run `node <skill-base-dir>/release-check.mjs`.
7
7
  # Python Backend Conventions
@@ -2,7 +2,7 @@
2
2
  name: shadcn
3
3
  description: "Add or debug shadcn/ui in a React/Next.js project: components.json, shadcn init/add, presets, registries, Tailwind styling, base/radix/aria composition, component fixes, and list-index pages — where the default is the DiceUI data table with filter/sort/pagination in the URL via nuqs, not a bare shadcn Table."
4
4
  allowed-tools: Bash(npx shadcn@latest *), Bash(pnpm dlx shadcn@latest *), Bash(bunx --bun shadcn@latest *)
5
- release-version: 0.50.10
5
+ release-version: 0.50.11
6
6
  ---
7
7
  **Updates:** Once/session run `node <skill-base-dir>/release-check.mjs`.
8
8
  # shadcn/ui
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: zod-v4
3
3
  description: Zod v4 schema conventions and v3 migration for errors, validators, objects, enums, records, and async parsing.
4
- release-version: 0.50.10
4
+ release-version: 0.50.11
5
5
  ---
6
6
  **Updates:** Once/session run `node <skill-base-dir>/release-check.mjs`.
7
7
  # Zod v3 to v4 Migration
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: cloud-build
3
3
  description: "Build or debug Cloud Build pipelines for Cloud Run: cloudbuild.yaml, triggers, Artifact Registry, builds, migrations, deploys, secrets, VPC, notifications. Use cloud-deploy for staged promotion. NOT for GitHub Actions PR checks (github-actions)."
4
- release-version: 0.50.10
4
+ release-version: 0.50.11
5
5
  ---
6
6
  **Updates:** Once/session run `node <skill-base-dir>/release-check.mjs`.
7
7
  # Cloud Build Direct Deploy to Cloud Run
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: cloud-debug
3
3
  description: "Debug Cloud Build or Deploy failures: builds, deployments, health checks, and pipeline errors. Inputs: service, build ID, region. NOT for GitHub Actions runs (github-actions) or runtime errors in a running service (app-debug)"
4
- release-version: 0.50.10
4
+ release-version: 0.50.11
5
5
  ---
6
6
  **Updates:** Once/session run `node <skill-base-dir>/release-check.mjs`.
7
7
  # Cloud Build & Cloud Deploy Debug Skill
@@ -5,7 +5,7 @@ description: >
5
5
  CI/CD pipelines with staged promotion, verification gates, or GitFlow branching.
6
6
  Also use when debugging Cloud Deploy pipeline failures. NOT for simple single-container
7
7
  deploys — use cloud-build instead.
8
- release-version: 0.50.10
8
+ release-version: 0.50.11
9
9
  ---
10
10
  **Updates:** Once/session run `node <skill-base-dir>/release-check.mjs`.
11
11
  # Cloud Deploy + Skaffold + Kustomize for Cloud Run
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: docker
3
3
  description: Docker/Podman container architecture and build patterns. Read when designing or reviewing containerization, Dockerfile structure, multi-stage builds, PyPI mirror support, or docker-compose setup for Python/uv projects, and when a Dockerfile's dependency install misses the layer cache on every build (build args such as a commit SHA or version declared too early) or an image build is slow in CI.
4
- release-version: 0.50.10
4
+ release-version: 0.50.11
5
5
  ---
6
6
  **Updates:** Once/session run `node <skill-base-dir>/release-check.mjs`.
7
7
  # Docker Build Patterns
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: github-actions
3
3
  description: "Author, review, audit, profile, optimize, or debug GitHub Actions workflows (.github/workflows/*.yml): run-history audits, CI cleanup to get each job below five minutes, job and step timing, resource bottlenecks, before/after comparisons, conditional CI by changed path, the one required gate check, PR and merge-queue lanes, sharding, workers, caching, self-hosted runners, timeouts, concurrency, permissions and action pinning, post-deploy verification, npm publishing. Use for 'set up CI', 'CI is slow', 'profile CI', 'optimize our pipeline', 'audit CI for redundant or wasted jobs', 'why is this check stuck expected or never started', 'harden this workflow', or 'browser not found on the runner'. NOT for pushing, opening, or merging a PR, or writing CI conventions into CONTRIBUTING.md (github-flow), queue rules or a check unmet inside Mergify (mergify), Playwright config and specs (e2e-test), cloudbuild.yaml or Cloud Run deploys (cloud-build), or which gates a repo must prove (ensure-coverage)."
4
- release-version: 0.50.10
4
+ release-version: 0.50.11
5
5
  ---
6
6
  **Updates:** Once/session run `node <skill-base-dir>/release-check.mjs`.
7
7
  # GitHub Actions
@@ -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.10
4
+ release-version: 0.50.11
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.10
8
+ release-version: 0.50.11
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.10
4
+ release-version: 0.50.11
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 the closing profile summary still print) |
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 number of reads made per poll (2 here:
220
- `gh pr view` + `mergify queue show`). The two reads together cannot outlive the bound that will
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 the end of the watch, one additional bounded `gh pr view` reads the synthetic batch PR, when
224
- one was observed: after a dequeue to classify it, and on every terminal verdict to profile the
225
- queue's CI (a single read serves both). It enriches the already-settled verdict and never participates
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 half of a small stall/ceiling bound. (The sibling watcher makes
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. Two API calls per poll at 90s is
233
- 80/hour per watched PR — roughly 60 concurrent watchers before an authenticated GitHub token's
234
- 5,000/hour limit is in range, which comfortably covers an epic-sized `resolve-issues` delivery.
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 also profiles the CI it waited on, at no extra poll cost: each `gh pr view` already
252
- returns the PR's check runs with their start and finish times.
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, plus the checks on the queue's batch PR (read
255
- once at the end). Mergify's own checks are left out; their duration is queue wait, not CI work.
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
+ }