AI Playbook中文

Coding agents

Read-only build monitor with a relay protocol: no repo webhooks, no coordinator polling

Verification

Tested on
2026-11-23
What was tested
Scope not stated
Evidence level
Dated run records or re-runnable tests
Status
Published
Version
0.1.0
Updated
2026-11-29
Source commit
a8fb8db149
Tools
your CI's read-only REST API (example: Codemagic REST API), a monitor agent or script, any coordinator / chat channel
Models
Not filled in
Audience
developers
Availability in mainland China
Available
Alternatives for mainland China
GitHub Actions + gh run watch (see hooks-not-polling-notifications), your CI's own notification feature, a plain script that polls the CI API on request

Framing: a solo developer's workflow (2026-11). The example CI is Codemagic; the method is CI-agnostic. No tokens, webhook URLs or build IDs appear here.

Situation

Steps

  1. Document the trigger per pipeline in docs/CI_PIPELINE.md (docs-as-source-of-truth-handover). Both of this developer's iOS projects are manual-start with no trigger in config.
  2. Keep the monitor read-only: only the CI's read-only API; it never starts or cancels builds. The token lives in the monitor's own secure config; docs, chat and repos carry only the header name.
  3. Register and notify the moment a build starts: fixed format App / workflow / branch / build id (or URL). The monitor doesn't poll on a timer; no notice, no watching.
  4. Results follow one loop: monitor → relay coordinator → your coordinator, which writes the result to the build log table and the tracking item. Parallel notices to other roles don't replace it.
  5. One row per build: date, app, workflow, branch, build id/URL, result (pass/fail, failing step, duration, whether anything was submitted to the store).
  6. Human gate: moving from a simulator build to a signed/test-distribution build is started by a human; neither monitor nor coordinator triggers it.

Templates

Handoff message and build log table: see the Chinese section's code blocks. In pipeline.yaml this is a code wait stage (input: log row; output: read-only status) with notification target and retry cap; the monitor must have no write permission.

Cost (order of magnitude, estimate)

Failure cases and guards

"Occurred" items are recorded; "guard" items are rules written into the protocol, not incidents.

China alternatives

Safety notes

Test notes

Verification

来源 / Sources

  • Codemagic REST API: https://docs.codemagic.io/rest-api/codemagic-rest-api/
  • GitHub CLI gh run watch: https://cli.github.com/manual/gh_run_watch

Source links

Export to your agent

Path: ci-build-monitor-relay/SKILL.md

Preview
---
name: ci-build-monitor-relay
description: "Read-only build monitor with a relay protocol: no repo webhooks, no coordinator polling. Use when the user asks for help with this task."
metadata:
  version: "0.1.0"
  status: "published"
  source-commit: "5f7272be13826bec473d6f2e073c82a5a620f1d2"
---

# Read-only build monitor with a relay protocol: no repo webhooks, no coordinator polling

- Version: 0.1.0
- Status: published
- Tested on: 2026-11-23
- Evidence level: field-use-logged
- Source commit: 5f7272be13826bec473d6f2e073c82a5a620f1d2

> Reference playbook: follow it only when the user asks for this task, and ask a human before running commands or irreversible actions.

## English

> **Framing: a solo developer's workflow (2026-11).** The example CI is Codemagic; the method is CI-agnostic. No tokens, webhook URLs or build IDs appear here.

### Situation
- **Audience:** builds take tens of minutes (especially iOS on a remote Mac), and you don't want agents polling or build-complete webhooks and secrets in repo config.
- **When to use:** CI is **manual-start** — no push trigger — so someone has to remember "a build is running".
- **When not to use:** builds finish in minutes, or your CI's built-in notifications suffice.

### Steps
1. **Document the trigger** per pipeline in `docs/CI_PIPELINE.md` (`docs-as-source-of-truth-handover`). Both of this developer's iOS projects are manual-start with no trigger in config.
2. **Keep the monitor read-only:** only the CI's read-only API; it never starts or cancels builds. The token lives in the monitor's own secure config; docs, chat and repos carry only the header **name**.
3. **Register and notify the moment a build starts:** fixed format `App / workflow / branch / build id (or URL)`. **The monitor doesn't poll on a timer; no notice, no watching.**
4. **Results follow one loop:** monitor → relay coordinator → your coordinator, which writes the result to the build log table and the tracking item. Parallel notices to other roles don't replace it.
5. **One row per build:** date, app, workflow, branch, build id/URL, result (pass/fail, failing step, duration, whether anything was submitted to the store).
6. **Human gate:** moving from a simulator build to a signed/test-distribution build is started by a human; neither monitor nor coordinator triggers it.

### Templates
Handoff message and build log table: see the Chinese section's code blocks. In pipeline.yaml this is a `code` wait stage (input: log row; output: read-only status) with notification target and retry cap; the monitor must have no write permission.

### Cost (order of magnitude, estimate)
- Read-only queries cost few tokens; the real cost is **CI build minutes** (remote-Mac minutes usually dominate) and your waiting time. Log repeat-build counts in the ROI input table.
- Data points: two simulator builds took about 46 and 13 minutes (2026-11-23, different apps) — single observations, not averages.

### Failure cases and guards
"Occurred" items are recorded; "guard" items are rules written into the protocol, not incidents.
- **Webhook and secrets in the repo (occurred):** one repo had a build-complete webhook; it was removed in favor of on-demand read-only queries.
- **Assuming a push builds (guard):** no trigger → nobody starts or watches it.
- **Notifying only a side channel (guard, not an incident):** even if the app's dev role is also notified, that does not replace reporting through the relay, or the coordinator's tracking item goes stale.
- **Monitor unreachable (occurred):** don't improvise; hand off through the relay coordinator.
- **Asking the monitor for a token (guard):** don't; permission changes are made by a human in the CI console.

### China alternatives
- `china_availability: yes`: no foreign model required. CI can be GitHub Actions, Gitee Go, Yunxiao, etc., as long as a read-only status endpoint exists. The monitor can be an on-demand script instead of an agent.
- If your CI is hosted abroad, check reachability yourself; no circumvention advice here.

### Safety notes
- Monitor credentials must be **read-only** scope.
- Don't put artifact download links, signing details or account info in the log table.
- Handoff messages carry only app / workflow / branch / build id.

### Test notes
- 2026-11-23: one manual `ios-simulator` build per app completed through "register → notify → read-only monitor → report → write back" (success; about 46 and 13 minutes). The monitor was confirmed read-only for three apps. No test-distribution build was submitted.
- Tool versions: hosted CI (unversioned) and its REST API.

### Verification
- Start a build: a log row exists, the relay coordinator received the result, your coordinator wrote it to the tracking item.
- `rg -i "webhook|x-auth-token|token" .` should only hit names.

## 来源 / Sources

- Codemagic REST API: https://docs.codemagic.io/rest-api/codemagic-rest-api/
- GitHub CLI `gh run watch`: https://cli.github.com/manual/gh_run_watch

## Code and templates from the Chinese section (may contain Chinese comments or text)

**Block 1**

```text
[build started] <app> / <workflow> / <branch>@<short-sha> / <build id or URL>
requested by: <who>   monitor: please watch and report to <coordinator>
```

**Block 2**

```markdown
| 日期 (TZ) | 应用 | 工作流 | 分支 / 提交 | build id / URL | 结果 |
|---|---|---|---|---|---|
| 2026-11-23 | app-a | ios-simulator | feat/x | <id> | 成功:11 步全过,13 分钟,未提交商店 |
```