opencode-swarm 7.112.2 → 7.113.1
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/.opencode/skills/brainstorm/SKILL.md +1 -0
- package/.opencode/skills/ci-failure-batching/SKILL.md +2 -1
- package/.opencode/skills/ci-fix-monitor/SKILL.md +203 -0
- package/.opencode/skills/clarify/SKILL.md +1 -0
- package/.opencode/skills/clarify-spec/SKILL.md +1 -0
- package/.opencode/skills/codebase-review-swarm/SKILL.md +1 -0
- package/.opencode/skills/commit-pr/SKILL.md +15 -0
- package/.opencode/skills/consult/SKILL.md +1 -0
- package/.opencode/skills/council/SKILL.md +1 -0
- package/.opencode/skills/critic-gate/SKILL.md +1 -0
- package/.opencode/skills/deep-dive/SKILL.md +1 -0
- package/.opencode/skills/deep-research/SKILL.md +1 -0
- package/.opencode/skills/design-docs/SKILL.md +2 -1
- package/.opencode/skills/discover/SKILL.md +1 -0
- package/.opencode/skills/engineering-conventions/SKILL.md +2 -1
- package/.opencode/skills/execute/SKILL.md +1 -0
- package/.opencode/skills/fork-pr-operations/SKILL.md +136 -0
- package/.opencode/skills/gate-attribution/SKILL.md +2 -1
- package/.opencode/skills/issue-ingest/SKILL.md +1 -0
- package/.opencode/skills/loop/SKILL.md +7 -6
- package/.opencode/skills/merge-queue-readiness/SKILL.md +2 -1
- package/.opencode/skills/parallel-work-check/SKILL.md +133 -0
- package/.opencode/skills/phase-wrap/SKILL.md +1 -0
- package/.opencode/skills/plan/SKILL.md +1 -0
- package/.opencode/skills/pre-phase-briefing/SKILL.md +1 -0
- package/.opencode/skills/resume/SKILL.md +1 -0
- package/.opencode/skills/running-tests/SKILL.md +1 -0
- package/.opencode/skills/skill-edit-validation/SKILL.md +2 -1
- package/.opencode/skills/specify/SKILL.md +1 -0
- package/.opencode/skills/swarm/SKILL.md +1 -0
- package/.opencode/skills/swarm-ci-monitor/SKILL.md +5 -4
- package/.opencode/skills/swarm-implement/SKILL.md +4 -4
- package/.opencode/skills/swarm-pr-feedback/SKILL.md +26 -5
- package/.opencode/skills/swarm-pr-review/SKILL.md +2 -1
- package/.opencode/skills/swarm-pr-subscribe/SKILL.md +1 -0
- package/.opencode/skills/test-file-split/SKILL.md +102 -0
- package/.opencode/skills/worktree-retry-cleanup/SKILL.md +2 -1
- package/.opencode/skills/writing-tests/SKILL.md +43 -0
- package/dist/cli/{config-doctor-mmw4c50z.js → config-doctor-az11cwf5.js} +2 -2
- package/dist/cli/{curator-llm-factory-5bns4xy6.js → curator-llm-factory-nmhzc774.js} +5 -5
- package/dist/cli/{curator-snvp9542.js → curator-nm2c9y1p.js} +5 -5
- package/dist/cli/{guardrail-explain-4s7djf9p.js → guardrail-explain-q1np1xaw.js} +6 -6
- package/dist/cli/{guardrail-log-xjgr00eq.js → guardrail-log-hysxdwg9.js} +3 -3
- package/dist/cli/{hive-promoter-zs295trk.js → hive-promoter-z4dezw62.js} +5 -5
- package/dist/cli/{index-xehrmy76.js → index-0gf6de8b.js} +1 -1
- package/dist/cli/{index-cq2hgvd2.js → index-1ey3dxq7.js} +9 -1
- package/dist/cli/{index-npxmfj48.js → index-8f256d7t.js} +1 -1
- package/dist/cli/{index-82v0d72f.js → index-h389ed8y.js} +424 -87
- package/dist/cli/{index-9fjpecax.js → index-ky8eb4q6.js} +2 -2
- package/dist/cli/{index-snmfqhez.js → index-npd9rypp.js} +2009 -958
- package/dist/cli/{index-w84stmkx.js → index-r9fjzr3k.js} +1 -1
- package/dist/cli/{index-k6wd3chp.js → index-rqpm9cwe.js} +7 -7
- package/dist/cli/index.js +5 -5
- package/dist/cli/{schema-2p15yrvn.js → schema-qb313fyy.js} +1 -1
- package/dist/cli/{skill-generator-fe6q8xgm.js → skill-generator-nnwn4sq0.js} +1 -1
- package/dist/commands/loop.d.ts +1 -1
- package/dist/commands/registry.d.ts +1 -1
- package/dist/config/bundled-skills.d.ts +15 -5
- package/dist/config/project-init.d.ts +1 -1
- package/dist/config/schema.d.ts +2 -0
- package/dist/hooks/skill-propagation-gate.d.ts +45 -5
- package/dist/hooks/skill-scoring.d.ts +22 -1
- package/dist/index.js +88 -88
- package/dist/sast/rules/index.d.ts +0 -9
- package/dist/utils/gitignore-warning.d.ts +8 -4
- package/package.json +5 -1
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ci-fix-monitor
|
|
3
|
+
audience: swarm-plugin
|
|
4
|
+
description: >
|
|
5
|
+
Monitor CI on a PR, diagnose failures, fix them, and re-push until green.
|
|
6
|
+
Covers reading CI logs, classifying failure types (check-title, package-check,
|
|
7
|
+
test failures, lint), determining the correct fix, and re-pushing.
|
|
8
|
+
triggers:
|
|
9
|
+
- ci check failure
|
|
10
|
+
- fix ci
|
|
11
|
+
- monitor ci
|
|
12
|
+
generated_from_knowledge: []
|
|
13
|
+
source_knowledge_ids: []
|
|
14
|
+
generated_at: 2026-07-02T02:35:49.945Z
|
|
15
|
+
confidence: 0.60
|
|
16
|
+
status: active
|
|
17
|
+
version: 6
|
|
18
|
+
skill_origin: generated
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
<!-- generated by opencode-swarm skill-generator. Do not edit by hand; edits will be preserved on regeneration only with controlled update mode. -->
|
|
22
|
+
|
|
23
|
+
# CI Fix & Monitor Protocol
|
|
24
|
+
|
|
25
|
+
Activates when the user asks to monitor CI, fix CI failures, or resolve red
|
|
26
|
+
checks on a PR.
|
|
27
|
+
|
|
28
|
+
## Environment note — tool availability
|
|
29
|
+
|
|
30
|
+
This skill was originally written for desktop Claude Code (Windows) with `gh`
|
|
31
|
+
CLI. In the **remote execution / GitHub MCP** environment, use the equivalent
|
|
32
|
+
MCP tools instead:
|
|
33
|
+
|
|
34
|
+
| Desktop / `gh` CLI | Remote MCP equivalent |
|
|
35
|
+
|---|---|
|
|
36
|
+
| `gh pr checks <number>` | `mcp__github__pull_request_read` method `get_check_runs` |
|
|
37
|
+
| `gh pr view <number> --json checks` | `mcp__github__pull_request_read` method `get_check_runs` |
|
|
38
|
+
| `gh run view <run-id> --job <job-id> --log` | `mcp__github__get_job_logs` with `job_id` and `return_content: true` |
|
|
39
|
+
| `gh pr edit --title` | `mcp__github__update_pull_request` with `title` |
|
|
40
|
+
| `gh pr view --json mergeable` | `mcp__github__pull_request_read` method `get` |
|
|
41
|
+
|
|
42
|
+
> MCP tool names are injected by the runtime harness and not guaranteed to be
|
|
43
|
+
> stable across environments. Use `ToolSearch` to verify availability before
|
|
44
|
+
> calling any `mcp__github__*` tool for the first time in a session.
|
|
45
|
+
|
|
46
|
+
## Step 1 — Fetch current status
|
|
47
|
+
|
|
48
|
+
Fetch all check runs for the PR head commit. If all green: report success
|
|
49
|
+
and stop.
|
|
50
|
+
|
|
51
|
+
## Step 2 — Classify each failure
|
|
52
|
+
|
|
53
|
+
| Failure type | Root cause pattern | Fix action |
|
|
54
|
+
|---|---|---|
|
|
55
|
+
| **check-title** | PR title lacks `<type>(<scope>):` prefix | Update title via PR edit |
|
|
56
|
+
| **package-check** | npm tarball validation failed (source/build/package-manifest problem) | Fix source/build/manifest — see section below. Not generated-file drift. |
|
|
57
|
+
| **branch behind main** | Branch is behind main; main had a release commit; CI uses merge-commit checkout | Rebase onto main, force-push — see section below |
|
|
58
|
+
| **lint/quality: format** | Code style violations (long lines, spacing) | `bunx biome format --write <files>` then commit |
|
|
59
|
+
| **lint/quality: lint** | Lint rule violations (noExplicitAny, etc.) | `bunx biome check --write <files>` or fix manually |
|
|
60
|
+
| **unit test** | Test failures | Read log, fix code, commit |
|
|
61
|
+
| **integration** | Integration failures | Read log, check if pre-existing on main |
|
|
62
|
+
| **macOS unit test** | Cross-platform file I/O race (atomic write-then-read returns null on macOS) | See "macOS file I/O fixes" below |
|
|
63
|
+
| **security** | SAST/secret findings | Read log, fix or suppress with justification |
|
|
64
|
+
| **smoke** | Smoke test failures | Read log, check if environment-specific |
|
|
65
|
+
|
|
66
|
+
## macOS file I/O fixes (cross-platform atomic write)
|
|
67
|
+
|
|
68
|
+
macOS/APFS has different filesystem timing than Linux ext4. `fs.renameSync` can
|
|
69
|
+
complete before the data is visible to subsequent reads. The most common
|
|
70
|
+
manifestation is `unit (macos-latest)` failing on tests that write-then-read
|
|
71
|
+
atomic files (e.g., `curator atomic write > writeCuratorSummary > after write,
|
|
72
|
+
readCuratorSummary reads file back successfully`), while the same tests pass
|
|
73
|
+
on `ubuntu-latest` and `windows-latest`.
|
|
74
|
+
|
|
75
|
+
**Canonical patterns:** See
|
|
76
|
+
`file:.swarm/bundled-skills/writing-tests/SKILL.md`
|
|
77
|
+
§ Cross-Platform Requirements → "macOS rename-visibility race" for the
|
|
78
|
+
full three-layer fix pattern (bunWrite + ENOENT retry + Node FileHandle.sync()
|
|
79
|
+
not fsync()). This skill is a triage pointer; the canonical technical
|
|
80
|
+
reference lives in `writing-tests` so it survives any regeneration of this
|
|
81
|
+
`generated/` file.
|
|
82
|
+
|
|
83
|
+
**Related security test pattern:** if the CI failure involves a long task ID
|
|
84
|
+
or path, the security test `ADVERSARIAL: Command Services Attack Vectors >
|
|
85
|
+
Attack Vector 1: Malformed Arguments > EVIDENCE: extremely long task ID
|
|
86
|
+
(buffer overflow) - ACCEPTED by regex but no crash` requires a path length
|
|
87
|
+
guard BEFORE `validateSwarmPath` in `src/evidence/manager.ts:loadEvidence`.
|
|
88
|
+
See `file:.swarm/bundled-skills/engineering-conventions/SKILL.md`
|
|
89
|
+
for the evidence file flow that this gate check triggers on macOS CI.
|
|
90
|
+
|
|
91
|
+
## Step 3 — Diagnose with logs
|
|
92
|
+
|
|
93
|
+
For every failed check, fetch the full log content. Fetch only the tail
|
|
94
|
+
(last 80–100 lines) unless the error is near the start.
|
|
95
|
+
|
|
96
|
+
Read the log carefully before concluding root cause. Distinguish between:
|
|
97
|
+
- a failure introduced by this PR,
|
|
98
|
+
- a pre-existing failure on `main` (verify by checking main's last CI run for
|
|
99
|
+
the same check), and
|
|
100
|
+
- a failure caused by the CI environment or branch drift.
|
|
101
|
+
|
|
102
|
+
## Step 4 — Fix
|
|
103
|
+
|
|
104
|
+
### check-title
|
|
105
|
+
No commit needed. Update the PR title.
|
|
106
|
+
|
|
107
|
+
### package-check failure
|
|
108
|
+
|
|
109
|
+
`package-check` validates the npm tarball (`npm pack` + tarball contents). A
|
|
110
|
+
failure is a source/build/package-manifest problem, **not** generated-file
|
|
111
|
+
drift. `dist/` is generated and NOT committed — do not stage it. Run
|
|
112
|
+
`bun run build` locally only when you need the bundle to verify the failure:
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
bun run build
|
|
116
|
+
node --input-type=module -e "await import('./dist/index.js'); console.log('dist import OK')"
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
Fix the underlying source/build/`package.json` `files` manifest issue, then
|
|
120
|
+
commit the source fix (not `dist/`) and push.
|
|
121
|
+
|
|
122
|
+
### branch behind main (version drift)
|
|
123
|
+
|
|
124
|
+
**Identifying this case:** A version string differs (`version: "X.Y.Z"` changed
|
|
125
|
+
to a higher version) because main had a release commit after the branch was cut,
|
|
126
|
+
and GitHub Actions checks out the merge-commit for CI. Rebase onto main to pick
|
|
127
|
+
up the release commit.
|
|
128
|
+
|
|
129
|
+
**Fix:**
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
git fetch origin main
|
|
133
|
+
git rebase origin/main # fast-forward the branch onto the release commit
|
|
134
|
+
# If the rebase halts with conflicts, run `git rebase --abort` and escalate
|
|
135
|
+
# to the user — do not attempt to resolve a conflicted rebase automatically.
|
|
136
|
+
git push --force-with-lease origin <branch> # force-push is required after rebase
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
> `--force-with-lease` is safe here: it refuses to overwrite commits that
|
|
140
|
+
> appeared on the remote after your last fetch. After the rebase, the local
|
|
141
|
+
> branch has diverged from remote history — a regular push will be rejected.
|
|
142
|
+
|
|
143
|
+
- Do NOT stage or commit `dist/` — it is generated and NOT committed; there is no committed-dist drift check
|
|
144
|
+
- After a rebase, a force-push is required and expected — do not try a regular push
|
|
145
|
+
|
|
146
|
+
### lint/quality: format violations
|
|
147
|
+
|
|
148
|
+
Biome format violations (line too long, spacing, bracket style) — these can
|
|
149
|
+
appear when a code change introduces a line that exceeds Biome's print-width.
|
|
150
|
+
Auto-fix only the changed files to minimize noise:
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
bunx biome format --write src/path/to/changed-file.ts
|
|
154
|
+
bun test src/path/to/changed-file.test.ts # verify tests still pass after format
|
|
155
|
+
git add <files>
|
|
156
|
+
git commit -m "style: apply Biome formatting"
|
|
157
|
+
git push origin <branch>
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
> Do NOT run `bunx biome format --write .` on the entire repo unless instructed
|
|
161
|
+
> — this can introduce formatting changes in unrelated files and bloat the diff.
|
|
162
|
+
|
|
163
|
+
### lint/quality: lint rule violations
|
|
164
|
+
|
|
165
|
+
```bash
|
|
166
|
+
bunx biome check --write <specific-file>
|
|
167
|
+
# or fix manually if --write does not handle the rule
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
### integration failures
|
|
171
|
+
|
|
172
|
+
Check whether the same check failed on `main`'s last CI run before treating
|
|
173
|
+
it as PR-introduced. If pre-existing: document the finding and skip. If
|
|
174
|
+
introduced by this PR: collect the full failure log, the test name, and the
|
|
175
|
+
first error line, then delegate to a coder with that evidence.
|
|
176
|
+
|
|
177
|
+
### security (SAST/secret findings)
|
|
178
|
+
|
|
179
|
+
Fetch the full log. If it is a secret/credential finding: confirm the file
|
|
180
|
+
and line, remove or rotate the credential, and commit the fix. If it is a
|
|
181
|
+
SAST code-quality finding: collect the rule ID, file, and line, then
|
|
182
|
+
delegate to a coder. Do NOT suppress findings without an explicit
|
|
183
|
+
justification comment approved by the user.
|
|
184
|
+
|
|
185
|
+
### unit test / smoke failures
|
|
186
|
+
Delegate to coder with specific failure details (test name, assertion, first
|
|
187
|
+
error line). See execute skill.
|
|
188
|
+
|
|
189
|
+
## Step 5 — Push and monitor
|
|
190
|
+
|
|
191
|
+
After pushing, subscribe to PR activity (if in webhook/MCP context) and wait
|
|
192
|
+
for the next CI event rather than polling. Do not push a second time until the
|
|
193
|
+
CI result from the first push is confirmed.
|
|
194
|
+
|
|
195
|
+
If no CI event arrives after a reasonable wait (e.g., checks are still queued
|
|
196
|
+
and stalled), re-fetch check status manually via `get_check_runs` and report
|
|
197
|
+
the stall state to the user rather than waiting indefinitely.
|
|
198
|
+
|
|
199
|
+
## Step 6 — Verify all green
|
|
200
|
+
|
|
201
|
+
Do NOT declare victory until ALL required checks pass. A check in `skipped`
|
|
202
|
+
state is acceptable only if the same check was skipped on the base branch
|
|
203
|
+
(i.e. the workflow gates on a path filter). Confirm this explicitly.
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: codebase-review-swarm
|
|
3
|
+
audience: swarm-plugin
|
|
3
4
|
description: Run a rigorous, quote-grounded codebase review or security/QA/accessibility/performance/AI-slop/enhancement audit. Use for full-repo or large-subsystem review reports; not for normal implementation. Performs Phase 0 inventory, selected exhaustive tracks with non-diluting depth, coverage closure, reviewer/critic validation, and writes .swarm/review-v8 artifacts without modifying source files.
|
|
4
5
|
license: MIT
|
|
5
6
|
metadata:
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: commit-pr
|
|
3
|
+
audience: swarm-plugin
|
|
3
4
|
description: >
|
|
4
5
|
Apply when committing, pushing, opening or updating a PR, writing a pull request,
|
|
5
6
|
creating release notes, or closing out remote CI. Enforces the opencode-swarm
|
|
@@ -240,6 +241,20 @@ git fetch origin $prBranch
|
|
|
240
241
|
git push origin "<your-local-branch>:$prBranch" --force-with-lease
|
|
241
242
|
```
|
|
242
243
|
|
|
244
|
+
### Fork PR workflow approval
|
|
245
|
+
|
|
246
|
+
If the PR is from a fork (head repository differs from base repository), GitHub requires explicit workflow approval after every push. CI jobs will remain in "waiting" status until approved:
|
|
247
|
+
|
|
248
|
+
```bash
|
|
249
|
+
# List pending runs
|
|
250
|
+
gh run list --repo <upstream-owner>/<upstream-repo> --branch <branch-name> --limit 5
|
|
251
|
+
|
|
252
|
+
# Approve the pending run
|
|
253
|
+
gh api -X POST repos/<upstream-owner>/<upstream-repo>/actions/runs/<run-id>/approve
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
This requires `actions: write` permission on the base repository. See the `fork-pr-operations` skill for the full protocol including race conditions, permission requirements, and stale CI verification.
|
|
257
|
+
|
|
243
258
|
### Pre-push: Push Protection and Canonical Remote
|
|
244
259
|
|
|
245
260
|
Before `git push`, run both checks:
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: design-docs
|
|
3
|
+
audience: swarm-plugin
|
|
3
4
|
description: >
|
|
4
5
|
Full execution protocol for MODE: DESIGN_DOCS — generate or sync structured,
|
|
5
6
|
language-agnostic design docs (domain.md, technical-spec.md, behavior-spec.md,
|
|
@@ -39,7 +40,7 @@ Have the `docs_design` agent (or `doc_scan`) index `<out>/` to discover any exis
|
|
|
39
40
|
Dispatch the **`docs_design`** agent (the active swarm's `docs_design` — never the standard `docs` agent) with:
|
|
40
41
|
- `TASK`, `MODE` (generate|sync), `OUT_DIR`, `LANGUAGE`
|
|
41
42
|
- For sync: `FILES CHANGED` and `CHANGES SUMMARY` from the current phase/diff
|
|
42
|
-
- `SKILLS: file:.
|
|
43
|
+
- `SKILLS: file:.swarm/bundled-skills/design-docs/SKILL.md` (this skill)
|
|
43
44
|
|
|
44
45
|
The agent owns exactly these files under `<out>` and creates NOTHING else:
|
|
45
46
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: engineering-conventions
|
|
3
|
+
audience: swarm-plugin
|
|
3
4
|
description: >
|
|
4
5
|
Guidelines and non-negotiable engineering invariants for modifying opencode-swarm.
|
|
5
6
|
Load before architecture, plugin initialization, subprocess, tool registration, plan
|
|
@@ -40,7 +41,7 @@ The full list of 12 invariants is in `AGENTS.md`. The four that have caused the
|
|
|
40
41
|
|
|
41
42
|
## Cross-link: writing tests
|
|
42
43
|
|
|
43
|
-
For test changes, also load [`.
|
|
44
|
+
For test changes, also load [`.swarm/bundled-skills/writing-tests/SKILL.md`](../writing-tests/SKILL.md). It covers `bun:test` API, mock isolation rules, CI per-file isolation, and cross-platform anti-patterns.
|
|
44
45
|
|
|
45
46
|
## Hard warning: do NOT use broad `test_runner` for repo validation
|
|
46
47
|
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: fork-pr-operations
|
|
3
|
+
audience: swarm-plugin
|
|
4
|
+
description: Operational patterns for fork PRs (head repo differs from base repo). Covers GitHub workflow approval after push, force-push protocol, remote naming conventions, stale CI verification, and bot review multi-round awareness. Load when working with fork PRs, cross-repo contributions, or workflow approval issues.
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Fork PR Operations
|
|
8
|
+
|
|
9
|
+
Fork PRs — where the head repository differs from the base repository — have a distinct operational lifecycle. GitHub treats them with stricter security defaults that require additional steps not needed for same-repo PRs.
|
|
10
|
+
|
|
11
|
+
## When to use this skill
|
|
12
|
+
|
|
13
|
+
- You are pushing to a branch on a forked repository
|
|
14
|
+
- CI checks are stuck in "waiting" status after a push
|
|
15
|
+
- You need to rebase a fork PR branch against upstream/main
|
|
16
|
+
- A bot reviewer posts after every push, creating multiple review rounds
|
|
17
|
+
|
|
18
|
+
## Workflow approval after push
|
|
19
|
+
|
|
20
|
+
**Critical:** GitHub requires explicit workflow approval for fork PRs. After every push, CI jobs remain in "waiting" status until a user with write access to the base repository approves the workflow run.
|
|
21
|
+
|
|
22
|
+
### Approval command
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
# List pending workflow runs for the PR
|
|
26
|
+
gh run list --repo <upstream-owner>/<upstream-repo> --branch <branch-name> --limit 5
|
|
27
|
+
|
|
28
|
+
# Approve a specific run
|
|
29
|
+
gh api -X POST repos/<upstream-owner>/<upstream-repo>/actions/runs/<run-id>/approve
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### Race condition: run not yet created
|
|
33
|
+
|
|
34
|
+
After pushing, there is a brief window (1-5 seconds) before GitHub creates the workflow run object. If you try to approve too quickly, the run won't exist yet. Retry with a short delay:
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
# Wait for run to appear, then approve
|
|
38
|
+
sleep 5
|
|
39
|
+
gh run list --repo <upstream-owner>/<upstream-repo> --branch <branch-name> --limit 1 --json databaseId,status --jq '.[0]'
|
|
40
|
+
# If status is "waiting", approve:
|
|
41
|
+
gh api -X POST repos/<upstream-owner>/<upstream-repo>/actions/runs/<databaseId>/approve
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### Permission requirements
|
|
45
|
+
|
|
46
|
+
The `gh api -X POST .../approve` call requires `actions: write` permission on the **base** (upstream) repository. This typically means your GitHub token needs the `repo` or `public_repo` scope, and you must have write access to the upstream repo. Fork owners without upstream write access cannot approve workflow runs — only upstream maintainers can.
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
gh auth status
|
|
50
|
+
# Verify you have repo/public_repo scope and write access to the upstream repo
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Remote naming conventions
|
|
54
|
+
|
|
55
|
+
Standard remote setup for fork-based contributions:
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
# origin = your fork
|
|
59
|
+
git remote add origin https://github.com/<your-username>/<repo>.git
|
|
60
|
+
|
|
61
|
+
# upstream = canonical repository
|
|
62
|
+
git remote add upstream https://github.com/<canonical-owner>/<repo>.git
|
|
63
|
+
|
|
64
|
+
# Additional forks by owner name (if collaborating across forks)
|
|
65
|
+
git remote add <collaborator> https://github.com/<collaborator>/<repo>.git
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Force-push protocol
|
|
69
|
+
|
|
70
|
+
Always use `--force-with-lease`, never bare `--force`:
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
# Safe: verifies remote tracking branch matches expected SHA
|
|
74
|
+
git push --force-with-lease origin <branch-name>
|
|
75
|
+
|
|
76
|
+
# DANGEROUS: overwrites any remote changes, including work by collaborators
|
|
77
|
+
git push --force origin <branch-name> # NEVER DO THIS
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
`--force-with-lease` checks that the remote tracking branch matches your local expectation. If someone else pushed between your last fetch and your force-push, the lease check fails safely instead of destroying their work.
|
|
81
|
+
|
|
82
|
+
## Rebase workflow
|
|
83
|
+
|
|
84
|
+
To sync a fork PR branch with upstream/main:
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
# Fetch latest from upstream
|
|
88
|
+
git fetch upstream
|
|
89
|
+
|
|
90
|
+
# Rebase your branch onto upstream/main
|
|
91
|
+
git rebase upstream/main
|
|
92
|
+
|
|
93
|
+
# Resolve conflicts if any, then continue
|
|
94
|
+
git rebase --continue
|
|
95
|
+
|
|
96
|
+
# Force-push the rebased branch to your fork
|
|
97
|
+
git push --force-with-lease origin <branch-name>
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
After rebase + force-push, the PR head SHA changes. All CI checks re-trigger (subject to workflow approval for fork PRs).
|
|
101
|
+
|
|
102
|
+
## Stale CI verification
|
|
103
|
+
|
|
104
|
+
After a rebase or force-push, verify CI check data belongs to the current PR head:
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
# Get current PR head SHA
|
|
108
|
+
gh pr view <number> --repo <upstream-owner>/<upstream-repo> --json headRefOid --jq '.headRefOid'
|
|
109
|
+
|
|
110
|
+
# Check if CI checks match this SHA
|
|
111
|
+
gh pr checks <number> --repo <upstream-owner>/<upstream-repo> --json name,state,startedAt,completedAt
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
If check data references an older SHA, the checks are stale. Cancel obsolete runs only after confirming they are not the current head:
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
# Cancel a specific run (only if it's NOT the current head)
|
|
118
|
+
gh run cancel <run-id> --repo <upstream-owner>/<upstream-repo>
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
## Bot review multi-round awareness
|
|
122
|
+
|
|
123
|
+
Automated bot reviewers (e.g., hermes-pr-review) post a new review after **every push**. If you push N times, you get N bot reviews. This is expected behavior, not a bug.
|
|
124
|
+
|
|
125
|
+
### Strategy
|
|
126
|
+
|
|
127
|
+
1. **Ignore APPROVE rounds** from bots. A bot APPROVE after a trivial push adds no signal.
|
|
128
|
+
2. **Scan for new findings only.** Compare the latest bot review against prior rounds to identify newly raised issues.
|
|
129
|
+
3. **Focus on human reviewer findings.** Bot findings are advisory; human reviewer findings are binding.
|
|
130
|
+
4. **Do not attempt to silence the bot.** The multi-round pattern is by design.
|
|
131
|
+
|
|
132
|
+
## Cross-references
|
|
133
|
+
|
|
134
|
+
- `.claude/skills/commit-pr/SKILL.md` — PR publication protocol, including `--force-with-lease` guidance and remote check verification
|
|
135
|
+
- `.opencode/skills/swarm-pr-feedback/SKILL.md` — Feedback closure workflow for addressing review findings
|
|
136
|
+
- `.agents/skills/subprocess-safety/SKILL.md` — Subprocess safety for `gh` CLI calls
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: loop
|
|
3
|
+
audience: swarm-plugin
|
|
3
4
|
description: >
|
|
4
5
|
Full execution protocol for MODE: LOOP — the compound-engineering loop:
|
|
5
6
|
brainstorm → plan → build → review → improve, iterating under
|
|
@@ -116,7 +117,7 @@ directly (skip full discovery dialogue) — the objective is already framed.
|
|
|
116
117
|
### Phase 1 — BRAINSTORM (cycle 1 only)
|
|
117
118
|
|
|
118
119
|
- **Entry gate:** objective is non-empty; no approved plan already covers it.
|
|
119
|
-
- **Action:** Load `file:.
|
|
120
|
+
- **Action:** Load `file:.swarm/bundled-skills/brainstorm/SKILL.md` and run it to
|
|
120
121
|
produce `.swarm/spec.md` and a QA gate profile. With `depth=exhaustive`,
|
|
121
122
|
require at least one non-obvious candidate approach.
|
|
122
123
|
- **Exit gate:** `spec.md` exists with explicit, testable success criteria and
|
|
@@ -128,13 +129,13 @@ directly (skip full discovery dialogue) — the objective is already framed.
|
|
|
128
129
|
|
|
129
130
|
- **Entry gate:** a spec (or, on cycle 2+, the improvement directives) exists.
|
|
130
131
|
- **Action:**
|
|
131
|
-
1. Load `file:.
|
|
132
|
+
1. Load `file:.swarm/bundled-skills/pre-phase-briefing/SKILL.md` (required before
|
|
132
133
|
planning, especially on cycle 2+: it reads the prior retrospective and
|
|
133
134
|
verifies codebase reality so the new plan reflects what actually changed).
|
|
134
|
-
2. Load `file:.
|
|
135
|
+
2. Load `file:.swarm/bundled-skills/plan/SKILL.md` to decompose the work into
|
|
135
136
|
tasks and call `save_plan`. With `depth=exhaustive`, prefer finer task
|
|
136
137
|
granularity and deeper localization.
|
|
137
|
-
3. Load `file:.
|
|
138
|
+
3. Load `file:.swarm/bundled-skills/critic-gate/SKILL.md` to put the plan through
|
|
138
139
|
an independent critic.
|
|
139
140
|
- **Exit gate:** critic verdict is APPROVED (NEEDS_REVISION → revise and
|
|
140
141
|
re-submit, max 2 cycles per the critic-gate skill; REJECTED → stop and report
|
|
@@ -143,7 +144,7 @@ directly (skip full discovery dialogue) — the objective is already framed.
|
|
|
143
144
|
### Phase 3 — BUILD
|
|
144
145
|
|
|
145
146
|
- **Entry gate:** a critic-approved plan exists.
|
|
146
|
-
- **Action:** Load `file:.
|
|
147
|
+
- **Action:** Load `file:.swarm/bundled-skills/execute/SKILL.md` and run the plan
|
|
147
148
|
phase by phase. The coder implements each task; per-task QA gates (tests,
|
|
148
149
|
lint, security, etc.) run as defined by the selected QA profile. The coder
|
|
149
150
|
context is the **generator** — it does not get to declare its own work
|
|
@@ -188,7 +189,7 @@ This is what makes the loop compound. Do not declare completion without it.
|
|
|
188
189
|
|
|
189
190
|
- **Entry gate:** REVIEW exit gate passed.
|
|
190
191
|
- **Action:**
|
|
191
|
-
1. Load `file:.
|
|
192
|
+
1. Load `file:.swarm/bundled-skills/phase-wrap/SKILL.md` and write the mandatory
|
|
192
193
|
retrospective (the `phase_complete` gate blocks without a valid `retro-N`
|
|
193
194
|
bundle). Rescan the codebase and update documentation exactly as the
|
|
194
195
|
phase-wrap skill directs — that is, scoped to its authorized set
|