hive-tasks 1.6.0 → 1.8.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/CHANGELOG.md +94 -0
- package/README.md +140 -70
- package/README.zh-CN.md +133 -74
- package/SPEC.md +208 -126
- package/package.json +1 -1
- package/src/cli.js +61 -26
- package/src/lease.js +76 -23
- package/src/task.js +27 -2
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,96 @@ All notable changes to this project are documented here. The format follows
|
|
|
4
4
|
[Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and the project uses
|
|
5
5
|
[Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
6
6
|
|
|
7
|
+
## Unreleased
|
|
8
|
+
|
|
9
|
+
### Changed
|
|
10
|
+
|
|
11
|
+
- Documentation aligned with the current implementation. README.md, README.zh-CN.md and
|
|
12
|
+
SPEC.md now use "task" throughout, describe the four states (pending, claimed, done,
|
|
13
|
+
failed), the required `--acceptance`/`--draft` rule, drafts as a flag, stage chains
|
|
14
|
+
and role fallback, `stateChangedAt`, reopen/review-of and `rm`. Statements without
|
|
15
|
+
code support were corrected (for example the missing-dependency "data error", the
|
|
16
|
+
"never starts a process" claim and the generated id length). No behaviour or protocol
|
|
17
|
+
change.
|
|
18
|
+
|
|
19
|
+
## [1.8.1] - 2026-12-04
|
|
20
|
+
|
|
21
|
+
### Added
|
|
22
|
+
|
|
23
|
+
- `stateChangedAt` (ISO timestamp) on every card: the last time the card really moved
|
|
24
|
+
lane or stage (claim, done, fail, retry, reopen and stage transitions, including a
|
|
25
|
+
stage advance that keeps the card pending). Metadata-only updates such as renew leave
|
|
26
|
+
it unchanged. list/show/next/ready JSON expose it.
|
|
27
|
+
- Legacy cards written before 1.8.1 have no field; the read side falls back to
|
|
28
|
+
`updatedAt`.
|
|
29
|
+
|
|
30
|
+
### Tests
|
|
31
|
+
|
|
32
|
+
- 52 node:test scenarios: the 48 from 1.8.0 unchanged, plus test/state-changed.test.mjs
|
|
33
|
+
covering lane changes, a stage advance while the card stays pending, renew and a
|
|
34
|
+
title-only metadata edit not moving it, and the updatedAt fallback for legacy cards.
|
|
35
|
+
|
|
36
|
+
## [1.8.0] - 2026-12-04
|
|
37
|
+
|
|
38
|
+
### Added
|
|
39
|
+
|
|
40
|
+
- Draft cards: `add --draft` creates a card without an acceptance command and stores
|
|
41
|
+
`draft: true` on the blob (normal cards omit the key entirely). draft is a flag, not a
|
|
42
|
+
state: the card keeps pending/claimed/done/failed, but ready, next and every
|
|
43
|
+
dispatch-ready computation exclude it, and claim refuses it with exit 2 and a clear
|
|
44
|
+
message. list/show expose the flag in JSON and text.
|
|
45
|
+
- `plan --file plan.json` accepts `"draft": true` per entry. Every entry without an
|
|
46
|
+
acceptance command and without `"draft": true` is rejected before anything is
|
|
47
|
+
written; the refusal names the offending entry as `plan[N] ("title")`.
|
|
48
|
+
|
|
49
|
+
### Changed
|
|
50
|
+
|
|
51
|
+
- `add` now mechanically requires `--acceptance` unless `--draft` is passed:
|
|
52
|
+
`add: --acceptance is required (or pass --draft for a draft card)`, exit 2. The rule
|
|
53
|
+
also applies to staged cards; per-stage acceptance still overrides the card command
|
|
54
|
+
for done --verify.
|
|
55
|
+
- USAGE, README.md, README.zh-CN.md and SPEC.md document the required acceptance, the
|
|
56
|
+
draft field and the dispatch rule; the CI smoke test creates its card with --acceptance.
|
|
57
|
+
|
|
58
|
+
### Tests
|
|
59
|
+
|
|
60
|
+
- 48 node:test scenarios. The 43 scenarios from 1.7.0 were updated to create cards with
|
|
61
|
+
--acceptance where they only exercised another behaviour; five new scenarios in
|
|
62
|
+
test/draft.test.mjs cover the add refusal and both escapes, the stored flag (and its
|
|
63
|
+
absence on normal cards), ready/next exclusion and claim refusal for plain and staged
|
|
64
|
+
drafts, plan rejection naming the entry, and draft entries in a plan.
|
|
65
|
+
|
|
66
|
+
### Published
|
|
67
|
+
|
|
68
|
+
- Not published to npm in this change.
|
|
69
|
+
|
|
70
|
+
## [1.7.0] - 2026-12-04
|
|
71
|
+
|
|
72
|
+
### Changed
|
|
73
|
+
|
|
74
|
+
- claim is announcement-only. A card claim always succeeds; the scope paths are
|
|
75
|
+
announced on the hive-consensus lease board instead of being taken as exclusive
|
|
76
|
+
leases. The latest announcer per key wins, and a live announcement by another agent
|
|
77
|
+
is reported as an overlap in the claim event and in `--json`, never as a refusal.
|
|
78
|
+
- done, fail, retry, reopen and rm --force release the announcements the claim owns; a
|
|
79
|
+
release only deletes the blob this claim still wrote, so a newer announcer survives.
|
|
80
|
+
- Two agents may claim two cards whose scope overlaps, which is what the queue needs;
|
|
81
|
+
merge-on-commit reconciles the edits at commit time.
|
|
82
|
+
|
|
83
|
+
### Removed
|
|
84
|
+
|
|
85
|
+
- The `path busy` refusal and the card-revert branch behind it.
|
|
86
|
+
|
|
87
|
+
### Tests
|
|
88
|
+
|
|
89
|
+
- 43 node:test scenarios: the original 41 unchanged, plus two cards on one scope claimed
|
|
90
|
+
by different agents (both claimed, both visible on the hive board, overlap reported)
|
|
91
|
+
and release ownership for a superseded announcement.
|
|
92
|
+
|
|
93
|
+
### Published
|
|
94
|
+
|
|
95
|
+
- npm: `hive-tasks@1.7.0` on 2026-12-04.
|
|
96
|
+
|
|
7
97
|
## [1.6.0] - 2026-12-04
|
|
8
98
|
|
|
9
99
|
### Changed
|
|
@@ -27,6 +117,10 @@ All notable changes to this project are documented here. The format follows
|
|
|
27
117
|
cards, ready excluding failed cards, stats counting only the four states, and the
|
|
28
118
|
removal of block/unblock as commands.
|
|
29
119
|
|
|
120
|
+
### Published
|
|
121
|
+
|
|
122
|
+
- npm: `hive-tasks@1.6.0` on 2026-12-04.
|
|
123
|
+
|
|
30
124
|
## [1.5.0] - 2026-12-04
|
|
31
125
|
|
|
32
126
|
### Added
|
package/README.md
CHANGED
|
@@ -5,16 +5,16 @@
|
|
|
5
5
|
[](https://github.com/d86e/hive-tasks/actions/workflows/ci.yml)
|
|
6
6
|
[](LICENSE)
|
|
7
7
|
|
|
8
|
-
**When several agents share a repository, "what is left to do, in what order, and who is doing it" lives in a chat prompt and dies with the session. hive-tasks makes it a query: every unit of work is a
|
|
8
|
+
**When several agents share a repository, "what is left to do, in what order, and who is doing it" lives in a chat prompt and dies with the session. hive-tasks makes it a query: every unit of work is a task in one git tree, behind one ref, with a state machine, optional stage chains, dependencies and a role.**
|
|
9
9
|
|
|
10
10
|
```
|
|
11
11
|
refs/hive/v1/tasks -> tree
|
|
12
|
-
auth-token-a1b2 -> blob (the
|
|
12
|
+
auth-token-a1b2 -> blob (the task)
|
|
13
13
|
```
|
|
14
14
|
|
|
15
|
-
No server, no database, no queue process. A claim is a compare-and-swap on that one ref, so exactly one agent wins
|
|
15
|
+
No server, no database, no queue process. A claim is a compare-and-swap on that one ref, so exactly one agent wins a task; the paths it touches are announced on the [hive-consensus](https://github.com/d86e/hive-consensus) board, where overlaps are visible information rather than a refusal.
|
|
16
16
|
|
|
17
|
-
> ~1,
|
|
17
|
+
> ~1,600 lines, zero dependencies, Node.js >= 22.19, git >= 2.40
|
|
18
18
|
|
|
19
19
|
**Built for**: agent teams that already coordinate with hive; a queen that hands out work; a dispatcher that needs a stable list instead of a conversation.
|
|
20
20
|
|
|
@@ -26,20 +26,28 @@ No server, no database, no queue process. A claim is a compare-and-swap on that
|
|
|
26
26
|
|
|
27
27
|
An agent crashes mid-run. Was task 4 done? Nobody knows. Another agent finishes a task and the queen's list is stale. Two agents pick up "the tests" because both read the same paragraph.
|
|
28
28
|
|
|
29
|
-
A
|
|
29
|
+
A task fixes that: it has an id, a state, an owner, an attempt count and a verdict. The answer to "what is left" is a command, not a memory.
|
|
30
30
|
|
|
31
31
|
## Install
|
|
32
32
|
|
|
33
|
+
hive-tasks needs Node.js >= 22.19 and git >= 2.40. `init` creates `.hive/` and adds a
|
|
34
|
+
short hive-tasks section to `AGENTS.md`:
|
|
35
|
+
|
|
33
36
|
```bash
|
|
34
37
|
npx hive-tasks init
|
|
35
|
-
npx hive-tasks add --title "auth takes an object" --role coder --scope src/auth.ts
|
|
38
|
+
npx hive-tasks add --title "auth takes an object" --role coder --scope src/auth.ts --acceptance "npm test -- auth"
|
|
36
39
|
```
|
|
37
40
|
|
|
41
|
+
`--acceptance` is required for every task that is not a draft: a task has to say how it
|
|
42
|
+
will be judged.
|
|
43
|
+
|
|
38
44
|
## 60-second demo
|
|
39
45
|
|
|
40
46
|
```bash
|
|
41
|
-
$ hive-tasks add --title "auth takes an object" --role coder --scope src/auth.ts
|
|
47
|
+
$ hive-tasks add --title "auth takes an object" --role coder --scope src/auth.ts --acceptance "npm test -- auth"
|
|
42
48
|
auth-takes-an-object-dea2 [pending] auth takes an object
|
|
49
|
+
role: coder owner: - attempt: 0
|
|
50
|
+
scope: src/auth.ts
|
|
43
51
|
|
|
44
52
|
$ hive-tasks ready
|
|
45
53
|
auth-takes-an-object-dea2 pending coder auth takes an object
|
|
@@ -47,11 +55,12 @@ auth-takes-an-object-dea2 pending coder auth takes an object
|
|
|
47
55
|
$ hive-tasks claim auth-takes-an-object-dea2 --agent agent-A
|
|
48
56
|
auth-takes-an-object-dea2 [claimed] auth takes an object
|
|
49
57
|
role: coder owner: agent-A attempt: 1
|
|
58
|
+
scope: src/auth.ts
|
|
50
59
|
|
|
51
60
|
$ hive-tasks claim auth-takes-an-object-dea2 --agent agent-B
|
|
52
61
|
hive-tasks: task auth-takes-an-object-dea2 is claimed # exit 2
|
|
53
62
|
|
|
54
|
-
$ hive-tasks add --title "token tests" --role tester --after auth-takes-an-object-dea2
|
|
63
|
+
$ hive-tasks add --title "token tests" --role tester --after auth-takes-an-object-dea2 --acceptance "npm test -- token"
|
|
55
64
|
$ hive-tasks ready
|
|
56
65
|
Nothing ready.
|
|
57
66
|
|
|
@@ -64,34 +73,49 @@ token-tests-ba66 pending tester token tests
|
|
|
64
73
|
|
|
65
74
|
| Command | Effect |
|
|
66
75
|
| --- | --- |
|
|
67
|
-
|
|
|
68
|
-
|
|
|
69
|
-
|
|
|
70
|
-
|
|
|
71
|
-
|
|
|
72
|
-
|
|
|
73
|
-
|
|
|
74
|
-
|
|
|
75
|
-
|
|
|
76
|
+
| init | create .hive/ and the hive-tasks section in AGENTS.md |
|
|
77
|
+
| add --title T (--acceptance CMD \| --draft) [--role R] [--scope P] [--after ID] [--review-of ID] [--tag T] [--priority N] [--goal G] [--stage ROLE[:ACCEPTANCE]] [--stages FILE] | create a task; --acceptance is required unless --draft; --review-of links it to the task it tests; --stage/--stages build a stage chain |
|
|
78
|
+
| list [--state S] [--role R] [--json] | every task, drafts included |
|
|
79
|
+
| show <id> [--json] | one task, its stage chain, the draft flag and the resolved role source |
|
|
80
|
+
| ready [--limit N] [--role R] [--json] | pending, non-draft tasks whose dependencies are done, ordered by priority then age |
|
|
81
|
+
| next [--role R] [--json] | the single best candidate |
|
|
82
|
+
| claim <id> --agent A [--ttl 5m] | task CAS, then announce the scope paths on the hive-consensus board |
|
|
83
|
+
| renew <id> [--ttl 5m] | extend a claim so a long but healthy run is not recovered mid-flight |
|
|
84
|
+
| done <id> [--sha S] [--verdict pass\|fail] [--verify] | finish, release the claim's announcements, record resultCommit; on a staged task it opens the next stage; --verify runs the current stage acceptance first |
|
|
85
|
+
| plan --file plan.json | create a whole dependency tree in one transaction; entries take title, key, acceptance (or "draft": true), role, scope, after, priority, tags, goal and stages |
|
|
76
86
|
| fail <id> --reason R | failure is data: attempt stays; a stage with a done onFail target rewinds instead |
|
|
77
87
|
| retry <id> [--stage KEY] | failed back to pending (or reset a chain to KEY) |
|
|
78
|
-
| reopen <id> [--reason R] [--agent A] [--stage KEY] | every state back to pending; clears owner, claim, result and verdict, attempt + 1; releases the claim's
|
|
79
|
-
| rm <id> [--force] [--json] | delete a pending/failed/done
|
|
88
|
+
| reopen <id> [--reason R] [--agent A] [--stage KEY] | every state back to pending; clears owner, claim, result and verdict, attempt + 1; releases the claim's announcements; a staged task resets to KEY (default the first stage) |
|
|
89
|
+
| rm <id> [--force] [--json] | delete a pending/failed/done task; a claimed task is refused (exit 2) unless --force, which releases its announcements first |
|
|
90
|
+
| stats [--json] | counts by state and role, plus the oldest pending task |
|
|
91
|
+
|
|
92
|
+
Exit codes: 0 success, 1 internal error, 2 refused (already claimed, wrong state, unknown
|
|
93
|
+
task, dependency missing, mode freeze, invalid stage chain, missing --acceptance, draft
|
|
94
|
+
claim).
|
|
80
95
|
|
|
81
|
-
|
|
96
|
+
## Timestamps
|
|
97
|
+
|
|
98
|
+
Each task stores `stateChangedAt`, the ISO time it last really moved lane or stage (lane =
|
|
99
|
+
state plus current stage and stage state). Claiming a pending task, done, fail, retry,
|
|
100
|
+
reopen and stage transitions move it when they change the lane, including a stage advance
|
|
101
|
+
that keeps the task pending. Anything that leaves the lane alone — renew, an external
|
|
102
|
+
title or goal edit, or reclaiming an expired claim while the task stays claimed — leaves
|
|
103
|
+
it unchanged. list, ready, next and show JSON expose it; tasks written before 1.8.1 have
|
|
104
|
+
no such field and readers fall back to `updatedAt`.
|
|
82
105
|
|
|
83
106
|
## Resource keys
|
|
84
107
|
|
|
85
|
-
scope entries are usually paths, but the
|
|
86
|
-
works. Use a prefix for shared things that are not files:
|
|
108
|
+
scope entries are usually paths, but the announcement layer does not care: any stable
|
|
109
|
+
string works. Use a prefix for shared things that are not files:
|
|
87
110
|
|
|
88
111
|
~~~bash
|
|
89
|
-
hive-tasks add --title "run the dev server" --scope src/web --scope resource:port:3000
|
|
90
|
-
hive-tasks add --title "migrate" --scope resource:db:dev
|
|
112
|
+
hive-tasks add --title "run the dev server" --acceptance "curl -sf localhost:3000/health" --scope src/web --scope resource:port:3000
|
|
113
|
+
hive-tasks add --title "migrate" --acceptance "npm run migrate:verify" --scope resource:db:dev
|
|
91
114
|
~~~
|
|
92
115
|
|
|
93
|
-
Two
|
|
94
|
-
|
|
116
|
+
Two tasks that name the same resource can be claimed at the same time: the claim
|
|
117
|
+
announces the key and reports an existing live announcement as an overlap. Nothing else
|
|
118
|
+
is required: no daemon watches ports, and no claim is refused because of one.
|
|
95
119
|
|
|
96
120
|
## Stats
|
|
97
121
|
|
|
@@ -100,21 +124,25 @@ hive-tasks stats
|
|
|
100
124
|
hive-tasks stats --json
|
|
101
125
|
~~~
|
|
102
126
|
|
|
103
|
-
Counts by state and role, plus the oldest pending
|
|
127
|
+
Counts by state and role, plus the oldest pending task.
|
|
104
128
|
|
|
105
129
|
## How a claim works
|
|
106
130
|
|
|
107
|
-
1. the
|
|
108
|
-
2.
|
|
109
|
-
|
|
131
|
+
1. the task CAS moves pending -> claimed in the task tree (one winner per task);
|
|
132
|
+
2. every scope path is announced on the hive-consensus announcement board; the latest
|
|
133
|
+
announcement wins and a live announcement by another agent is reported as an
|
|
134
|
+
overlap;
|
|
135
|
+
3. done, fail, reopen and rm --force release the announcements their claim owns.
|
|
110
136
|
|
|
111
|
-
|
|
137
|
+
Announcements never refuse a task: two agents may hold two tasks whose scope overlaps,
|
|
138
|
+
which is exactly what the queue must allow. merge-on-commit reconciles the two edits at
|
|
139
|
+
commit time; the task is the authority, the announcement is visibility for the board.
|
|
112
140
|
|
|
113
141
|
## When an agent dies
|
|
114
142
|
|
|
115
143
|
Every claim carries claimedUntil (the --ttl, 5 minutes by default). Once it passes, the
|
|
116
|
-
|
|
117
|
-
pending, incrementing attempt. No operator
|
|
144
|
+
task is **reclaimable**: the next agent that claims it takes over as if the task were
|
|
145
|
+
pending, incrementing attempt. No operator and no manual cleanup:
|
|
118
146
|
|
|
119
147
|
~~~bash
|
|
120
148
|
$ hive-tasks claim slow-task-1a2b --agent agent-A --ttl 1s
|
|
@@ -125,28 +153,30 @@ $ hive-tasks claim slow-task-1a2b --agent agent-B # attempt 2, owner agent-B
|
|
|
125
153
|
|
|
126
154
|
A long but healthy run calls renew to keep its claim.
|
|
127
155
|
|
|
128
|
-
## Deleting a
|
|
156
|
+
## Deleting a task
|
|
129
157
|
|
|
130
|
-
Remove a
|
|
158
|
+
Remove a task that should not stay on the board:
|
|
131
159
|
|
|
132
160
|
~~~bash
|
|
133
|
-
$ hive-tasks rm stale-
|
|
134
|
-
stale-
|
|
161
|
+
$ hive-tasks rm stale-task-1a2b
|
|
162
|
+
stale-task-1a2b deleted [pending] stale task
|
|
135
163
|
|
|
136
|
-
$ hive-tasks rm working-
|
|
137
|
-
hive-tasks: task working-
|
|
138
|
-
$ hive-tasks rm working-
|
|
164
|
+
$ hive-tasks rm working-task-9f8e
|
|
165
|
+
hive-tasks: task working-task-9f8e is claimed by agent-A; release or reopen it first, or use --force # exit 2
|
|
166
|
+
$ hive-tasks rm working-task-9f8e --force # releases the claim's announcements, then deletes
|
|
139
167
|
~~~
|
|
140
168
|
|
|
141
|
-
pending, failed and done
|
|
142
|
-
purpose: delete it with --force, which
|
|
143
|
-
|
|
144
|
-
instead of pretending to
|
|
169
|
+
pending, failed and done tasks are deletable, and so is a draft task (draft is a flag,
|
|
170
|
+
not a state). A claimed task is protected on purpose: delete it with --force, which
|
|
171
|
+
releases exactly that claim's announcements first, so no announcement is stranded. An
|
|
172
|
+
unknown id is exit 2, and a second delete reports "no such task" instead of pretending to
|
|
173
|
+
succeed.
|
|
145
174
|
|
|
146
175
|
## Acceptance and freeze
|
|
147
176
|
|
|
148
|
-
|
|
149
|
-
is repository content and executing it would
|
|
177
|
+
Every new task must carry an acceptance command, or be created as a draft. The command is
|
|
178
|
+
**not** executed by default, because a task is repository content and executing it would
|
|
179
|
+
mean running code someone else pushed:
|
|
150
180
|
|
|
151
181
|
~~~bash
|
|
152
182
|
$ hive-tasks add --title "auth takes an object" --acceptance "npm test -- auth"
|
|
@@ -154,38 +184,76 @@ $ hive-tasks done auth-takes-an-object-dea2 --verify # runs it, records res
|
|
|
154
184
|
$ hive-tasks done auth-takes-an-object-dea2 # records resultCommit only
|
|
155
185
|
~~~
|
|
156
186
|
|
|
157
|
-
|
|
158
|
-
|
|
187
|
+
The rule is mechanical: add without either flag exits 2 and writes no task.
|
|
188
|
+
|
|
189
|
+
~~~bash
|
|
190
|
+
$ hive-tasks add --title "auth takes an object"
|
|
191
|
+
hive-tasks: add: --acceptance is required (or pass --draft for a draft card) # exit 2
|
|
192
|
+
~~~
|
|
193
|
+
|
|
194
|
+
When hive mode is freeze, ready returns only tasks tagged fix and claim refuses anything
|
|
195
|
+
else (exit 2) unless --force is passed, so the hotfix can run while the pipeline is red.
|
|
196
|
+
Everything else waits.
|
|
197
|
+
|
|
198
|
+
## Draft tasks
|
|
199
|
+
|
|
200
|
+
Use --draft for work that should be on the board but must not be picked up yet. It skips
|
|
201
|
+
the acceptance requirement and stores `draft: true` on the blob (a normal task omits the
|
|
202
|
+
key entirely):
|
|
203
|
+
|
|
204
|
+
~~~bash
|
|
205
|
+
$ hive-tasks add --title "auth takes an object" --draft
|
|
206
|
+
auth-takes-an-object-dea2 [pending] auth takes an object
|
|
207
|
+
role: worker owner: - attempt: 0
|
|
208
|
+
draft: true (never ready, not claimable)
|
|
209
|
+
~~~
|
|
210
|
+
|
|
211
|
+
draft is a **flag, not a state**: it adds no fifth state and changes no transition, so a
|
|
212
|
+
draft task stays pending (claim refuses it with exit 2) and ready and next never return
|
|
213
|
+
it. list and show expose the flag. There is no un-draft command: to dispatch a parked
|
|
214
|
+
task, remove it and add it again with --acceptance.
|
|
215
|
+
|
|
216
|
+
plan --file takes the same rule per entry, and every entry may instead opt out with
|
|
217
|
+
"draft": true; a missing acceptance refuses the whole plan and names the entry:
|
|
218
|
+
|
|
219
|
+
~~~json
|
|
220
|
+
[
|
|
221
|
+
{ "key": "impl", "title": "implement auth", "acceptance": "npm test" },
|
|
222
|
+
{ "key": "idea", "title": "park the redesign", "draft": true }
|
|
223
|
+
]
|
|
224
|
+
~~~
|
|
159
225
|
|
|
160
|
-
## Review
|
|
226
|
+
## Review tasks
|
|
161
227
|
|
|
162
|
-
A review
|
|
228
|
+
A review task tests another task. Link it when you create it:
|
|
163
229
|
|
|
164
230
|
~~~bash
|
|
165
|
-
$ hive-tasks add --title "review auth" --role reviewer --review-of auth-takes-an-object-dea2
|
|
231
|
+
$ hive-tasks add --title "review auth" --role reviewer --review-of auth-takes-an-object-dea2 --acceptance "npm test -- auth"
|
|
166
232
|
~~~
|
|
167
233
|
|
|
168
234
|
reviewOf is stored, and the upstream id is added to after, so the review only becomes
|
|
169
|
-
ready once the implementation is done. When the review fails
|
|
170
|
-
reopened automatically (attempt + 1, reason "test failed: ...")
|
|
171
|
-
becomes failed and can be retried
|
|
235
|
+
ready once the implementation is done. When the review fails and the upstream is done,
|
|
236
|
+
the upstream task is reopened automatically (attempt + 1, reason "test failed: ...")
|
|
237
|
+
while the review task becomes failed and can be retried; if the upstream is missing or not
|
|
238
|
+
done, the review still fails and nothing is reopened. A passing review leaves the upstream
|
|
239
|
+
alone.
|
|
172
240
|
|
|
173
241
|
## Stage chains
|
|
174
242
|
|
|
175
|
-
One
|
|
243
|
+
One task can carry an ordered chain of stages instead of a single role. Every stage has a
|
|
176
244
|
role, an optional acceptance command and an optional onFail target:
|
|
177
245
|
|
|
178
246
|
~~~bash
|
|
179
|
-
$ hive-tasks add --title "ship auth" --stage coder --stage tester:"npm test" --stage reviewer
|
|
247
|
+
$ hive-tasks add --title "ship auth" --acceptance "npm test" --stage coder --stage tester:"npm test" --stage reviewer
|
|
180
248
|
$ hive-tasks claim ship-auth-1a2b --agent agent-A # the coder stage
|
|
181
|
-
$ hive-tasks done ship-auth-1a2b # stage done, next stage opens,
|
|
182
|
-
$ hive-tasks ready --role tester # the same
|
|
249
|
+
$ hive-tasks done ship-auth-1a2b # stage done, next stage opens, task stays pending
|
|
250
|
+
$ hive-tasks ready --role tester # the same task, now routed to the tester
|
|
183
251
|
~~~
|
|
184
252
|
|
|
185
253
|
done marks the current stage done and opens the next one, releasing the claim but not the
|
|
186
|
-
|
|
187
|
-
so two agents cannot work two stages at once. --stages FILE
|
|
188
|
-
per-stage acceptance and onFail in one JSON array:
|
|
254
|
+
task; only the last stage finishes the task. claim accepts only the current pending stage
|
|
255
|
+
(or an expired claim on it), so two agents cannot work two stages at once. --stages FILE
|
|
256
|
+
writes explicit keys, per-stage acceptance and onFail in one JSON array:
|
|
189
257
|
|
|
190
258
|
~~~json
|
|
191
259
|
[
|
|
@@ -195,14 +263,16 @@ per-stage acceptance and onFail in one JSON array:
|
|
|
195
263
|
~~~
|
|
196
264
|
|
|
197
265
|
When a stage with onFail fails and its target is done, the chain rewinds: the target and
|
|
198
|
-
|
|
199
|
-
earlier role instead of dying. fail without a usable onFail
|
|
200
|
-
reopen --stage KEY (default the first stage) resets a chain so
|
|
201
|
-
|
|
266
|
+
every later stage become pending again (the failed stage is kept as history), attempt + 1,
|
|
267
|
+
and the task is ready for the earlier role instead of dying. fail without a usable onFail
|
|
268
|
+
still fails the whole task. reopen --stage KEY (default the first stage) resets a chain so
|
|
269
|
+
it can run again. Tasks
|
|
270
|
+
created without stages keep the old single-implicit-stage behaviour and store no stage
|
|
271
|
+
fields.
|
|
202
272
|
|
|
203
273
|
## Role resolution
|
|
204
274
|
|
|
205
|
-
A role is a free string, never an enum, so resolving one must never refuse a
|
|
275
|
+
A role is a free string, never an enum, so resolving one must never refuse a task. show
|
|
206
276
|
prints where the role came from:
|
|
207
277
|
|
|
208
278
|
~~~bash
|
|
@@ -221,7 +291,7 @@ resolveRole(repo, name) tries three tiers and never throws:
|
|
|
221
291
|
|
|
222
292
|
show --json returns the whole resolution as roleResolved ({ name, source, adapter, model,
|
|
223
293
|
prompt, args, stage }) plus roleSource, so a runner or supervisor can consume it directly;
|
|
224
|
-
claim never refuses a
|
|
294
|
+
claim never refuses a task because its role is not configured.
|
|
225
295
|
|
|
226
296
|
## Works with
|
|
227
297
|
|
|
@@ -233,15 +303,15 @@ claim never refuses a card because its role is not configured.
|
|
|
233
303
|
|
|
234
304
|
## Design
|
|
235
305
|
|
|
236
|
-
- [SPEC.md](SPEC.md): ref layout,
|
|
306
|
+
- [SPEC.md](SPEC.md): ref layout, task schema, state machine, claim algorithm, exit codes.
|
|
237
307
|
- [docs/RFC-0001-task-cards.md](docs/RFC-0001-task-cards.md): why one tree instead of one ref per task, and why the queue is derived.
|
|
238
308
|
|
|
239
309
|
## Limits
|
|
240
310
|
|
|
241
311
|
- **Not a scheduler.** It never starts an agent; a dispatcher reads ready/next and spawns.
|
|
242
312
|
- **One ref means one writer at a time.** Claims serialize and retry; that is intended.
|
|
243
|
-
- **No per-
|
|
244
|
-
- **Single repository.**
|
|
313
|
+
- **No per-task history.** Use .hive/events.jsonl, or turn on reflog for the one ref.
|
|
314
|
+
- **Single repository.** Tasks do not cross repositories.
|
|
245
315
|
|
|
246
316
|
## License
|
|
247
317
|
|