@seanyao/roll 4.702.4 → 4.703.2
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/CHANGELOG.md +32 -0
- package/README.md +31 -0
- package/dist/roll.mjs +11164 -6774
- package/guide/en/acceptance-evidence.md +38 -1
- package/guide/en/configuration.md +14 -0
- package/guide/en/loop.md +132 -1
- package/guide/en/methodology.md +1 -1
- package/guide/zh/acceptance-evidence.md +32 -1
- package/guide/zh/configuration.md +11 -0
- package/guide/zh/loop.md +116 -1
- package/package.json +1 -1
|
@@ -67,6 +67,36 @@ loop_safety:
|
|
|
67
67
|
Soft mode records the gap and raises the same audit signal, but it does not
|
|
68
68
|
block the delivery cycle. Treat it as temporary compatibility, not the default.
|
|
69
69
|
|
|
70
|
+
The merge gate reads structured evidence, not prose. A delivery can be refused
|
|
71
|
+
when any of these facts are true:
|
|
72
|
+
|
|
73
|
+
- `attest render` exits non-zero;
|
|
74
|
+
- `ac-map.json` references a path that does not resolve under the story run or
|
|
75
|
+
card archive, except allowed GitHub PR/commit/check URLs for this repository;
|
|
76
|
+
- an AC remains `claimed`, which means the Builder asserted completion without
|
|
77
|
+
pass/fail evidence;
|
|
78
|
+
- a positive AC has no real evidence reference;
|
|
79
|
+
- a non-exempt visual card has no captured screenshot or recorded machine
|
|
80
|
+
capture skip;
|
|
81
|
+
- a declared `deliverable_url`, `deliverable_cmd`, or `physical_terminal`
|
|
82
|
+
surface was not really captured;
|
|
83
|
+
- an AC is `fail`, which means a check ran and went red.
|
|
84
|
+
|
|
85
|
+
The PR body carries a `Roll-Evidence` trailer that points reviewers to the
|
|
86
|
+
story-scoped evidence. Treat that trailer as the entry point for human review:
|
|
87
|
+
open the Acceptance Review Page, then follow the AC map and referenced files.
|
|
88
|
+
|
|
89
|
+
Use the audit command before release or when a Done row looks suspicious:
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
roll attest audit
|
|
93
|
+
roll attest audit --json
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
It scans Done stories for missing reports, missing or empty `ac-map.json`,
|
|
97
|
+
dangling evidence references, and `evidence_debt` rows. A clean audit exits 0;
|
|
98
|
+
any issue exits 1 and lists the story IDs and missing references.
|
|
99
|
+
|
|
70
100
|
## The red line
|
|
71
101
|
|
|
72
102
|
An AC with **zero evidence** can never claim `pass`: the renderer forces it
|
|
@@ -96,7 +126,10 @@ Two rules decide what the validator recognises:
|
|
|
96
126
|
- a declared `physical_terminal:` ⇒ **terminal** with a stricter contract — the
|
|
97
127
|
report must contain a real macOS `Terminal.app` screenshot captured from
|
|
98
128
|
screen pixels. Headless stdout, transcript-rendered images, and HTML replays
|
|
99
|
-
are rejected for this contract
|
|
129
|
+
are rejected for this contract. `roll attest` also asks the
|
|
130
|
+
`physical.screenshot` provider for this evidence when available, copies the
|
|
131
|
+
returned PNG into the story run, and shows the status chain
|
|
132
|
+
`requested -> taken/skipped/failed/timeout -> attached/not-attached`;
|
|
100
133
|
- else a declared `deliverable_cmd:` ⇒ **terminal** — a CLI deliverable that
|
|
101
134
|
rides the terminal-capture lane;
|
|
102
135
|
- else the AC text decides (web / terminal / ambiguous).
|
|
@@ -142,6 +175,10 @@ at startup:
|
|
|
142
175
|
repeated `roll doctor` / setup checks do not keep re-triggering the macOS
|
|
143
176
|
prompt; if permission was just granted, restart Terminal.app before trusting
|
|
144
177
|
the cache.
|
|
178
|
+
- `Roll Capture.app` / `physical.screenshot` — the provider path for physical
|
|
179
|
+
screenshot requests. If readiness is unavailable, `roll attest` records an
|
|
180
|
+
honest skip with the setup reason instead of blocking report generation; if
|
|
181
|
+
the provider times out, the report surfaces timeout as its own failure reason.
|
|
145
182
|
- `Playwright Chromium` — optional headless web capture for `roll attest` and
|
|
146
183
|
archive screenshots. Install with `npx playwright install chromium`.
|
|
147
184
|
|
|
@@ -86,6 +86,20 @@ loop_safety:
|
|
|
86
86
|
Use `attest_gate: soft` only for an explicit migration window. Soft mode keeps
|
|
87
87
|
the audit trail and alert, but it does not block the delivery cycle.
|
|
88
88
|
|
|
89
|
+
Automatic card picking also has an advisory semantic ranking layer. It is on by
|
|
90
|
+
default and can be disabled explicitly:
|
|
91
|
+
|
|
92
|
+
```yaml
|
|
93
|
+
pick:
|
|
94
|
+
semantic_ranking: off
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
When enabled, Roll asks the default agent to rank the current candidate backlog
|
|
98
|
+
only when the backlog/candidate hash changes, caches the result in
|
|
99
|
+
`.roll/loop/pick-ranking.json`, and then still applies the normal picker gates.
|
|
100
|
+
If the agent times out or returns bad JSON, Roll records `harness_failure` and
|
|
101
|
+
falls back to the deterministic order.
|
|
102
|
+
|
|
89
103
|
## Verifying
|
|
90
104
|
|
|
91
105
|
`roll status` prints the resolved paths so you can confirm overrides took
|
package/guide/en/loop.md
CHANGED
|
@@ -22,6 +22,76 @@ agent bindings.
|
|
|
22
22
|
Loop runs inside a **tmux session** named `roll-loop-<project-slug>`.
|
|
23
23
|
When not muted, a terminal window pops up automatically so you can watch in real time.
|
|
24
24
|
|
|
25
|
+
## North Star Readings
|
|
26
|
+
|
|
27
|
+
`roll status` starts with a one-line North Star summary so the owner can see the
|
|
28
|
+
system trend before reading the rest of the health panel. The row is the compact
|
|
29
|
+
form of `roll north`: autonomy, delivery rate, fix tax, and attribution errors.
|
|
30
|
+
Each value is followed by a status dot; run `roll north` when you need the
|
|
31
|
+
target, trend, and reason text.
|
|
32
|
+
|
|
33
|
+
`roll north [--json]` reads the last 14 days of runs, events, backlog, card
|
|
34
|
+
metadata, and delivery truth. The four targets are:
|
|
35
|
+
|
|
36
|
+
| Metric | Target | Anti-gaming rule | `null` means |
|
|
37
|
+
|--------|--------|------------------|--------------|
|
|
38
|
+
| Autonomy | >=72h autonomous runtime | An effective autonomous day needs at least 6 non-idle attempts; backlog-empty days pause the clock and do not count as missed time. | There is not enough qualifying run history yet, or the backlog was empty for the window. |
|
|
39
|
+
| Delivery rate | >=60% | Delivery is counted from merge truth, not self-reported cycle exits. | No eligible delivery denominator exists yet. |
|
|
40
|
+
| Fix tax | <1x | The denominator is US cards only; FIX work is not allowed to improve its own ratio. | There is no US-card denominator in the window. |
|
|
41
|
+
| Attribution errors | =0 | `unknown` is not guessed into env, harness, or card; missing envelopes stay visible. | No attribution sample exists yet. |
|
|
42
|
+
|
|
43
|
+
Machine consumers should use `roll north --json`, which emits
|
|
44
|
+
`roll.north.v1` with the same current values, targets, reasons, and daily
|
|
45
|
+
series used by the terminal panel.
|
|
46
|
+
|
|
47
|
+
## Failure Attribution and Pauses
|
|
48
|
+
|
|
49
|
+
Every failed cycle is assigned one of four classes:
|
|
50
|
+
|
|
51
|
+
| Class | Meaning | Owner action |
|
|
52
|
+
|-------|---------|--------------|
|
|
53
|
+
| `env` | Machine, checkout, auth, network, sandbox, or worktree condition. | Repair the named environment problem, then resume dispatch. |
|
|
54
|
+
| `harness` | A Roll component failed, such as score parsing, attest render, publish, or rescue. | Inspect the component and open a focused FIX when needed. |
|
|
55
|
+
| `card` | The Builder reached the story and failed during actual card work. | Investigate the story, split it, or change routing after reading evidence. |
|
|
56
|
+
| `unknown` | There is not enough envelope evidence to charge a card honestly. | Add a deterministic failure envelope before blaming the card. |
|
|
57
|
+
|
|
58
|
+
Root-cause counting is by `root_cause_key`, not by card. Repeated `env`,
|
|
59
|
+
`harness`, or `unknown` causes pause dispatch and write a diagnostic snapshot
|
|
60
|
+
under `.roll/loop/diagnostics/`. When the terminal says dispatch is paused,
|
|
61
|
+
open that snapshot first: it includes the class, root cause, recent events, and
|
|
62
|
+
playbook. Fix the named machine or Roll component, then run `roll loop resume`.
|
|
63
|
+
|
|
64
|
+
If earlier env/harness failures pushed a card into the skip list, rebuild that
|
|
65
|
+
state from the durable evidence:
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
roll loop pardon-skip-list --dry-run
|
|
69
|
+
roll loop pardon-skip-list
|
|
70
|
+
roll loop pardon-skip-list --include-unknown # also pardons unknown/no-evidence rows
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Use `--include-unknown` only after reading the rows; older zero-usage `gave_up`
|
|
74
|
+
entries may be real card failures.
|
|
75
|
+
|
|
76
|
+
## Builder Isolation and Rescue
|
|
77
|
+
|
|
78
|
+
During Builder execution the main checkout is physically write-protected. The
|
|
79
|
+
Builder works in its cycle worktree; the shared checkout is treated as a sensor,
|
|
80
|
+
not a scratchpad. Roll releases the write protection when the cycle exits.
|
|
81
|
+
|
|
82
|
+
If dirty or ahead changes appear in the main checkout anyway, Roll quarantines
|
|
83
|
+
them before continuing:
|
|
84
|
+
|
|
85
|
+
- dirty files become a `rescue/leaked-*` ref that can be restored with the
|
|
86
|
+
manifest's `git stash apply <ref>` command;
|
|
87
|
+
- ahead commits become a `rescue/leaked-*` branch that can be restored with the
|
|
88
|
+
manifest's `git cherry-pick <ref>` command;
|
|
89
|
+
- the manifest is written under `.roll/loop/quarantine/` and records the cycle,
|
|
90
|
+
story, phase, files, ref, and exact restore command.
|
|
91
|
+
|
|
92
|
+
Claim the rescued work from the manifest, then reset or resume the loop from a
|
|
93
|
+
clean main checkout.
|
|
94
|
+
|
|
25
95
|
## Scheduling
|
|
26
96
|
|
|
27
97
|
Loop is scheduled via **launchd** (macOS). By default, every hour at a
|
|
@@ -193,6 +263,13 @@ roll agent # Show scopes, roles, agent pool, and legac
|
|
|
193
263
|
roll agent list # Show agents installed on this machine
|
|
194
264
|
```
|
|
195
265
|
|
|
266
|
+
When semantic pick ranking is enabled, `roll loop watch --events` includes a
|
|
267
|
+
`pick:ranked` line such as `picked US-123 (rank 1/5: unblocks the release lane)`.
|
|
268
|
+
`roll supervisor next` and `roll supervisor next --json` show the latest top
|
|
269
|
+
three ranking suggestions and reasons. The ranking is advisory only; Hold, Cut,
|
|
270
|
+
unsatisfied dependencies, skip-list, open PR, merged-delivery, and pending-publish
|
|
271
|
+
gates still decide eligibility.
|
|
272
|
+
|
|
196
273
|
### Goal Mode vs Scheduled Mode
|
|
197
274
|
|
|
198
275
|
`roll loop go` is a manual goal session, not a launchd scheduler tick. While it
|
|
@@ -1013,6 +1090,60 @@ This keeps `git worktree list` clean and prevents `.claude/worktrees/` from
|
|
|
1013
1090
|
accumulating old entries over time. Active worktrees (branches ahead of `main`)
|
|
1014
1091
|
are left untouched.
|
|
1015
1092
|
|
|
1093
|
+
## Main Checkout Guard
|
|
1094
|
+
|
|
1095
|
+
During the Builder process, Roll makes the shared main checkout read-only at the
|
|
1096
|
+
filesystem boundary while leaving the cycle worktree writable. If a previous
|
|
1097
|
+
cycle left product files dirty or local commits ahead of `origin/main`, Roll
|
|
1098
|
+
moves that pollution to a `rescue/leaked-*` ref plus a
|
|
1099
|
+
`.roll/loop/quarantine/*.json` manifest, restores main to the trusted state, and
|
|
1100
|
+
continues the cycle.
|
|
1101
|
+
|
|
1102
|
+
The event stream records `sandbox:write_protected` and `sandbox:quarantined`.
|
|
1103
|
+
`roll loop watch --events`, `roll loop cycle <id> --activity`, and supervisor output
|
|
1104
|
+
surface those facts. Each quarantine manifest includes the ref, file list, and a
|
|
1105
|
+
one-line restore command for owner/supervisor recovery.
|
|
1106
|
+
|
|
1107
|
+
## Post-cycle Environment Cleanup
|
|
1108
|
+
|
|
1109
|
+
Before the cycle worktree is removed, loop runs a declarative environment
|
|
1110
|
+
cleanup step. It targets only transient toolchain/scratch artifacts produced
|
|
1111
|
+
inside the worktree — e.g. `.scratch`, `tmp`, `node_modules/.cache`, `.vite`,
|
|
1112
|
+
`__pycache__`, `.build` — and leaves source files and uncommitted work alone.
|
|
1113
|
+
|
|
1114
|
+
Each rule emits a `cycle:cleanup` event to `events.ndjson`, so the cleanup is
|
|
1115
|
+
observable and auditable. Cleanup failures are downgraded to warning events,
|
|
1116
|
+
also summarized in `ALERT.md` under the independent `harness:env_cleanup` root
|
|
1117
|
+
cause, and never block the next cycle.
|
|
1118
|
+
|
|
1119
|
+
You can override or extend the default rules by creating
|
|
1120
|
+
`.roll/loop/cleanup-manifest.yaml`:
|
|
1121
|
+
|
|
1122
|
+
```yaml
|
|
1123
|
+
rules:
|
|
1124
|
+
- name: my-scratch
|
|
1125
|
+
kind: rm
|
|
1126
|
+
paths:
|
|
1127
|
+
- .my-tmp
|
|
1128
|
+
- "**/roll-cleanup.log"
|
|
1129
|
+
- name: my-cache
|
|
1130
|
+
kind: isolate
|
|
1131
|
+
paths:
|
|
1132
|
+
- .my-cache
|
|
1133
|
+
```
|
|
1134
|
+
|
|
1135
|
+
`kind: rm` deletes the path; `kind: isolate` moves it into a cycle-local
|
|
1136
|
+
`.roll-cleanup/<cycle-id>/<rule>/` directory inside the worktree (so it is
|
|
1137
|
+
removed along with the worktree).
|
|
1138
|
+
|
|
1139
|
+
Supported path forms are deliberately small: literal relative paths such as
|
|
1140
|
+
`.my-tmp` and recursive suffix matches of the form `prefix/**/literal-suffix`,
|
|
1141
|
+
including `**/roll-cleanup.log` or `src/**/__pycache__`. Shell globs are not
|
|
1142
|
+
expanded; a `*` inside the recursive suffix, such as `**/*.log`, makes that rule
|
|
1143
|
+
invalid, emits a warning, and skips the rule. Use `rules: []` or
|
|
1144
|
+
`enabled: false` to disable cleanup explicitly. The default manifest is used
|
|
1145
|
+
only when no override file is present.
|
|
1146
|
+
|
|
1016
1147
|
## Cycle phases
|
|
1017
1148
|
|
|
1018
1149
|
Every cycle is sliced into seven named phases. Each phase emits a `phase_start`
|
|
@@ -1027,7 +1158,7 @@ so the tmux viewer never looks frozen.
|
|
|
1027
1158
|
| 3 | `worktree_setup` | fetch origin + worktree create + meta sync | 2 – 10 s |
|
|
1028
1159
|
| 4 | `agent_invoke` | Agent executes with up to 3 retries | 5 – 45 min |
|
|
1029
1160
|
| 5 | `publish_push` | push branch + open PR (or doc-only merge) | 5 – 30 s |
|
|
1030
|
-
| 6 | `cleanup` | emit PR final state + worktree teardown | < 1 s |
|
|
1161
|
+
| 6 | `cleanup` | env cleanup + emit PR final state + worktree teardown | < 1 s |
|
|
1031
1162
|
|
|
1032
1163
|
> **US-AUTO-044**: the main loop exits after opening the PR and **no longer waits for merge**. Merge / rebase / close is handled asynchronously by the dedicated PR Loop (`com.roll.pr.<slug>`, every 5 min); a story with an open PR is skipped by the eligibility gate, so it is neither re-opened nor falsely marked Done.
|
|
1033
1164
|
|
package/guide/en/methodology.md
CHANGED
|
@@ -590,7 +590,7 @@ It is off by default. Enabling it requires an explicit `roll loop on`.
|
|
|
590
590
|
|
|
591
591
|
### 9.2 Components
|
|
592
592
|
|
|
593
|
-
**`roll-loop`** — Runs on a configurable schedule via macOS launchd (Linux: crontab). Scans BACKLOG for `📋 Todo` items and routes them: `US-XXX → $roll-build`, `FIX-XXX → $roll-fix`, `REFACTOR-XXX → $roll-build`. Caps items per run to limit blast radius. Rebuilds the
|
|
593
|
+
**`roll-loop`** — Runs on a configurable schedule via macOS launchd (Linux: crontab). Scans BACKLOG for `📋 Todo` items and routes them: `US-XXX → $roll-build`, `FIX-XXX → $roll-fix`, `REFACTOR-XXX → $roll-build`. Caps items per run to limit blast radius. Rebuilds the Loop Digest from windowed `events.ndjson` / `runs.jsonl` facts as it goes; contradictory digest data is marked degraded and emits an ALERT instead of being reported as normal. Built-in TCR enforcement: after a story completes, checks for `tcr:` micro-commits — if zero are found, reverts the story to Todo with an ALERT, preventing agents from skipping the TCR rhythm.
|
|
594
594
|
|
|
595
595
|
**`roll-.dream`** — Runs nightly (03:00 local) via macOS launchd (Linux: crontab). Scans the codebase for dead code, architectural drift against `.roll/domain/`, pruning candidates, and emerging patterns. Outputs `REFACTOR-XXX` entries to BACKLOG and a log to `.roll/dream/YYYY-MM-DD.md`.
|
|
596
596
|
|
|
@@ -59,6 +59,31 @@ loop_safety:
|
|
|
59
59
|
soft 模式会记录缺口并发出同一类审计信号,但不阻塞本轮交付。它是临时兼容口,
|
|
60
60
|
不是默认行为。
|
|
61
61
|
|
|
62
|
+
合并闸读取结构化证据,不读口头说明。出现以下事实时,交付可能被拒合:
|
|
63
|
+
|
|
64
|
+
- `attest render` 退出码非零;
|
|
65
|
+
- `ac-map.json` 引用的路径无法在本次 story run 或卡片归档下解析,除非是本仓允许的
|
|
66
|
+
GitHub PR/commit/check URL;
|
|
67
|
+
- AC 仍是 `claimed`,表示 Builder 只有完成声明,没有 pass/fail 证据;
|
|
68
|
+
- positive AC 没有真实证据引用;
|
|
69
|
+
- 无豁免的可视卡没有截图,也没有记录化的机器采集 skip;
|
|
70
|
+
- 声明了 `deliverable_url`、`deliverable_cmd` 或 `physical_terminal`,但对应
|
|
71
|
+
surface 没有真实采集;
|
|
72
|
+
- AC 是 `fail`,表示检查执行过并变红。
|
|
73
|
+
|
|
74
|
+
PR body 会带 `Roll-Evidence` trailer,指向这张 Story 的证据入口。人工评审从这里开始:
|
|
75
|
+
打开验收 Review Page,再沿 AC map 和引用文件检查。
|
|
76
|
+
|
|
77
|
+
发版前或发现 Done 行可疑时,运行审计命令:
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
roll attest audit
|
|
81
|
+
roll attest audit --json
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
它会扫描 Done stories,查缺失报告、缺失或空的 `ac-map.json`、悬空证据引用和
|
|
85
|
+
`evidence_debt` 行。无问题退出 0;发现问题退出 1,并列出 story ID 与缺失引用。
|
|
86
|
+
|
|
62
87
|
## 红线
|
|
63
88
|
|
|
64
89
|
**零证据**的 AC 永远不能是 `pass`:渲染层强制降级为 🟧 仅声明,并列入
|
|
@@ -84,7 +109,10 @@ soft 模式会记录缺口并发出同一类审计信号,但不阻塞本轮交
|
|
|
84
109
|
产品页,就该截 web 图;
|
|
85
110
|
- 声明了 `physical_terminal:` ⇒ **terminal**,但合同更严格——报告必须包含从 macOS
|
|
86
111
|
`Terminal.app` 真实屏幕像素截下来的图。headless stdout、transcript 渲染图、
|
|
87
|
-
HTML replay
|
|
112
|
+
HTML replay 图都不能满足这个合同。`roll attest` 会在可用时请求
|
|
113
|
+
`physical.screenshot` provider,把返回的 PNG 复制进本 story 的 run 目录,
|
|
114
|
+
并在报告里展示 `requested -> taken/skipped/failed/timeout -> attached/not-attached`
|
|
115
|
+
状态链;
|
|
88
116
|
- 否则声明了 `deliverable_cmd:` ⇒ **terminal**——走终端截屏通道的 CLI 交付;
|
|
89
117
|
- 否则由 AC 文本判定(web / terminal / 含糊)。
|
|
90
118
|
|
|
@@ -122,6 +150,9 @@ evidence、已有证据暴露 rendering/layout 风险;升级原因必须记录
|
|
|
122
150
|
复现图都不算截图证据。交互式 `Terminal.app` 授权探针一旦成功,会缓存在
|
|
123
151
|
`ROLL_HOME` 下,后续 `roll doctor` / setup 检查不会反复触发 macOS 权限弹窗;
|
|
124
152
|
如果刚刚授权,先重启 Terminal.app 再信任缓存。
|
|
153
|
+
- `Roll Capture.app` / `physical.screenshot` —— 物理截图请求的 provider 通道。
|
|
154
|
+
就绪度不可用时,`roll attest` 记录带设置原因的 honest skip,不阻断报告生成;
|
|
155
|
+
provider 超时时,报告把 timeout 作为独立失败原因展示。
|
|
125
156
|
- `Playwright Chromium` —— 可选的 headless web 截图工具,用于 `roll attest`
|
|
126
157
|
和归档截图。安装命令是 `npx playwright install chromium`。
|
|
127
158
|
|
|
@@ -76,6 +76,17 @@ loop_safety:
|
|
|
76
76
|
只有显式迁移窗口才应使用 `attest_gate: soft`。soft 模式保留审计记录和告警,
|
|
77
77
|
但不阻塞本轮交付。
|
|
78
78
|
|
|
79
|
+
自动选卡还有一层 advisory 语义排序。它默认开启,也可以显式关闭:
|
|
80
|
+
|
|
81
|
+
```yaml
|
|
82
|
+
pick:
|
|
83
|
+
semantic_ranking: off
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
开启后,Roll 只在 backlog / candidate hash 变化时让默认 agent 排序一次,并把结果
|
|
87
|
+
缓存到 `.roll/loop/pick-ranking.json`;最终仍由既有 picker gates 决定能不能选。
|
|
88
|
+
如果 agent 超时或返回坏 JSON,Roll 记录 `harness_failure` 并回落到确定性顺序。
|
|
89
|
+
|
|
79
90
|
## 验证
|
|
80
91
|
|
|
81
92
|
`roll status` 会打印解析后的路径,便于确认覆盖是否生效;
|
package/guide/zh/loop.md
CHANGED
|
@@ -20,6 +20,67 @@ autonomous,不改变 agent binding。
|
|
|
20
20
|
Loop 在名为 **`roll-loop-<project-slug>`** 的 **tmux session** 里运行。
|
|
21
21
|
未静音时,终端窗口会自动弹出,你可以实时旁观 AI 干活。
|
|
22
22
|
|
|
23
|
+
## 北极星读数
|
|
24
|
+
|
|
25
|
+
`roll status` 顶部先显示一行北极星摘要,让 owner 在读完整健康面板前先看到系统趋势。
|
|
26
|
+
这行是 `roll north` 的压缩版:自主运行时长、交付率、修复税、归因错误。每个值后面
|
|
27
|
+
有状态点;需要目标、趋势和原因时运行 `roll north`。
|
|
28
|
+
|
|
29
|
+
`roll north [--json]` 读取最近 14 天的 runs、events、backlog、卡片元数据与交付真相。
|
|
30
|
+
四项目标如下:
|
|
31
|
+
|
|
32
|
+
| 指标 | 目标 | 防应试口径 | `null` 含义 |
|
|
33
|
+
|------|------|------------|-------------|
|
|
34
|
+
| 自主运行时长 | ≥72 小时 | 有效自主日需要至少 6 次非 idle 尝试;backlog 空的日期只停表,不计为未达标时间。 | 暂无足够合格运行历史,或窗口内 backlog 为空。 |
|
|
35
|
+
| 交付率 | ≥60% | 交付按 merge truth 统计,不按 cycle 自报退出码。 | 暂无可作为分母的交付样本。 |
|
|
36
|
+
| 修复税 | <1x | 分母仅统计 US 卡;FIX 工作不能改善自己的比值。 | 窗口内没有 US 卡分母。 |
|
|
37
|
+
| 归因错误 | =0 | `unknown` 不猜成 env、harness 或 card;缺失 envelope 保持可见。 | 暂无归因样本。 |
|
|
38
|
+
|
|
39
|
+
脚本消费用 `roll north --json`,它输出 `roll.north.v1`,字段与终端面板使用的当前值、
|
|
40
|
+
目标、原因和每日序列一致。
|
|
41
|
+
|
|
42
|
+
## 失败归因与暂停
|
|
43
|
+
|
|
44
|
+
每个失败 cycle 都归到四类之一:
|
|
45
|
+
|
|
46
|
+
| 类别 | 含义 | owner 动作 |
|
|
47
|
+
|------|------|------------|
|
|
48
|
+
| `env` | 机器、checkout、auth、network、sandbox 或 worktree 条件。 | 修复点名的环境问题,再恢复派工。 |
|
|
49
|
+
| `harness` | Roll 组件失败,例如 score 解析、attest render、publish 或 rescue。 | 检查对应组件,必要时开聚焦 FIX。 |
|
|
50
|
+
| `card` | Builder 已进入 story,并在真实卡片工作中失败。 | 读证据后调查 story、拆卡或调整路由。 |
|
|
51
|
+
| `unknown` | 没有足够 envelope 证据诚实归因给卡片。 | 先补确定性失败 envelope,再考虑归因。 |
|
|
52
|
+
|
|
53
|
+
根因计数按 `root_cause_key`,不是按卡片。同一个 `env`、`harness` 或 `unknown`
|
|
54
|
+
根因反复出现时,Roll 会暂停派工,并在 `.roll/loop/diagnostics/` 写诊断快照。
|
|
55
|
+
终端提示派工暂停时,先打开快照:里面有归因类别、根因、最近事件和 playbook。
|
|
56
|
+
修复点名的机器或 Roll 组件后,再运行 `roll loop resume`。
|
|
57
|
+
|
|
58
|
+
如果早先的 env/harness 失败把卡片错误推入 skip list,可以从持久证据重建:
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
roll loop pardon-skip-list --dry-run
|
|
62
|
+
roll loop pardon-skip-list
|
|
63
|
+
roll loop pardon-skip-list --include-unknown # 同时平反 unknown/no-evidence 行
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
`--include-unknown` 只应在读过记录后使用;较早的零用量 `gave_up` 行可能是真实 card 失败。
|
|
67
|
+
|
|
68
|
+
## Builder 隔离与救援区
|
|
69
|
+
|
|
70
|
+
Builder 执行期间,主 checkout 会被物理写保护。Builder 在自己的 cycle worktree 中工作;
|
|
71
|
+
共享 checkout 是传感器,不是草稿区。cycle 退出时 Roll 会释放写保护。
|
|
72
|
+
|
|
73
|
+
如果 dirty 或 ahead 改动仍然出现在主 checkout,Roll 会先隔离再继续:
|
|
74
|
+
|
|
75
|
+
- dirty 文件写成 `rescue/leaked-*` ref,可按 manifest 里的
|
|
76
|
+
`git stash apply <ref>` 还原;
|
|
77
|
+
- ahead commits 写成 `rescue/leaked-*` 分支,可按 manifest 里的
|
|
78
|
+
`git cherry-pick <ref>` 还原;
|
|
79
|
+
- manifest 写在 `.roll/loop/quarantine/`,记录 cycle、story、phase、文件列表、
|
|
80
|
+
ref 和精确还原命令。
|
|
81
|
+
|
|
82
|
+
按 manifest 认领隔离内容,然后把主 checkout 恢复干净,再恢复 loop。
|
|
83
|
+
|
|
23
84
|
## 调度配置
|
|
24
85
|
|
|
25
86
|
Loop 通过 **launchd**(macOS)调度。默认每小时在一个根据项目路径推导出的分钟触发
|
|
@@ -172,6 +233,12 @@ roll agent # 查看 scope、role、agent pool 与 lega
|
|
|
172
233
|
roll agent list # 查看本机已装的 agent
|
|
173
234
|
```
|
|
174
235
|
|
|
236
|
+
开启语义选卡排序时,`roll loop watch --events` 会显示 `pick:ranked` 行,例如
|
|
237
|
+
`picked US-123 (rank 1/5: unblocks the release lane)`。`roll supervisor next` 和
|
|
238
|
+
`roll supervisor next --json` 会展示最近一次 top3 排序建议与理由。该排序只作建议;
|
|
239
|
+
Hold、Cut、未满足依赖、skip-list、open PR、已合并交付和 pending-publish gate 仍决定
|
|
240
|
+
卡片是否可选。
|
|
241
|
+
|
|
175
242
|
### Goal Mode 与定时模式
|
|
176
243
|
|
|
177
244
|
`roll loop go` 是手动 goal session,不是 launchd 定时 tick。运行期间 Roll 会持有
|
|
@@ -897,6 +964,54 @@ API key secret — 你配置的 agent 对应的那个。
|
|
|
897
964
|
这样可以保持 `git worktree list` 干净,防止 `.claude/worktrees/` 随时间积累。
|
|
898
965
|
分支仍领先于 `main` 的活跃 worktree 不受影响。
|
|
899
966
|
|
|
967
|
+
## 主 checkout 保护
|
|
968
|
+
|
|
969
|
+
Builder 进程运行期间,Roll 会在文件系统边界把共享主 checkout 设为只读,
|
|
970
|
+
同时保持 cycle worktree 可写。如果上一轮 cycle 把产品文件留脏,或让本地
|
|
971
|
+
`main` 领先 `origin/main`,Roll 会把污染物移入 `rescue/leaked-*` ref 和
|
|
972
|
+
`.roll/loop/quarantine/*.json` 清单,随后把主 checkout 恢复到可信状态并继续
|
|
973
|
+
本轮 cycle。
|
|
974
|
+
|
|
975
|
+
事件流会记录 `sandbox:write_protected` 和 `sandbox:quarantined`。
|
|
976
|
+
`roll loop watch --events`、`roll loop cycle <id> --activity` 和 supervisor 输出都会
|
|
977
|
+
展示这些事实。每个 quarantine 清单都包含 ref、文件列表,以及供 owner /
|
|
978
|
+
supervisor 认领恢复的一行命令。
|
|
979
|
+
|
|
980
|
+
## Cycle 结束后环境清理
|
|
981
|
+
|
|
982
|
+
在拆除 cycle worktree 之前,loop 会先执行一次声明式的环境清理。它只清理
|
|
983
|
+
worktree 内部产生的临时/工具链缓存产物——例如 `.scratch`、`tmp`、
|
|
984
|
+
`node_modules/.cache`、`.vite`、`__pycache__`、`.build`——不会触碰源码和
|
|
985
|
+
未提交的改动。
|
|
986
|
+
|
|
987
|
+
每条规则都会向 `events.ndjson` 写入一条 `cycle:cleanup` 事件,因此清理过程
|
|
988
|
+
可观测、可审计。清理失败会降级为 warning 事件,同时汇总写入 `ALERT.md`,
|
|
989
|
+
并按独立的 `harness:env_cleanup` 根因计数;它不会阻塞下一轮 cycle。
|
|
990
|
+
|
|
991
|
+
你可以通过 `.roll/loop/cleanup-manifest.yaml` 覆盖或扩展默认规则:
|
|
992
|
+
|
|
993
|
+
```yaml
|
|
994
|
+
rules:
|
|
995
|
+
- name: my-scratch
|
|
996
|
+
kind: rm
|
|
997
|
+
paths:
|
|
998
|
+
- .my-tmp
|
|
999
|
+
- "**/roll-cleanup.log"
|
|
1000
|
+
- name: my-cache
|
|
1001
|
+
kind: isolate
|
|
1002
|
+
paths:
|
|
1003
|
+
- .my-cache
|
|
1004
|
+
```
|
|
1005
|
+
|
|
1006
|
+
`kind: rm` 删除目标;`kind: isolate` 把目标移进 worktree 内的
|
|
1007
|
+
`.roll-cleanup/<cycle-id>/<rule>/`(随 worktree 一起被删除)。
|
|
1008
|
+
|
|
1009
|
+
支持的路径形态刻意很小:字面相对路径,例如 `.my-tmp`;以及
|
|
1010
|
+
`prefix/**/literal-suffix` 形式的递归后缀匹配,例如 `**/roll-cleanup.log`
|
|
1011
|
+
或 `src/**/__pycache__`。不会展开 shell glob;递归后缀里包含 `*`(例如
|
|
1012
|
+
`**/*.log`)会让该规则无效,记录 warning,并跳过该规则。用 `rules: []`
|
|
1013
|
+
或 `enabled: false` 可以显式关闭 cleanup。只有没有覆盖文件时才使用默认清单。
|
|
1014
|
+
|
|
900
1015
|
## 阶段计时(Cycle phases)
|
|
901
1016
|
|
|
902
1017
|
每轮 cycle 在内部切成七个命名阶段。每个阶段进入时 emit `phase_start`,
|
|
@@ -910,7 +1025,7 @@ PR 等合并)每 30–60s 还会 emit 一次 `phase_tick` 心跳,tmux 不再
|
|
|
910
1025
|
| 3 | `worktree_setup` | fetch origin + 建 worktree + 同步 meta | 2 – 10 秒 |
|
|
911
1026
|
| 4 | `agent_invoke` | 调起 agent(最多三次重试) | 5 – 45 分钟 |
|
|
912
1027
|
| 5 | `publish_push` | push 分支 + 建 PR(doc-only 直接合) | 5 – 30 秒 |
|
|
913
|
-
| 6 | `cleanup` | 落 PR 终态 + 拆 worktree | < 1 秒 |
|
|
1028
|
+
| 6 | `cleanup` | 环境清理 + 落 PR 终态 + 拆 worktree | < 1 秒 |
|
|
914
1029
|
|
|
915
1030
|
> **US-AUTO-044**:主 loop 开完 PR 即退,**不再等合并**。合并 / rebase / 关 PR 交给专职 PR Loop(`com.roll.pr.<slug>`,每 5 分钟)异步处理;有 open PR 的 story 由资格闸跳过,不会重复开,也不会假 Done。
|
|
916
1031
|
|