@operad-io/dev 0.0.1 → 0.1.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/README.md +8 -791
- package/dev.schema.json +46 -17
- package/package.json +7 -7
- package/src/actions.ts +9 -2
- package/src/chat.ts +1 -1
- package/src/gate.ts +83 -30
- package/src/index.ts +2 -1
- package/src/integrate.ts +59 -9
- package/src/integration-queue.ts +154 -16
- package/src/mainclone.ts +43 -4
- package/src/marks.ts +1 -1
- package/src/model.ts +8 -0
- package/src/notcode.ts +39 -0
- package/src/project-settings.ts +7 -0
- package/src/rerun.ts +15 -3
- package/src/schedule.ts +1 -1
- package/src/service.ts +80 -15
- package/src/settings.ts +36 -4
package/README.md
CHANGED
|
@@ -1,796 +1,13 @@
|
|
|
1
|
-
# dev
|
|
1
|
+
# @operad-io/dev
|
|
2
2
|
|
|
3
|
-
The
|
|
4
|
-
merge. It is a plugin: the kernel knows none of these words.
|
|
3
|
+
**The dev plugin: plans and tasks on a repository.** Turns a request into planned work and follows each task through work, checks, review and merge, with you at the merge.
|
|
5
4
|
|
|
6
|
-
|
|
5
|
+
This package is part of [operad](https://github.com/operad-io/operad). Most people install only [`@operad-io/cli`](https://www.npmjs.com/package/@operad-io/cli).
|
|
7
6
|
|
|
8
|
-
|
|
9
|
-
|---|---|
|
|
10
|
-
| **repo** | a git work tree with a remote that `dev` is allowed to work on; `operad repo add <path>` registers it |
|
|
11
|
-
| **plan** | one request, its tasks and how far they may run without you |
|
|
12
|
-
| **task** | one unit of work in a plan, with a brief and the tasks that must merge before it |
|
|
13
|
-
| **brief** | the Markdown a task's worker reads; a rework section is appended to it, and a trailing `## Changes` section records every edit |
|
|
14
|
-
| **rework** | another pass over a task, added as `## Rework <n> (<source>)` |
|
|
15
|
-
| **confirm** | accept a plan (its tasks then become ready) or a single proposed task |
|
|
16
|
-
| **cancel** | stop a plan and its open tasks, or one task |
|
|
17
|
-
| **pause** | stop a task for a while; **resume** undoes it |
|
|
18
|
-
| **auto** | how far a plan may run without you: off, run, merge |
|
|
19
|
-
| **priority** | P0 (most urgent) to P5 (least urgent), default P3 |
|
|
7
|
+
## Documentation
|
|
20
8
|
|
|
21
|
-
|
|
9
|
+
- User guide: [docs/user/dev.md](https://github.com/operad-io/operad/blob/main/docs/user/dev.md)
|
|
10
|
+
- Website: <https://operad.io>
|
|
11
|
+
- Developer reference: `REFERENCE.md` in this directory
|
|
22
12
|
|
|
23
|
-
|
|
24
|
-
object type, and a row names the level above it as its `parent`:
|
|
25
|
-
|
|
26
|
-
- A **repo** object exists for every repository registered with
|
|
27
|
-
`operad repo add`; its id is the repository name. It has no parent, so it is
|
|
28
|
-
a top-level object of `dev`. Its row has the name as id and title, the state
|
|
29
|
-
`active` (or `removed` after `repo remove`) and a note with the open plan and
|
|
30
|
-
open task counts. The default filter shows `active`; `--filter removed` shows
|
|
31
|
-
the removed ones. Its sections are Overview (the path, the default branch,
|
|
32
|
-
whether `.operad/dev.json` is in force, the worker and the reviewer) and the
|
|
33
|
-
kernel's History. A repo has no actions of its own: `repo add` and
|
|
34
|
-
`repo remove` stay commands. A repository registered before `repo` existed
|
|
35
|
-
is carried over the first time anything lists or reads `repo` objects, so
|
|
36
|
-
`operad list repo` works in a fresh process.
|
|
37
|
-
- A **plan**'s parent is its repo (`repo:<name>`).
|
|
38
|
-
- A **task**'s parent is its plan (`plan:<repo>/<plan id>`), so two repositories
|
|
39
|
-
that both have `P-0001-work` never share tasks.
|
|
40
|
-
|
|
41
|
-
`operad list --root` lists the top level; `operad list --parent <id>` lists the
|
|
42
|
-
next level down, with the child type's default filter (finished plans are
|
|
43
|
-
hidden and counted in `hidden`).
|
|
44
|
-
|
|
45
|
-
A plan id is `P-<4 digits>-<slug>`; a task id is `T-<4 digits>-<slug>`.
|
|
46
|
-
Numbers count up per repository and are never reused, so two repositories may
|
|
47
|
-
both have `T-0001-work`; a command accepts the bare id inside the repository it
|
|
48
|
-
names. An object made before the change keeps its `PL…` or `TK…` id: commands,
|
|
49
|
-
views and `--after` accept both forms, and an id is matched exactly.
|
|
50
|
-
|
|
51
|
-
## Commands
|
|
52
|
-
|
|
53
|
-
```
|
|
54
|
-
operad repo add <path> [--name <name>]
|
|
55
|
-
operad repo list
|
|
56
|
-
operad repo remove <name>
|
|
57
|
-
operad plan add --slug <slug> --title <title> [--concurrency <n>] [--flow <name>] [--repo <name>] # request on stdin
|
|
58
|
-
operad task add --plan <plan> --slug <slug> --title <title> [--after <task>]... [--area <area>] [--flow <name>] [--chat <id>] [--repo <name>] # brief on stdin
|
|
59
|
-
operad task edit <id> # $EDITOR on the brief body; proposed or ready only
|
|
60
|
-
operad task update <id> [--title <title>] [--after <task>]... [--area <area>] [--flow <name>] # --area "" clears it, --after "" clears the dependencies
|
|
61
|
-
operad start <task> # start one ready task now, whatever its plan's auto level
|
|
62
|
-
operad reruns # how often each test passed only on its own rerun, most frequent first
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
`--chat <id>` opens the task on the worktree of a repository chat that already has one: the task works on `work/chat-<id>` instead of making its own worktree and branch.
|
|
66
|
-
|
|
67
|
-
`task edit` takes the new brief from standard input when it is piped and not empty; otherwise it opens `$EDITOR` (or `$VISUAL`) on the brief body. For the non-interactive form, set `$EDITOR` to a command that writes the file it is given, for example `EDITOR="cp /path/brief.md" operad task edit T-0001-example`: the command receives that file as `$1`. When standard input is not a terminal, `task edit` waits one second for a piped brief before it uses the editor, so an open stdin that never delivers one cannot hang the command. A repository lock another dev command holds is named, and the command gives up after 10 seconds.
|
|
68
|
-
|
|
69
|
-
### Where a command runs, and ids
|
|
70
|
-
|
|
71
|
-
A command that looks up a plan or a task (`start`, `task edit`, `task update`,
|
|
72
|
-
`show`, every `dev:<action>`) finds its repository in this order:
|
|
73
|
-
|
|
74
|
-
1. A qualified id, `<repo>/<id>` as `operad list` prints it
|
|
75
|
-
(`operad start operad/T-0045-shell-hang-guards`), names the repository, from
|
|
76
|
-
any directory. `--repo` with a different repository is refused, naming both.
|
|
77
|
-
2. `--repo <name>`.
|
|
78
|
-
3. Inside a registered repository, a bare id means that repository's object.
|
|
79
|
-
The longest registered path that contains the directory wins.
|
|
80
|
-
4. Outside every repository, a bare id resolves when exactly one registered
|
|
81
|
-
repository has an object with that id. When several do, the error lists the
|
|
82
|
-
qualified ids to choose from.
|
|
83
|
-
|
|
84
|
-
`plan add` and `task add` create rather than look up, so they never guess from an
|
|
85
|
-
id: they use the repository of the directory or `--repo`.
|
|
86
|
-
|
|
87
|
-
When no repository applies, the error names the directory and lists the
|
|
88
|
-
registered ones, a repository whose path is gone marked `(missing)`:
|
|
89
|
-
|
|
90
|
-
```
|
|
91
|
-
no registered repository contains /Users/hai/Code/radian; run the command inside one of these, or pass --repo <name>:
|
|
92
|
-
operad ~/Code/operad
|
|
93
|
-
operad-ios ~/Code/operad-ios
|
|
94
|
-
```
|
|
95
|
-
|
|
96
|
-
With nothing registered it points at `operad repo add <path>`.
|
|
97
|
-
|
|
98
|
-
## Actions
|
|
99
|
-
|
|
100
|
-
Every action is also a command: `operad dev:<action> <id>`.
|
|
101
|
-
|
|
102
|
-
| action | object | key | what it does |
|
|
103
|
-
|---|---|---|---|
|
|
104
|
-
| `dev:chat` | repo | | open a chat about the repository in the main clone, read-only; `--agent` chooses which agent answers (`claude` or `pi`, the first loaded one when left out), and it cannot change later; `--model` and `--effort` pick from that agent's lists and can change later |
|
|
105
|
-
| `dev:confirm` | plan, task | `c` | confirm a draft plan (its tasks become ready) or a proposed task |
|
|
106
|
-
| `dev:merge` | task | | answer the task's wait with `merge`; asks first |
|
|
107
|
-
| `dev:reject` | task | | answer the task's wait with `reject` and append `## Rework <n> (owner)` with the note |
|
|
108
|
-
| `dev:rework` | task | | add the lead's own rework: `--note <text>` becomes `## Rework <n> (lead)`, and the worker runs again; history reads "you chose rework" with the note |
|
|
109
|
-
| `dev:reverify` | task | | run verify and review again on the task's current commit, with no worker |
|
|
110
|
-
| `dev:cancel` | plan, task | `x` | cancel a plan and its open tasks, or one task; asks first |
|
|
111
|
-
| `dev:pause` | task | | stop a ready, running or reviewing task for a while: the step stops as `cancel` stops it: the process that runs the step is told at once, the step's processes (the whole process group, a check command or a worker) are stopped, and any check place the step holds is given back. The task keeps its branch, worktree, commits and attempt count. It shows as paused (mark `paused`), holds no concurrency slot, and is not started; a task that follows it stays queued as for any unmerged task. Owner action, not offered through MCP; asks first |
|
|
112
|
-
| `dev:resume` | task | | undo pause: the task is ready again, and its next start is a new attempt that begins with the worktree step on the existing branch, as a rework does. Owner action, not offered through MCP; asks first |
|
|
113
|
-
| `dev:auto` | plan | | set auto: `--level off`, `--level run` or `--level merge` |
|
|
114
|
-
| `dev:priority` | plan | | set the priority: `--level P0` (most urgent) to `--level P5` |
|
|
115
|
-
| `dev:concurrency` | plan | | set how many of the plan's tasks may run at once: `--count 1` to `--count 16`; takes effect at the next tick, running tasks are not stopped |
|
|
116
|
-
|
|
117
|
-
`merge` and `reject` answer the task's person wait. They appear in `pending`
|
|
118
|
-
only while the task is waiting, and are refused with a clear message otherwise.
|
|
119
|
-
`reject` takes the required note (`--note <text>`); the note becomes a rework
|
|
120
|
-
section and the task goes back to the worktree.
|
|
121
|
-
|
|
122
|
-
`rework` and `reverify` are for the lead. They work while the task waits for a
|
|
123
|
-
person, whatever stopped it: a passed review, a gate failure, or a worker that
|
|
124
|
-
returned nothing or failed (a model rate limit, a gate killed from outside).
|
|
125
|
-
They are listed in `pending` after `merge` and `reject`.
|
|
126
|
-
|
|
127
|
-
- `rework --note <text>` appends `## Rework <n> (lead)` and sends the task to a
|
|
128
|
-
worker. It does not count toward `maxAutoRework`, and it resets the count of
|
|
129
|
-
automatic reworks in a row to 0.
|
|
130
|
-
- `reverify` merges the current `<remote>/<mainBranch>` into the task branch,
|
|
131
|
-
then re-runs verify and review on the result, with no worker, for example
|
|
132
|
-
after a flaky failure. A clean merge (or a main already contained) goes
|
|
133
|
-
straight to verify; a main that conflicts goes to the worker with the
|
|
134
|
-
conflict prompt. The history says `reverify: merged main <sha>, checking
|
|
135
|
-
again` or `reverify: main conflicts, sending to work`. The result follows the
|
|
136
|
-
normal gate path, and it does not count toward `maxAutoRework`.
|
|
137
|
-
|
|
138
|
-
Each action claims the task at the version it saw. A `merge`, `reject`, `cancel`
|
|
139
|
-
or second `rework` or `reverify` that got there first wins; the other reports
|
|
140
|
-
what happened and changes nothing.
|
|
141
|
-
|
|
142
|
-
## Flows
|
|
143
|
-
|
|
144
|
-
A repository sets its own development flows in `.operad/dev.json`. A flow is an
|
|
145
|
-
ordered list of stages; dev keeps the worktree at the start and integrate and
|
|
146
|
-
cleanup at the end, so a repository writes neither.
|
|
147
|
-
|
|
148
|
-
```json
|
|
149
|
-
{
|
|
150
|
-
"flows": {
|
|
151
|
-
"default": {
|
|
152
|
-
"stages": [
|
|
153
|
-
{ "stage": "work" },
|
|
154
|
-
{ "stage": "check" },
|
|
155
|
-
{ "stage": "review", "grading": "default" },
|
|
156
|
-
{ "stage": "human" }
|
|
157
|
-
]
|
|
158
|
-
},
|
|
159
|
-
"quick": {
|
|
160
|
-
"stages": [
|
|
161
|
-
{ "stage": "work" },
|
|
162
|
-
{ "stage": "check", "commands": ["bun test"] },
|
|
163
|
-
{ "stage": "human" }
|
|
164
|
-
]
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
```
|
|
169
|
-
|
|
170
|
-
A repository that writes no `flows` runs the built-in `default` flow: work,
|
|
171
|
-
check, review, human. A flow named `default` is the one a task starts with; a
|
|
172
|
-
plan or task may choose another with `--flow <name>`, and once a task's first
|
|
173
|
-
attempt starts it keeps that flow (`task update --flow` refuses after it). A task
|
|
174
|
-
without `--flow` takes its plan's flow, and a plan without one takes `default`. A task whose
|
|
175
|
-
flow dev.json does not define stays ready, and its row and its plan's row say `flow <name>
|
|
176
|
-
is not defined in .operad/dev.json`. When a repository defines more than one flow, the task
|
|
177
|
-
row and the Brief name the task's flow, and history names it on each run start. Every flow needs at least one `check`,
|
|
178
|
-
`review` or `human` stage. A `human` stage asks a person; when it is the last
|
|
179
|
-
stage, its merge answer goes to integrate, and when it is not, that answer
|
|
180
|
-
continues with the next stage. A flow whose last stage is not `human` goes
|
|
181
|
-
straight to integrate after that stage passes, so its plan's auto level has no
|
|
182
|
-
human wait to answer. A flow with no gate makes dev.json invalid, with a message
|
|
183
|
-
naming the flow and the rule.
|
|
184
|
-
|
|
185
|
-
### Stages
|
|
186
|
-
|
|
187
|
-
| stage | parameters | what it does | results |
|
|
188
|
-
|---|---|---|---|
|
|
189
|
-
| `work` | `use`, `args`, `brief`, `beforeAttempt` | a worker changes the task branch; `use` and `args` replace the harness step and its arguments, `brief` is appended to the worker's prompt, and `beforeAttempt` is the preparation before the attempt: `merge-main` fetches and merges the latest main, `none` leaves the branch as it is | `done`, `nothing`, `failed`, `unavailable`, `cancelled`, `interrupted` |
|
|
190
|
-
| `check` | `commands`, `rerun` | runs the commands in a gate checkout of the verified commit; unset values come from `gate.commands` and `check.rerun` | `pass`, `fail`, `cancelled` |
|
|
191
|
-
| `review` | `use`, `args`, `later`, `grading` | a reviewer reads the diff from the merge base to the verified commit; unset values come from `reviewer`, `later` replaces the arguments of every review round after the first of a task, and `grading` names the entry in `.operad/review.json` (unset means the flow's own name) | `pass`, `fail`, `failed`, `unavailable`, `timed_out`, `exhausted`, `out_of_time`, `cancelled` |
|
|
192
|
-
| `human` | none | waits for a person to merge, reject, rework or reverify | the person's choice |
|
|
193
|
-
|
|
194
|
-
A failed `check` or `review` appends its rework section and goes back to the
|
|
195
|
-
nearest `work` stage before it. With no `work` before it, the run waits for a
|
|
196
|
-
person instead. The retry steps, the unavailable-model waits, the review
|
|
197
|
-
timeout waits, cancellation and the announcements are the ones the built-in
|
|
198
|
-
flow has, one set per stage.
|
|
199
|
-
|
|
200
|
-
A work stage passes its harness override as the step params `flowUse`,
|
|
201
|
-
`flowArgs` and `flowBrief`; a check stage passes `commands` and `rerun`, and a
|
|
202
|
-
review stage passes `use`, `args`, `later` and `grading`. A hand-written flow
|
|
203
|
-
passes the same names to `dev/work`, `dev/verify` and `dev/review`.
|
|
204
|
-
|
|
205
|
-
### How a flow is registered
|
|
206
|
-
|
|
207
|
-
The built-in flow keeps the name `dev`, so runs and history from before
|
|
208
|
-
projects could set flows keep working. A repository's flow is registered under
|
|
209
|
-
`dev/<repository>/<flow>/<hash>`, where the hash is the first 12 hex digits of
|
|
210
|
-
the SHA-1 of its stages. Two repositories may therefore use the same flow name,
|
|
211
|
-
and a changed `flows` entry gets a new name instead of replacing a graph a
|
|
212
|
-
running attempt still uses. A start records the graph on the task; every tick
|
|
213
|
-
declares the graphs of the tasks it finds, and a declared graph is kept in the
|
|
214
|
-
store so the run's own process finds it, so a fresh process resumes a running
|
|
215
|
-
attempt on the graph it started with.
|
|
216
|
-
|
|
217
|
-
### Writing a flow in TypeScript
|
|
218
|
-
|
|
219
|
-
The compiled stages are the building blocks for `.operad/flows/<name>.flow.ts`:
|
|
220
|
-
a hand-written flow calls the same plugin steps. `dev/worktree`,
|
|
221
|
-
`dev/reverify`, `dev/work`, `dev/verify`, `dev/review`, `dev/rework`,
|
|
222
|
-
`dev/integrate` and `dev/cleanup` are described in the Steps table below;
|
|
223
|
-
`dev/retry`, `dev/review_due`, `dev/work_due` and `dev/retry_due` are the waits
|
|
224
|
-
and retries around them, and `dev/announce` tells the outside world that a run
|
|
225
|
-
stopped. A hand-written flow keeps the same hard rules: integrate and cleanup
|
|
226
|
-
last, and at least one gate.
|
|
227
|
-
|
|
228
|
-
dev loads each `.operad/flows/<name>.flow.ts` whose default export is a
|
|
229
|
-
`defineFlow` value as a flow named `<name>`, and a plan or task chooses it with
|
|
230
|
-
`--flow <name>`. It refuses the file, with the reason, when a step other than
|
|
231
|
-
integrate (or the cleanup right after it) leads to the end, when there is no
|
|
232
|
-
integrate step, when there is no check, review or human step, or when
|
|
233
|
-
`dev.json` also defines `<name>`. A refused name starts no task.
|
|
234
|
-
|
|
235
|
-
## Steps
|
|
236
|
-
|
|
237
|
-
| step | results | what it does |
|
|
238
|
-
|---|---|---|
|
|
239
|
-
| `dev/worktree` | `ready`, `conflict`, `blocked`, `failed` | fetches, creates `worktreeRoot/<task id>` on `work/<task id>` from `<remote>/<mainBranch>`, and on a later attempt reuses it after merging the latest main; a start that carries a `blockedBy` dependency records the person wait instead |
|
|
240
|
-
| `dev/reverify` | `ready`, `conflict`, `failed` | the first step of a reverify: fetches and merges the current main into the task branch in the existing worktree, keeping the attempt; `ready` goes to verify, `conflict` to the worker |
|
|
241
|
-
| `dev/work` | `done`, `nothing`, `failed` | builds the worker prompt, runs the configured harness step in the worktree, then requires new commits, a clean tree and a pushed branch |
|
|
242
|
-
| `dev/verify` | `pass`, `fail`, `not_code` | recreates `<worktreeRoot>/<task id>-gate` detached at the branch head, runs `gate.commands` through `shell/check`, and records the verified commit. A check result that says nothing about the code (see Checks that are not the code) does not go to the worker: verify waits for a quiet machine, runs the check once more, and a second such result ends `not_code`, which waits for a person |
|
|
243
|
-
| `dev/review` | `pass`, `fail`, `failed`, `unavailable`, `timed_out` | runs the reviewer harness step in the gate worktree on the diff from the merge base to the verified commit; the previous review is the newest report for another commit (see Rework rounds); in a rework round a finding far from the task's own change and from the previous review's findings is moved out of the failing set as pre-existing, while a critical one or one without a place still fails |
|
|
244
|
-
| `dev/review_due` | `ready`, `interrupted` | the wait a review enters after a model was unavailable; it lets the flow run the same review round again at the recorded time |
|
|
245
|
-
| `dev/retry` | `again`, `hold`, `ask`, `give_up`, `cancelled` | runs in front of the announcement of a work, worktree or reverify step that stopped. A stop that is not the task's own work (the run stopped, a process killed by a signal nobody sent, a step that is not loaded, settings that cannot be read) runs the step once more in the same attempt, without a person and without counting toward `maxAutoRework`; a work step that ended on a dropped connection to the harness or the model (the socket closed, a reset) is the same kind of stop, with the cause `model connection dropped during work`. A second stop, or a wait that ran out, goes to a person and the waiting line names the cause (for example `pool/agent is not loaded`) |
|
|
246
|
-
| `dev/retry_due` | `ready`, `waiting`, `interrupted` | the wait a retry enters while a step is not loaded or the settings cannot be read; it ends when they are there, or after `retry.environmentWaitMinutes` (default 60) |
|
|
247
|
-
| `dev/rework` | `again`, `ask` | appends `## Rework <n> (verify|review)` with the failed command or the counted findings and sends the task back to the worker; after `maxAutoRework` in a row, or when a review failure follows a review failure (whatever the findings; a verify failure or a conflict between them resets this), it asks a person instead, with the reason `review failed twice in a row` and both rounds' findings in the section |
|
|
248
|
-
| `dev/integrate` | `merged`, `conflict`, `fail`, `failed` | fetches, builds the candidate in the gate worktree by merging the verified commit onto `<remote>/<mainBranch>`, runs `integration.keyCommands` through `shell/check`, and pushes plainly; a moved main starts again from the fetch, at most three times. Tasks of one repository integrate one at a time: a task whose merge was chosen waits for its turn first (see below) |
|
|
249
|
-
| `dev/cleanup` | `done` | runs `hooks.afterMerge` with `OPERAD_TASK`, `OPERAD_WORKTREE` and `OPERAD_REMOTE` set; a failing hook is recorded, not a task failure |
|
|
250
|
-
|
|
251
|
-
A conflict appends `## Rework <n> (conflict with main)` and sends the task back
|
|
252
|
-
to the worktree. A failing key command appends `## Rework <n> (integration)`.
|
|
253
|
-
The verified commit is merged even when the branch has moved past it, and the
|
|
254
|
-
step records that the head moved. A remote that refuses the push is `failed`
|
|
255
|
-
with git's message. Integrate is replay-safe: after a push it checks that the
|
|
256
|
-
remote's main contains the candidate instead of pushing again. Cleanup is also
|
|
257
|
-
replay-safe; the default hooks remove both worktrees and the local and remote
|
|
258
|
-
`work/<task id>` branch.
|
|
259
|
-
|
|
260
|
-
A merge updates the main clone when it can. After the push, integrate
|
|
261
|
-
fast-forwards the repository's own checkout (the one `operad serve` and every
|
|
262
|
-
run execute) to the merged commit, but only when that checkout is on
|
|
263
|
-
`<mainBranch>` and has no uncommitted changes to tracked files. Otherwise it
|
|
264
|
-
leaves the checkout alone and says why in the step data (`mainClone`) and in
|
|
265
|
-
the task's Changes ("main clone not updated: uncommitted changes"). It only
|
|
266
|
-
fast-forwards through git: no reset, rebase or stash. When the
|
|
267
|
-
clone moved it then runs the `prepare` lines there, in order, the way it runs
|
|
268
|
-
them in a checkout it makes, and reports a failing line (its text and the last
|
|
269
|
-
line of its output) the same way; the fast-forward stays. A running serve keeps the code it loaded until it is
|
|
270
|
-
restarted; new runs use the new code.
|
|
271
|
-
|
|
272
|
-
A conflict leaves the worktree mid-merge. The next `dev/work` prompt starts by
|
|
273
|
-
asking the worker to resolve it. A failed attempt names the uncommitted files.
|
|
274
|
-
The task records its attempt count, phase, session id and cost while these steps
|
|
275
|
-
run.
|
|
276
|
-
|
|
277
|
-
### What a step cleans up
|
|
278
|
-
|
|
279
|
-
Every process a step starts (the worker's harness, the reviewer's harness, a
|
|
280
|
-
check) carries `OPERAD_RUN=<run id>:<step>` in its environment, with
|
|
281
|
-
`OPERAD_RUN_HOME` naming the home so two homes never meet. Children inherit it
|
|
282
|
-
whatever process group or session they move to, which a command a worker runs
|
|
283
|
-
can do: the Bash tool of a coding agent starts each command in a process group
|
|
284
|
-
of its own, so a loop it leaves in the background is outside the group the
|
|
285
|
-
harness stops.
|
|
286
|
-
|
|
287
|
-
When a step ends, however it ends (done, nothing, failed, timeout, cancelled),
|
|
288
|
-
the platform finds every live process of the same user that still carries the
|
|
289
|
-
step's marker and stops it: TERM, a short wait, KILL. The step log says how many
|
|
290
|
-
and which commands, one line each, cut to 120 characters. `operad serve` does the
|
|
291
|
-
same at start for the markers of runs that are no longer active, which a serve
|
|
292
|
-
that died left behind, and says so once in the serve log.
|
|
293
|
-
|
|
294
|
-
The environment alone is not enough on macOS: the system withholds the
|
|
295
|
-
environment of Apple's own binaries (`/bin/sh`, `/bin/bash`, `/bin/zsh`), so a
|
|
296
|
-
shell loop a command leaves behind carries the marker without showing it. The
|
|
297
|
-
platform therefore also follows the processes themselves. While a step runs, a
|
|
298
|
-
kernel watch (kqueue, reached with `bun:ffi`) reports every fork of a process
|
|
299
|
-
below the ones the step started, and each fork is answered at once with a look
|
|
300
|
-
at that process's children. The kernel keeps the reports until they are read,
|
|
301
|
-
and they are read every 2 ms, so a shell that ends right after it started its
|
|
302
|
-
loops is still seen while it lives. A table read with `ps` every 200 ms backs
|
|
303
|
-
this up (and is all there is where the watch is not available). What was seen is
|
|
304
|
-
remembered by pid and start time. A command's shell leads a process group of its
|
|
305
|
-
own, and what it left behind keeps that group id, so a later member of the group
|
|
306
|
-
is stopped too, if it started while the leader lived: a process that was given
|
|
307
|
-
the leader's pid after the leader was gone started later and is left alone. At
|
|
308
|
-
the end of the step the sweep stops all of these and the parent of every marked
|
|
309
|
-
process, so a shell loop that starts one program after another is stopped before
|
|
310
|
-
it starts the next, and it looks again up to three times for what a stopped
|
|
311
|
-
process started.
|
|
312
|
-
|
|
313
|
-
Limits. A process that removes `OPERAD_RUN` from its own environment is not
|
|
314
|
-
found by the marker, and the sweep does not chase it. On macOS a system shell
|
|
315
|
-
loop is found through the watch, not the marker, so one that leaves its parent
|
|
316
|
-
and its process group before the watch has looked at it (a `setsid` or a
|
|
317
|
-
double fork) is not found, and neither is a loop whose parent ends within a few
|
|
318
|
-
milliseconds of starting it, before the watch has looked at the parent. On Linux the environment
|
|
319
|
-
is read from `/proc/<pid>/environ` and shows every process.
|
|
320
|
-
|
|
321
|
-
## Scheduling
|
|
322
|
-
|
|
323
|
-
On every tick of the kernel loop, `dev` starts ready tasks whose dependencies
|
|
324
|
-
have merged. A task starts only while its plan is at auto `run` or `merge`, the
|
|
325
|
-
plan's running count is under its `concurrency`, and the repository's running
|
|
326
|
-
count is under its `concurrency` setting. Plans are considered most urgent
|
|
327
|
-
first; within one priority they take turns (the plan that started a task least
|
|
328
|
-
recently goes first). When the repository has more than one slot, one slot
|
|
329
|
-
is kept for the plan that has gone longest without starting a task: while no
|
|
330
|
-
running task holds it, the last free slot goes to that plan, whatever its
|
|
331
|
-
priority. Every other freed slot goes by priority. So a plan with a startable
|
|
332
|
-
task never waits forever behind more urgent plans. With one slot, priority
|
|
333
|
-
alone orders the queue. Each registered repository is scheduled on its own. A
|
|
334
|
-
task the scheduler claimed but whose run never recorded itself (a crash between
|
|
335
|
-
the two) returns to `ready` on the next tick, so the scheduler can start it
|
|
336
|
-
again.
|
|
337
|
-
|
|
338
|
-
At auto `merge`, a waiting task whose review passed in this attempt is answered
|
|
339
|
-
with `merge`. A wait that follows `nothing`, `failed`, the rework limit or `review failed twice in a row` is
|
|
340
|
-
never answered. A task whose dependency was cancelled waits for a person
|
|
341
|
-
instead of starting, and a plan whose tasks have all merged or been cancelled
|
|
342
|
-
is reported finished once. Every change prints one line:
|
|
343
|
-
`T-0003-kernel ready -> running`.
|
|
344
|
-
|
|
345
|
-
`operad start <task>` asks the scheduler to start one ready task on its next
|
|
346
|
-
tick, whatever its plan's auto level is. The task's dependencies and both
|
|
347
|
-
concurrency limits still hold, so an ineligible task waits for a later tick.
|
|
348
|
-
|
|
349
|
-
`operad task update <id> --after ...` also works on a task that waits because a
|
|
350
|
-
dependency was cancelled: changing its dependencies, or clearing them with
|
|
351
|
-
`--after ""`, ends that wait (its run is stopped), and the task starts on a later
|
|
352
|
-
tick like any ready task.
|
|
353
|
-
|
|
354
|
-
`--after` takes a task id (a task of this repository, in any plan) or
|
|
355
|
-
`<repository>/<task id>` (a task of any registered repository). Either way the
|
|
356
|
-
full key is stored. A task is `blocked` until every task it follows is merged,
|
|
357
|
-
wherever it is; its note says `waiting for operad/T-0188` when the task is in
|
|
358
|
-
another repository. A task must exist when it is named; a task cannot follow
|
|
359
|
-
itself or close a cycle (the refusal shows the cycle). A cancelled dependency,
|
|
360
|
-
in any plan or repository, makes the task wait for a person as above.
|
|
361
|
-
|
|
362
|
-
A task whose dependency was cancelled starts no work. The scheduler starts its
|
|
363
|
-
flow into the person wait instead, so the task is a real pending item: `merge`
|
|
364
|
-
and `reject` answer it like any other wait, and `cancel` stops the run. The task
|
|
365
|
-
is counted as waiting, not running, so it does not hold a concurrency slot.
|
|
366
|
-
|
|
367
|
-
### Areas
|
|
368
|
-
|
|
369
|
-
A task may name an `area`, a short one-line string of at most 64 characters
|
|
370
|
-
such as `engine-core`. The scheduler never runs two tasks with the same area in
|
|
371
|
-
the same repository at once, whatever the concurrency; a task with no area is
|
|
372
|
-
not limited, and the same area name in two repositories does not block.
|
|
373
|
-
|
|
374
|
-
| | |
|
|
375
|
-
|---|---|
|
|
376
|
-
| type | string, default none |
|
|
377
|
-
| set | `operad task add --area <area>`, `operad task update <id> --area <area>` (`--area ""` clears it) |
|
|
378
|
-
| effect | a ready task whose area is held by a running or reviewing task is not started; it starts on a later tick once that task leaves those phases (it merges, is cancelled, or waits for a person) |
|
|
379
|
-
| when | the area is read on every tick, so a change made while the task is `proposed` or `ready` applies from the next tick |
|
|
380
|
-
|
|
381
|
-
`operad show <task>` prints the area, and `operad list task` shows `area: <a>`.
|
|
382
|
-
A ready task held back by its area shows `waiting for area <a> (<task>)`, naming
|
|
383
|
-
the task that holds it; when ready tasks of the area are queued before it, the
|
|
384
|
-
note ends `, <n> ahead`. A task waiting for a person does not hold its area, the
|
|
385
|
-
same way it holds no concurrency slot.
|
|
386
|
-
|
|
387
|
-
The check and the start are one decision: the scheduler claims a task under the
|
|
388
|
-
repository lock and reads the stored tasks inside that lock, so two ticks or two
|
|
389
|
-
`operad` processes cannot both start a task of one area.
|
|
390
|
-
|
|
391
|
-
## Flow
|
|
392
|
-
|
|
393
|
-
`dev` is the coding flow: worktree → work → verify → review → a person decides
|
|
394
|
-
`merge`, `reject` or `reverify` (the last merges the current main into the branch, then runs verify and
|
|
395
|
-
review again on it with no worker). A task whose dependency was cancelled enters the same
|
|
396
|
-
person wait directly from the worktree step. A failing verify or review goes to
|
|
397
|
-
`rework`, which sends the task back to the worktree until `maxAutoRework`
|
|
398
|
-
automatic reworks have run in a row, or a second review failure in a row; then it waits for a person (`review failed twice in a row`), and the lead's `rework --note` or `reject` steers the next pass. `reverify` at that wait keeps the count, so a review failure on the reverified head waits again at once; a passed review or a merge conflict clears it. `nothing` and
|
|
399
|
-
`failed` from `work` also wait for a person. An unavailable reviewer waits for
|
|
400
|
-
`reviewer.retrySecs` and runs the same review again; a review that times out
|
|
401
|
-
twice waits for a person. `merge` builds the candidate on main and pushes it,
|
|
402
|
-
then cleanup removes the worktrees and branches. A plan is finished when every
|
|
403
|
-
task is merged or cancelled.
|
|
404
|
-
|
|
405
|
-
## Checks that are not the code
|
|
406
|
-
|
|
407
|
-
A check result says nothing about the code when any of these holds (the rules
|
|
408
|
-
are one function, `classifyCheck` in `src/notcode.ts`):
|
|
409
|
-
|
|
410
|
-
- the command was stopped at the gate's time limit (`gate.commandTimeoutSecs`);
|
|
411
|
-
- the command ended by a signal nobody in the task sent: the shell step's
|
|
412
|
-
`signal` reason, or an exit status of 128+n (129 to 192);
|
|
413
|
-
- every failed test failed at the test timeout (the `--timeout` of the failing
|
|
414
|
-
command line, else 30 s), or later, within 5% below it, so it timed out and
|
|
415
|
-
did not assert; one quicker failure, or no failed test line, is not this;
|
|
416
|
-
- every test that failed in the first run passed on its rerun (the check then
|
|
417
|
-
passes; the kind only feeds the flaky-test rule below).
|
|
418
|
-
|
|
419
|
-
For the first three, dev does not send the task to the worker. It waits until
|
|
420
|
-
the machine's 1-minute load average (the one `running` reports) is below
|
|
421
|
-
`check.loadLimit` (default: the number of cores), then runs the check once more
|
|
422
|
-
by itself. A pass or an assertion failure on that run stands and goes the usual
|
|
423
|
-
way. A second result of the same kind ends with the task waiting for a person,
|
|
424
|
-
and the waiting line says why, for example `check timed out twice under load 18
|
|
425
|
-
on 10 cores`. An integration check that ends this way waits for a person the
|
|
426
|
-
same way and does not send the task back to work; in a batch, the other tasks
|
|
427
|
-
integrate alone. A real assertion failure goes to the worker as before.
|
|
428
|
-
|
|
429
|
-
A test that fails and then passes on rerun is still a bug until shown
|
|
430
|
-
otherwise, but only for a run on an idle machine. The check reads the load when
|
|
431
|
-
its command starts and when it ends; if either reading is above
|
|
432
|
-
`check.flakyLoadLimit` (default: twice the number of cores), the failure was
|
|
433
|
-
seen under load. It is recorded with the load (`operad reruns` still counts it)
|
|
434
|
-
and counts toward no task; the check log and the task's history say that it was
|
|
435
|
-
skipped, with the load and the core count. Below the limit, dev proposes the
|
|
436
|
-
task as `check.flakyTask` says.
|
|
437
|
-
|
|
438
|
-
## Review fallback and retry
|
|
439
|
-
|
|
440
|
-
One review round is keyed by the attempt and the review number. It ends once,
|
|
441
|
-
with `passed`, `findings`, `unavailable` or `timed_out`. A fallback or a retry
|
|
442
|
-
is another run of the same round: the attempt and the rework count do not
|
|
443
|
-
change, and no worker starts.
|
|
444
|
-
|
|
445
|
-
The reviewer is unavailable when the harness reports a model error of kind
|
|
446
|
-
`unavailable` or `usage_limit` (the radian harness passes the `Result` record's
|
|
447
|
-
`model_error` through as `modelError`). When a harness reports none, the last
|
|
448
|
-
lines of its error output count only if one reads `HTTP 429`, `status 429` or
|
|
449
|
-
`too many requests`; a `429` elsewhere in the data (a line number, a duration)
|
|
450
|
-
does not. The same round runs once on `reviewer.fallback` at once. If the
|
|
451
|
-
repository sets no fallback, or the fallback is unavailable too, the task waits
|
|
452
|
-
with `retryAt` set to `now + reviewer.retrySecs` and does not rework. When the
|
|
453
|
-
time comes, `dev/review_due` lets the flow run the review again, with no new
|
|
454
|
-
attempt and no other step. A round uses its fallback at most once: a retry that
|
|
455
|
-
finds the primary unavailable again waits instead of trying the fallback a
|
|
456
|
-
second time. A wait longer than one step run is split into pieces below the
|
|
457
|
-
three-hour step timeout, so any positive `reviewer.retrySecs` is waited out and
|
|
458
|
-
the review runs a model again only at `retryAt`.
|
|
459
|
-
|
|
460
|
-
The waits are bounded. A round waits at most 6 times (`MAX_REVIEW_WAITS`); the first wait is
|
|
461
|
-
`reviewer.retrySecs` and each further wait doubles, up to 30 minutes (2, 4, 8, 16,
|
|
462
|
-
30, 30 minutes at the default: about 90); the count is the number of primary runs
|
|
463
|
-
of the round recorded as unavailable in the task, so a crash and a restart agree
|
|
464
|
-
on it. The next unavailable run waits for a person with the note `review did not
|
|
465
|
-
finish (model unavailable)`. The dev flow's visit limit is finite (10 plus one
|
|
466
|
-
visit of each wait step per allowed work wait). One review step also has to end
|
|
467
|
-
before its three-hour step timeout: a run that cannot fit in what is left is
|
|
468
|
-
skipped, and the round waits for a person with the note `review did not finish
|
|
469
|
-
(out of time)`. While a review waits for its model, `merge`, `reject`, `rework`
|
|
470
|
-
and `reverify` are not offered.
|
|
471
|
-
|
|
472
|
-
Each reviewer call writes its report inside the gate worktree, because some
|
|
473
|
-
agents cannot write elsewhere: `.operad/review/<run>-attempt-<n>-review-<round>-try-<k>.json`,
|
|
474
|
-
where `k` is the number of calls before it in the round, so every call has a
|
|
475
|
-
path of its own and a stale report is never read. The prompt names that path.
|
|
476
|
-
Before the call dev creates `.operad` and `.operad/review` if missing, looking
|
|
477
|
-
at each component with `lstat`; if either is not a plain directory (a link, a
|
|
478
|
-
file) or a file already exists at the report path, the review fails naming the
|
|
479
|
-
path and nothing is written. After the call dev reads the report only if it is
|
|
480
|
-
a regular file, validates it, and writes a copy to
|
|
481
|
-
`<store>/dev/reviews/<run>/<task>-attempt-<n>-review-<round>.json`, which is the
|
|
482
|
-
record the history and views point at; a failed copy fails the step and leaves
|
|
483
|
-
the workspace file. **dev never removes, truncates or overwrites anything under
|
|
484
|
-
the gate worktree's `.operad`**; the worktree is disposable and its next
|
|
485
|
-
recreation removes the reports. Nothing is committed from the gate worktree
|
|
486
|
-
(the integrate step recreates it first and only commits a squash or merge of
|
|
487
|
-
the index), so the reports cannot reach a commit.
|
|
488
|
-
|
|
489
|
-
How a call is named, in this order: a valid report is used whatever the harness
|
|
490
|
-
result; a file that fails validation is `wrote an invalid report`; with no file,
|
|
491
|
-
a timeout is `timed_out` and an unavailable model is `unavailable` (they drive
|
|
492
|
-
retry and fallback), and anything else is `could not write the report` with the
|
|
493
|
-
reviewer's last message. The review folders are checked (plain directories, same
|
|
494
|
-
device and inode) before and after the report is read, and a missing folder, a
|
|
495
|
-
link or a mismatch fails the round. A run resumed from before this
|
|
496
|
-
change reads the store path too when the workspace path has no file. A crash
|
|
497
|
-
after the report was written and before the copy is recovered by copying the
|
|
498
|
-
report from the old worktree before it is replaced, not by asking again.
|
|
499
|
-
|
|
500
|
-
A reviewer that wrote a valid report and then stalled, timed out or exited
|
|
501
|
-
non-zero has reviewed: its report is used and a retry never deletes it. `dev:reverify` starts review round 1
|
|
502
|
-
again with no runs from the old round.
|
|
503
|
-
|
|
504
|
-
A review that times out runs once more with the same arguments. A second
|
|
505
|
-
timeout waits for a person with the note `review timed out twice`. Neither an
|
|
506
|
-
unavailable reviewer nor a timeout counts toward `maxAutoRework`: only a review
|
|
507
|
-
that returns findings at or above `reviewer.fixLevel` does.
|
|
508
|
-
|
|
509
|
-
### Follow-ups
|
|
510
|
-
|
|
511
|
-
Findings that did not fail a review are not lost. When a task merges and any
|
|
512
|
-
review round of it had such a finding, dev marks the task. When a plan has no
|
|
513
|
-
ready, running, review or waiting task, dev collects every such finding of
|
|
514
|
-
every round of the plan's marked tasks (oldest first; within one task, a
|
|
515
|
-
finding with the same `file:line` and text, whitespace collapsed, is kept once) and proposes one task, `<plan slug>-followups` (then
|
|
516
|
-
`-2`, `-3` when the slug is taken), titled `Follow-ups from <plan id>'s
|
|
517
|
-
reviews`, that follows the collected tasks. Its brief lists each finding as
|
|
518
|
-
`[level] path:line summary (round n)` under a `From T-xxxx` heading per task, and tells
|
|
519
|
-
the worker to fix what still applies and say which findings no longer apply.
|
|
520
|
-
A task is collected once, even when its follow-up is cancelled; a follow-up's
|
|
521
|
-
own findings are never collected; tasks merged before this existed carry no
|
|
522
|
-
mark. `reviewer.followups: false` turns it off.
|
|
523
|
-
|
|
524
|
-
### Grading: `.operad/review.json`
|
|
525
|
-
|
|
526
|
-
What critical, major and minor mean is a project setting, not text in the
|
|
527
|
-
plugin. A repository may keep `.operad/review.json` (schema:
|
|
528
|
-
`packages/review-grading/review.schema.json`; the reader is the
|
|
529
|
-
`@operad-io/review-grading` package, whose README describes every field):
|
|
530
|
-
|
|
531
|
-
```json
|
|
532
|
-
{ "flows": { "dev": { "levels": { "critical": "…", "major": "…", "minor": "…" },
|
|
533
|
-
"rules": ["…"], "fixLevel": "major" } },
|
|
534
|
-
"default": { "…": "…" } }
|
|
535
|
-
```
|
|
536
|
-
|
|
537
|
-
The review prompt gets a `## Grading` section with the `dev` flow's levels and
|
|
538
|
-
rules, word for word; `dev` adds no grading words of its own, and a repository
|
|
539
|
-
with no file gets no section. An entry for the flow falls back field by field
|
|
540
|
-
to `default`.
|
|
541
|
-
|
|
542
|
-
`fixLevel` in `review.json`, when set, wins over `reviewer.fixLevel` in
|
|
543
|
-
`dev.json`, for the review and for the rework that follows it. `reviewer.fixLevel`
|
|
544
|
-
keeps working when `review.json` sets none. An invalid `review.json` fails the
|
|
545
|
-
review step with a message naming `review.json` and what is wrong, as an invalid
|
|
546
|
-
`dev.json` does.
|
|
547
|
-
|
|
548
|
-
The task's history names the model that reviewed each round and why a fallback
|
|
549
|
-
or a retry happened.
|
|
550
|
-
|
|
551
|
-
### Crash table
|
|
552
|
-
|
|
553
|
-
A review round writes the run it is about to make to the task, and each
|
|
554
|
-
reviewer call writes its outcome beside the report before it returns. A crash
|
|
555
|
-
therefore resumes the same round and reuses the answer instead of asking the
|
|
556
|
-
same model again.
|
|
557
|
-
|
|
558
|
-
| crash point | what is recorded | the resumed round does | test |
|
|
559
|
-
|---|---|---|---|
|
|
560
|
-
| after the first run's result | the pending primary run and its outcome | reads the outcome back; never asks the first model again | `dev/review crash recovery > a crash after the first result reuses it instead of asking again` |
|
|
561
|
-
| after an unavailable first result | the pending primary run and its `unavailable` outcome | runs the fallback once; never repeats the primary | `dev/review crash recovery > a crash after an unavailable first result resumes on the fallback` |
|
|
562
|
-
| during the fallback | the primary run, and the fallback as pending with its outcome | reads the fallback outcome back; no model runs again | `dev/review crash recovery > a crash during the fallback reads its result back` |
|
|
563
|
-
| after the first run was saved | the primary run in the round | runs the fallback once | `dev/review crash recovery > a crash after the first run was saved resumes on the fallback` |
|
|
564
|
-
|
|
565
|
-
## Rework rounds
|
|
566
|
-
|
|
567
|
-
One rule says which review is which:
|
|
568
|
-
|
|
569
|
-
- The **previous review** is the newest review report of the task, in any
|
|
570
|
-
attempt, for a commit other than the one now reviewed. When there is none, or
|
|
571
|
-
its commit is not in the checkout, the review gets the first-review prompt
|
|
572
|
-
(brief and full diff).
|
|
573
|
-
- With a previous review, the prompt is the rework-round prompt: the brief, the
|
|
574
|
-
previous review's blocking findings (level, `file:line`, summary), the commits
|
|
575
|
-
`<previous sha>..<sha>` and the increment, not the full diff. It asks the
|
|
576
|
-
reviewer to say, in `verified`, which previous findings are fixed and which are
|
|
577
|
-
not, to review the increment, and to list every problem it finds. The reviewer
|
|
578
|
-
can still read any file.
|
|
579
|
-
- A reverify of an unchanged head finds the newest report is for the same
|
|
580
|
-
commit, skips it and follows the one before it, if any. A reverify after main
|
|
581
|
-
moved is a review of a new commit and follows the newest report.
|
|
582
|
-
- Which findings move as pre-existing depends on the review. A **first review**
|
|
583
|
-
moves nothing: a finding in a file the task's change does not touch may be a
|
|
584
|
-
defect the change causes, so it fails the review like any other. A **reverify
|
|
585
|
-
of the same commit** gets the first prompt and moves nothing. A **rework round** applies the line rules below.
|
|
586
|
-
In every review a critical finding, and one without a file or a line, stays.
|
|
587
|
-
|
|
588
|
-
The **increment** is built like `git range-diff`: take the task's own diff at the
|
|
589
|
-
previous review (the merge base recorded then, or the merge base of the remote
|
|
590
|
-
main and the previous commit, to the previous commit) and the task's own diff
|
|
591
|
-
now. A hunk of the current diff is in the increment when its `-`/`+` lines,
|
|
592
|
-
ignoring line numbers and context, are not in the previous diff of that file. A
|
|
593
|
-
hunk of the previous diff that is gone or changed is listed as "Removed since the
|
|
594
|
-
previous review" with its old content. Both sides are the task's own diff, so a
|
|
595
|
-
line that only came with a merge of main is on neither side.
|
|
596
|
-
|
|
597
|
-
In a rework round, dev, not the model, moves a failing finding out of the failing set and marks it
|
|
598
|
-
`pre_existing` unless (a) its `file:line` is within 3 lines of a line the task's
|
|
599
|
-
own change added or changed in that file, (b) it is in the same file as and
|
|
600
|
-
within 10 lines of a blocking finding of the previous review, (c) its level is `critical`, or (d) it has no file or no line. A
|
|
601
|
-
moved finding keeps its level, and a `pre_existing` mark the reviewer wrote is
|
|
602
|
-
ignored. The grading in `.operad/review.json` applies first. The review's data
|
|
603
|
-
records `moved`, and history and Changes say "rework round: n previous findings,
|
|
604
|
-
m fixed, k moved as pre-existing"; a previous finding counts as fixed when no
|
|
605
|
-
blocking finding of this review is in the same file within 10 lines of it. A
|
|
606
|
-
review that crashed before its model answered asks again with the prompt it
|
|
607
|
-
recorded.
|
|
608
|
-
|
|
609
|
-
## Review diff size
|
|
610
|
-
|
|
611
|
-
Before building the review prompt, the step leaves out files marked
|
|
612
|
-
`linguist-vendored`, `linguist-generated`, `-diff` or `binary` in
|
|
613
|
-
`.gitattributes`, and every file whose own diff is over `maxFileDiffBytes`. Each
|
|
614
|
-
left-out file is listed with its added/removed line counts and the reason. If
|
|
615
|
-
the remaining diff is over `maxDiffBytes`, no reviewer starts and the step fails
|
|
616
|
-
with the size and the largest files, so a person sees why.
|
|
617
|
-
|
|
618
|
-
The diff is built with rename detection, and `maxDiffBytes` and
|
|
619
|
-
`maxFileDiffBytes` count what the prompt carries, not the raw change:
|
|
620
|
-
|
|
621
|
-
- A renamed file with no edit is one line, `renamed <old> → <new>, unchanged`.
|
|
622
|
-
A renamed file with edits carries only the edits.
|
|
623
|
-
- A deleted file is one line, `<path>: deleted, <n> lines`, with the command that
|
|
624
|
-
reads it (`git show <base>:<path>`); its removed lines are not in the prompt.
|
|
625
|
-
|
|
626
|
-
## Settings
|
|
627
|
-
|
|
628
|
-
`operad repo add` writes `<repository>/.operad/dev.json` when it is absent (its
|
|
629
|
-
schema is `dev.schema.json`) and adds `.operad-worktrees/` and
|
|
630
|
-
`.radian-sandbox/` to the repository's `.git/info/exclude`.
|
|
631
|
-
|
|
632
|
-
The file holds the repository's work settings:
|
|
633
|
-
|
|
634
|
-
| field | default | what it is |
|
|
635
|
-
|---|---|---|
|
|
636
|
-
| `remote` | `origin` | the remote a task branch is fetched from and pushed to |
|
|
637
|
-
| `mainBranch` | `main` | the branch a task starts from and merges on each attempt |
|
|
638
|
-
| `worktreeRoot` | `.operad-worktrees` | where task worktrees live, relative to the repository and inside it |
|
|
639
|
-
| `concurrency` | none | a cap on running tasks across all pools, on top of each pool's own cap (its workers' counts, or its `concurrency`); with the old `worker` form it is the one worker's `count` (default `1`); each plan also has its own limit |
|
|
640
|
-
| `workers`, `pools` | none | the repository's workers and pools; fields are in the manual ("`dev.json`: workers and pools"). Not allowed together with `worker` |
|
|
641
|
-
| `worker.use` | `radian/agent` | the harness step that works a task; the old single-worker form, one worker named after its harness |
|
|
642
|
-
| `worker.args` | `[]` | extra arguments for that harness step |
|
|
643
|
-
| `worker.wallTimeSecs`, `worker.stallSecs` | harness defaults | the worker's time limits |
|
|
644
|
-
| `work.wrapUpAt` | `0.85` | the share (above 0, below 1) of a work step's time limit at which the worker is asked, through its harness, to stop starting new things, commit and write a progress note (`.operad-progress.md` in the worktree, never committed). The limit is the wall time of the run the harness reports when it starts (the worker's `wallTimeSecs`, or the harness's own default), counted from when the pool gave the worker its place. The harnesses that take a message mid-run (`claude`, `pi`) pass it on; the others get nothing. A step that runs out of time anyway is stopped a little before that limit (a harness that reports none is stopped by the step's own three hours), what is in the worktree is committed (`work in progress: the work step ran out of time`), and the task waits with the reason `work timed out`. The note and the commits are in the step's history, and the next attempt's prompt starts with them |
|
|
645
|
-
| `workerBrief` | `.operad/worker-brief.md` | the brief a worker reads first; a missing file means the built-in text |
|
|
646
|
-
| `prepare` | `[]` | shell lines run in every checkout dev makes (the worker's worktree, the gate checkout verify and review use, the integration checkout) after it is created or moved to a new commit and before a step uses it, e.g. `bun install --frozen-lockfile`. Output goes to the step's log; a failing line fails the step with reason `prepare failed` and the log path. The review prompt says the checkout is prepared. When `prepare` is empty the checkout stays a plain checkout: dev installs and links nothing itself, so a repository whose checks need installed packages (a Bun workspace, for one) names the install in `prepare` |
|
|
647
|
-
| `gate.commands` | `[]` | the commands the verify step runs on the task commit. A command is a string, or `{ "run": "…", "failed": { "match": "<regex, one capture group: the failed test's name>", "rerun": "<command with {name} (shell-quoted name) or {pattern} (shell-quoted anchored regex, \" > \" turned into a space as `bun test -t` matches)>", "max": 10 } }`: when `run` exits non-zero, the names found in its log are run again one by one (each taking a check place); the check passes when every rerun passes. No name, more than `max`, or a failing rerun fails it as before; a timeout is never rerun; `check.rerun` is not used for that command. The task's Changes say `passed on rerun: <test names>`, the check log holds each rerun under a heading, and `operad reruns` lists how often each test passed on a rerun, most frequent first |
|
|
648
|
-
| `gate.commandTimeoutSecs` | `1800` | the longest one gate command may run |
|
|
649
|
-
| `check.rerun` | `1` | how many times a failed gate or integration check runs again before it counts as failed; `0` turns it off; a timeout is never rerun. A pass on the rerun is a pass, noted in the task's Changes and the check log holds both runs |
|
|
650
|
-
| `check.flakyTask` | `2` | how many times one test may pass only on its rerun in this repository before dev proposes a task `flaky-<test>` (title "Fix the flaky test: <test>") in the flaky-test plan (see `check.flakyPlan`), with the test, the count, the tasks and times, the last two failures and the stress command in its brief; `0` turns it off. The test's file is the one whose section of the check log holds the test's own `(fail)` line, never the summary bun prints again after the last file; when the log does not give it, dev searches the repository's test files for the test's name and, if that does not find exactly one file, the brief says the file is unknown. The task's area is the package that file is in (`packages/<name>/...` gives `<name>`; `tests` when the file is unknown). The brief's stress command has `--runs <N>`; N follows the sizing rule from the repository's CLAUDE.md quoted below it. One task per test until it is merged or cancelled, then the count restarts at 0. `operad reruns` shows the task beside its test |
|
|
651
|
-
| `check.loadLimit` | the number of cores | the 1-minute load average below which the machine is quiet enough to trust a check. A check that timed out, was killed by a signal nobody sent, or failed only by test timeouts waits for the load to fall below it before it runs once more (see Checks that are not the code) |
|
|
652
|
-
| `check.flakyLoadLimit` | twice the number of cores | the 1-minute load average above which a failed test was seen under load. The check reads the load when its command starts and when it ends; a reading above this limit marks the failure as skipped, so it opens or updates no flaky-test task, and the check log and the task's history say so with the load and the core count |
|
|
653
|
-
| `check.flakyPlan` | unset | the id of the plan the flaky-test tasks are proposed in. When it is unset, or that plan is finished or cancelled, dev makes a plan `flaky-tests` (title "Flaky tests") once, confirmed, with the auto level and priority of the repository's newest confirmed plan (`off` and `P3` with none), and uses it until it is finished or cancelled |
|
|
654
|
-
| `reviewer.use` | `radian/agent` | the harness step that reviews the diff |
|
|
655
|
-
| `reviewer.args` | `[]` | the arguments every review gets |
|
|
656
|
-
| `reviewer.firstArgs` | none | the arguments the first review of an attempt gets instead, including its one retry after an invalid report |
|
|
657
|
-
| `reviewer.first.use`, `reviewer.first.args`, `reviewer.first.timeoutSecs`, `reviewer.first.stallSecs` | none | the settings of a task's first review (no earlier review of the task). Each value set there replaces the reviewer's own for that review only; every later review (a rework round, or a review of the same commit as an earlier one) uses the reviewer's own values, so a rework round, which reads only the increment and the previous findings, can run a cheaper model under a shorter limit. With no `first` block every review uses the reviewer's values, as before. Each review report (and the review step's data) records `reviewSettings`: the round (`first` or `rework`) and the values that ran, with where each came from (`first`, `firstArgs`, `fallback` for the harness and arguments of a fallback review, or `default`) |
|
|
658
|
-
| `reviewer.fallback.use` | none | the harness step that reviews when the primary reviewer is unavailable |
|
|
659
|
-
| `reviewer.fallback.args` | `[]` | the arguments every fallback review gets |
|
|
660
|
-
| `reviewer.timeoutSecs` | `600` | the longest a review may run |
|
|
661
|
-
| `reviewer.stallSecs` | harness default | how long a review may print no new line before it is stopped |
|
|
662
|
-
| `reviewer.fixLevel` | `major` | the lowest finding severity that fails the gate: `critical`, `major` or `minor` |
|
|
663
|
-
| `reviewer.followups` | `true` | whether findings that did not fail a review (below `fixLevel`, or moved as pre-existing) are collected into a follow-up task |
|
|
664
|
-
| `reviewer.retrySecs` | `120` | how long an unavailable review waits first; each further wait doubles, up to 30 minutes |
|
|
665
|
-
| `reviewer.maxFileDiffBytes` | `200000` | the largest diff one file may put in the review prompt |
|
|
666
|
-
| `reviewer.maxDiffBytes` | `1000000` | the largest diff the review prompt may carry; counts the prompt's text, where a rename or a deleted file is one line |
|
|
667
|
-
| `autoDefault` | `"off"` | the auto level a new plan starts at: `off`, `run` or `merge` |
|
|
668
|
-
| `maxAutoRework` | `2` | how many automatic reworks in a row are allowed before waiting for a person |
|
|
669
|
-
| `integration.style` | `merge` | `merge` lands a merge commit with `Merge work/<task id> (<short sha>)`; `squash` lands one squashed commit |
|
|
670
|
-
| `integration.batch` | `1` | the most tasks one integration merges together; `1` or unset means one at a time. Above 1, when more than one task is queued as a turn starts, integrate merges the queued verified commits onto main in queue order into one candidate, runs `integration.keyCommands` once and pushes once; each task keeps its own merge commit (`Merge work/<id> (<sha>)`), so history and revert stay per task. A merge conflict between them, or failing key commands, falls back to integrating them one by one in queue order, so a bad task is sent back to its worker alone and the others land. Each task's history says `integrated in a batch with <tasks>` |
|
|
671
|
-
| `integration.keyCommands` | `[]` | commands (strings or `{ run, failed }` as in `gate.commands`) the integrate step runs on the candidate before the push; a failure sends the task back to the worker |
|
|
672
|
-
| `hooks.afterMerge` | removes both worktrees and both branches | commands cleanup runs after a merge, in the repository root, with `OPERAD_TASK`, `OPERAD_WORKTREE` and `OPERAD_REMOTE` set |
|
|
673
|
-
|
|
674
|
-
### Check places
|
|
675
|
-
|
|
676
|
-
The checks of verify and integrate share a limit per operad home, not per
|
|
677
|
-
repository: tasks of different plans and repositories run on one machine. The
|
|
678
|
-
limit is `checks` in the `dev` section of the home's `config.json` (default
|
|
679
|
-
`2`); it is there and not in `dev.json` because `dev.json` belongs to one
|
|
680
|
-
repository. A check takes a place before it runs. When none is free, the step
|
|
681
|
-
log says `waiting for a check place: 2 in use` and the check waits without a
|
|
682
|
-
time limit; its `gate.commandTimeoutSecs` starts when it runs. Places are lock
|
|
683
|
-
files under `<home>/dev/check-places/`, so a check whose process dies gives its
|
|
684
|
-
place back. A rerun of a failed check takes a place again.
|
|
685
|
-
|
|
686
|
-
An integration check, with its key-command reruns, goes before a waiting verify
|
|
687
|
-
check when a place frees, across every repository, so a verified task is not
|
|
688
|
-
held behind the machine's task checks. Among integrations and among verifies the
|
|
689
|
-
order stays first come, first served. A verify that has waited more than 30
|
|
690
|
-
minutes goes before the integrations: that is longer than one integration check
|
|
691
|
-
usually takes, so a queue of integrations still drains first, and short enough
|
|
692
|
-
that a steady stream of them cannot starve a verify for ever. A verify passed
|
|
693
|
-
over this way says so in its step log:
|
|
694
|
-
`waiting for a check place: passed over for an integration check`.
|
|
695
|
-
|
|
696
|
-
A repository can also limit itself: `gate.places` in its `dev.json` (an integer
|
|
697
|
-
of 1 or more, unset by default) is the most checks of that repository that run
|
|
698
|
-
at once. It is for checks that cannot share a machine, such as full UI test
|
|
699
|
-
runs on a simulator, so that they do not hold back the checks of other
|
|
700
|
-
repositories. A check takes a place of the home and a place of its repository,
|
|
701
|
-
waits without a time limit until both are free, and says which it waits for:
|
|
702
|
-
`waiting for a check place of operad-ios: 1 in use`. It takes them in one order
|
|
703
|
-
(home, then repository) and gives the home place back while it waits for the
|
|
704
|
-
repository's, so two checks cannot wait for each other. The repository's places
|
|
705
|
-
are lock files in the same directory, so a dead check gives both back.
|
|
706
|
-
|
|
707
|
-
A rework asks for the worker that ran the attempt before. When that worker is
|
|
708
|
-
busy with another task, the work step waits for it without a time limit; the
|
|
709
|
-
task's row shows the `blocked` mark and `waiting for worker pi: held by T-0205`
|
|
710
|
-
(in `running` and in `show`), and the step log says it when the wait starts and
|
|
711
|
-
`worker pi is free; the work starts` when it ends. Any other attempt that has
|
|
712
|
-
to wait says the same, naming the workers of the pool (`waiting for worker
|
|
713
|
-
claude or pi: held by T-0205`). A worker that has its place and whose program is
|
|
714
|
-
not running two minutes later is said too, in the row and the log (`worker
|
|
715
|
-
claude has had its place for 2 minutes and has not started`), because that
|
|
716
|
-
worker's place is held against every other task that needs it; the line goes
|
|
717
|
-
when the program starts. A harness step tells the work step that its program
|
|
718
|
-
runs through `reportWorkerStarted` of `@operad-io/engine/platform`, which
|
|
719
|
-
`runAgent` of the process harnesses calls.
|
|
720
|
-
|
|
721
|
-
One integration of a repository runs at a time. A task whose wait was answered
|
|
722
|
-
with `merge` joins the repository's integration queue, in the order the merges
|
|
723
|
-
were chosen, and the integrate step waits for its turn without a time limit. It
|
|
724
|
-
says so in the step log and in `operad running`:
|
|
725
|
-
`waiting to integrate: T-0025 is integrating`. Waiting is not a check and holds
|
|
726
|
-
no check place. The queue is a set of ticket files under
|
|
727
|
-
`<home>/dev/integration-queue/`; a task whose process dies loses its ticket, so
|
|
728
|
-
its turn goes to the next however it ended (merged, conflict, fail, cancelled).
|
|
729
|
-
The task that has the turn builds its candidate on the main the previous one
|
|
730
|
-
pushed, so a full key-command run is not thrown away because another task
|
|
731
|
-
pushed first.
|
|
732
|
-
|
|
733
|
-
The built-in brief says to work only in the worktree, commit whole pieces, run
|
|
734
|
-
the repository's verify command and end with a summary.
|
|
735
|
-
|
|
736
|
-
A `dev.json` written by an earlier version still loads: `worktrees` is read as
|
|
737
|
-
`worktreeRoot`, and `sandbox` is ignored. A `worktreeRoot` that is absolute,
|
|
738
|
-
climbs out of the repository, or resolves outside it through a symlink is
|
|
739
|
-
refused when the file is read and again before a worktree is created.
|
|
740
|
-
|
|
741
|
-
## Settings from a client
|
|
742
|
-
|
|
743
|
-
`operad settings` lists what a person may tune and `operad settings set <name>
|
|
744
|
-
<value>` changes it (add `--repo <name>` for a repository's files). The home's
|
|
745
|
-
`checks` is `dev.checks`. A repository's `.operad/dev.json` is `dev.*`
|
|
746
|
-
(`autoDefault`, `concurrency`, `gate.commands`, `gate.commandTimeoutSecs`, `reviewer.use`,
|
|
747
|
-
`reviewer.args`, `reviewer.timeoutSecs`, `reviewer.fixLevel`): its file name is
|
|
748
|
-
the plugin's name, so the name appears once. Another file adds its name, so
|
|
749
|
-
`.operad/review.json` is `dev.review.default.*` (`levels`, `rules`,
|
|
750
|
-
`fixLevel`). Changing what merges (`autoDefault`, `fixLevel`, the levels and rules)
|
|
751
|
-
asks for `--yes`, because it changes what merges. Other settings can be read
|
|
752
|
-
there but are changed in the file.
|
|
753
|
-
|
|
754
|
-
## Views
|
|
755
|
-
|
|
756
|
-
A plan shows a request and a table of its tasks. A task shows its brief, its
|
|
757
|
-
rework sections when it has some, and its changes.
|
|
758
|
-
|
|
759
|
-
The Changes section is the task's story in a few lines, readable without the
|
|
760
|
-
history. Each entry shows the time it happened (`HH:MM`, the serve host's local
|
|
761
|
-
time) and, where there is one, why, in one line of about 160 characters; a date
|
|
762
|
-
line starts each new day:
|
|
763
|
-
|
|
764
|
-
```
|
|
765
|
-
2026-11-08
|
|
766
|
-
|
|
767
|
-
21:05 rework 1 — review: packages/dev/src/gate.ts:1059 major: The review-report setup follows …
|
|
768
|
-
21:31 merged origin/main 83163e5 into the branch (clean)
|
|
769
|
-
21:40 merged as 0bce8fa
|
|
770
|
-
```
|
|
771
|
-
|
|
772
|
-
A rework says who asked (review, verify, integrate, conflict, lead, owner) and
|
|
773
|
-
the first finding or failing check line. A reverify, reject, cancel or lead or
|
|
774
|
-
owner action carries its note when it has one, a wait says what it waits for,
|
|
775
|
-
and a merge names the commit. The time and the reason are stored with the entry
|
|
776
|
-
when the event happens (in the task's brief); an entry written before that has
|
|
777
|
-
no time and is shown as it was.
|
|
778
|
-
|
|
779
|
-
The Metrics section is narrow enough for a phone. A table has one row per
|
|
780
|
-
attempt (number, wall time from its first step to its last, cost, how it ended:
|
|
781
|
-
`merged`, `review: n findings`, `verify failed`, `conflict`, `cancelled`,
|
|
782
|
-
`running <step>`) and a total row that sums time and cost over all attempts.
|
|
783
|
-
Under it, one line per attempt, newest first, gives the per-step times and the
|
|
784
|
-
tokens (in k with one decimal from 10k); steps that did not run are left out. What is running comes from the task's run itself, the step and start time `operad running` reports; when the run is not active (it waits for a person, has ended, or the task was cancelled) nothing is shown as running, whatever the task's phase says. Finished steps and how an attempt ended come only from recorded results:
|
|
785
|
-
|
|
786
|
-
```
|
|
787
|
-
| # | time | cost | result |
|
|
788
|
-
|---|------|------|--------|
|
|
789
|
-
| 1 | 45m | $1.24 | review: 2 findings |
|
|
790
|
-
| 2 | 3m … | – | running work |
|
|
791
|
-
| total | 48m | $1.24 | |
|
|
792
|
-
|
|
793
|
-
**#2** worktree 2s · work 3m00s (running)
|
|
794
|
-
|
|
795
|
-
**#1** worktree 2s · work 22m10s · verify 4m35s · review 18m00s · 100 in / 35.9k out tokens
|
|
796
|
-
```
|
|
13
|
+
MIT licensed.
|