input-kanban 0.0.8 → 0.0.9
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/LICENSE +21 -0
- package/PROJECT_GUIDE.md +114 -4
- package/README.en.md +11 -5
- package/README.md +11 -5
- package/RELEASE_NOTES.md +3 -1
- package/bin/input-kanban.js +256 -40
- package/package.json +4 -2
- package/public/index.html +74 -3
- package/src/orchestrator.js +358 -175
- package/src/server.js +8 -4
- package/src/utils.js +5 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 zhang3xing1
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/PROJECT_GUIDE.md
CHANGED
|
@@ -87,6 +87,19 @@ Supported result options:
|
|
|
87
87
|
|
|
88
88
|
`input-kanban result [runId]` prints the final judge result. It prefers `judge/verdict.json` and falls back to `judge/last_message.md`. If no `runId` is provided, it uses the latest run. `--copy` sends the result to the system clipboard.
|
|
89
89
|
|
|
90
|
+
Supported retry options:
|
|
91
|
+
|
|
92
|
+
```text
|
|
93
|
+
<runId>
|
|
94
|
+
[taskId]
|
|
95
|
+
--runs-dir <path>
|
|
96
|
+
--reason <text>
|
|
97
|
+
--max-retries <n>
|
|
98
|
+
--json
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
`input-kanban retry <runId> [taskId]` retries failed or unknown worker tasks. If `taskId` is omitted, it retries failed/unknown tasks in the current blocked batch. Before retrying, the worker output directory is moved under `worker_attempts/<taskId>/attempt-XX/` so failed logs, stderr, exit code, and last message remain available for audit. Retry resets the task to `pending`, records retry history, then reuses the existing scheduler.
|
|
102
|
+
|
|
90
103
|
Supported stop options:
|
|
91
104
|
|
|
92
105
|
```text
|
|
@@ -125,6 +138,38 @@ Default behavior:
|
|
|
125
138
|
- default runs directory: `~/.input-kanban/runs`;
|
|
126
139
|
- default Codex binary: `codex`.
|
|
127
140
|
|
|
141
|
+
## Agent Workflow
|
|
142
|
+
|
|
143
|
+
This project already exposes an agent-friendly CLI path. Use `--json` for machine-readable output and `runs --active` to discover current work before asking for per-run details.
|
|
144
|
+
|
|
145
|
+
Discovery / lookup pattern:
|
|
146
|
+
|
|
147
|
+
```text
|
|
148
|
+
input-kanban --json runs --active
|
|
149
|
+
input-kanban --json status <runId>
|
|
150
|
+
input-kanban --json result <runId>
|
|
151
|
+
input-kanban --json stop <runId>
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
Key points:
|
|
155
|
+
|
|
156
|
+
- `runs` lists visible batches from the shared runs directory; `--active` filters to runs that have not reached a terminal state or still have running tasks.
|
|
157
|
+
- `status` resolves a single run by id and defaults to the latest run when the id is omitted.
|
|
158
|
+
- `result` prefers `judge/verdict.json` and falls back to `judge/last_message.md`; `--copy` copies the result to the clipboard.
|
|
159
|
+
- `stop` requires an explicit `runId` and uses the same stop path as the Web dashboard.
|
|
160
|
+
- `retry` retries failed/unknown workers while preserving the failed attempt directory.
|
|
161
|
+
- `submit` defaults to auto mode: planner -> dispatch -> final judge, with one automatic retry for `batch_blocked` by default. `--no-auto` keeps create + plan only, and `-d/--detach` moves the auto loop to a background supervisor.
|
|
162
|
+
- The Web dashboard now follows the same default auto behavior while the page is open: after planning it auto-dispatches planned runs and auto-starts the final judge once all batches complete.
|
|
163
|
+
|
|
164
|
+
Example agent loop:
|
|
165
|
+
|
|
166
|
+
```text
|
|
167
|
+
1. input-kanban --json runs --active
|
|
168
|
+
2. input-kanban --json status <runId>
|
|
169
|
+
3. input-kanban --json result <runId>
|
|
170
|
+
4. input-kanban --json stop <runId> # only when necessary
|
|
171
|
+
```
|
|
172
|
+
|
|
128
173
|
## Data Model
|
|
129
174
|
|
|
130
175
|
### Run
|
|
@@ -190,18 +235,81 @@ If the planner returns valid JSON with zero tasks, the run is marked `plan_empty
|
|
|
190
235
|
|
|
191
236
|
## Worker Failure Policy
|
|
192
237
|
|
|
193
|
-
|
|
238
|
+
Failed or unknown workers can be retried explicitly with `input-kanban retry <runId> [taskId]` or via Web/API retry. CLI/Web auto mode may retry a blocked batch once by default.
|
|
239
|
+
|
|
240
|
+
Retry rules:
|
|
194
241
|
|
|
195
|
-
|
|
242
|
+
- Retry is an orchestrator-level state transition, not a runner auto-restart.
|
|
243
|
+
- Retry refuses stopped or archived runs.
|
|
244
|
+
- Retry refuses tasks that still have a live process.
|
|
245
|
+
- Retry preserves failed output under `worker_attempts/<taskId>/attempt-XX/` before resetting the task.
|
|
246
|
+
- Retry resets failed/unknown tasks to `pending`, records retry history, and reuses the existing scheduler.
|
|
196
247
|
|
|
197
|
-
Recovery options:
|
|
248
|
+
Recovery options after retries are exhausted:
|
|
198
249
|
|
|
199
|
-
- Inspect `events.pretty`, `stderr.log`, `last_message.md`, and artifacts.
|
|
250
|
+
- Inspect `events.pretty`, `stderr.log`, `last_message.md`, archived worker attempts, and artifacts.
|
|
200
251
|
- Manually mark `failed` or `unknown` workers as completed if the user confirms the work is actually done.
|
|
201
252
|
- Manual completion writes `workers/<taskId>/manual_completion.json`.
|
|
202
253
|
- If the user pastes a manual success result, it is saved as `workers/<taskId>/manual_result.md` and included in final judge input.
|
|
203
254
|
- The UI preserves the original failed or unknown status while also showing the manual completion marker.
|
|
204
255
|
|
|
256
|
+
## Run State Concurrency and Retry Implementation Notes
|
|
257
|
+
|
|
258
|
+
### Failure Retry
|
|
259
|
+
|
|
260
|
+
Retry is implemented as an explicit orchestrator state transition.
|
|
261
|
+
|
|
262
|
+
Implemented behavior:
|
|
263
|
+
|
|
264
|
+
- `input-kanban retry <runId> [taskId]` retries either one failed/unknown task or, when `taskId` is omitted, failed/unknown tasks in the current blocked batch.
|
|
265
|
+
- CLI/Web auto mode retries a `batch_blocked` run once by default via the same retry path.
|
|
266
|
+
- Retry reuses the existing scheduler and does not trigger replanning.
|
|
267
|
+
- Planner retry remains separate and only applies before any worker or judge starts.
|
|
268
|
+
|
|
269
|
+
Safety requirements enforced by implementation:
|
|
270
|
+
|
|
271
|
+
1. Refuse retry when the run is `stopped` or `archived`.
|
|
272
|
+
2. Refuse retry if the target task still has a live process.
|
|
273
|
+
3. Preserve the failed attempt directory under `worker_attempts/<taskId>/attempt-XX/` before resetting the task to `pending`.
|
|
274
|
+
4. Reset the run back to `running` when there is pending retry work, then let the existing scheduler start workers naturally.
|
|
275
|
+
5. Keep retry counters and history on the task so agents can tell transient noise from deterministic task failure.
|
|
276
|
+
|
|
277
|
+
Why this shape was favored:
|
|
278
|
+
|
|
279
|
+
- Runner-level auto-restart hides intent from the state machine and would have to be duplicated for headless/tmux.
|
|
280
|
+
- Auto-replan is too heavy for a single failed worker and would throw away useful per-task evidence.
|
|
281
|
+
- The retry decision belongs to orchestration, where agents and humans can see it explicitly.
|
|
282
|
+
|
|
283
|
+
### `run_state.json` Concurrency Safety
|
|
284
|
+
|
|
285
|
+
The backend now uses a per-run lock file to protect state writes. Atomic writes prevent partial files; the lock prevents common lost-update races between detach supervisors, CLI commands, and Web API actions.
|
|
286
|
+
|
|
287
|
+
Implemented shape:
|
|
288
|
+
|
|
289
|
+
- The lock file is `run_state.lock` inside the run directory.
|
|
290
|
+
- Lock acquisition uses exclusive file creation and stores `pid`, `runId`, and timestamp in the lock file.
|
|
291
|
+
- Stale locks can be recovered when the owning PID is gone and the lock is older than the stale threshold.
|
|
292
|
+
- Lock granularity is one run, so different runs do not block each other.
|
|
293
|
+
- State transition paths re-read the run inside the lock before mutating it.
|
|
294
|
+
|
|
295
|
+
Write paths under lock include:
|
|
296
|
+
|
|
297
|
+
- planner start and completion callback;
|
|
298
|
+
- dispatch;
|
|
299
|
+
- retry;
|
|
300
|
+
- stop;
|
|
301
|
+
- archive;
|
|
302
|
+
- rename;
|
|
303
|
+
- manual task completion;
|
|
304
|
+
- judge start and completion callback;
|
|
305
|
+
- refresh/recovery state materialization.
|
|
306
|
+
|
|
307
|
+
Risk notes:
|
|
308
|
+
|
|
309
|
+
- A stale-lock timeout that is too short can accidentally steal a lock from a slow or paused process; too long slows recovery.
|
|
310
|
+
- `child.onExit` callbacks must continue to take the write lock.
|
|
311
|
+
- If the repository ever moves to shared network storage, the current single-machine exclusive-file assumptions should be re-evaluated.
|
|
312
|
+
|
|
205
313
|
## Stop and Archive
|
|
206
314
|
|
|
207
315
|
### Stop
|
|
@@ -307,6 +415,7 @@ runs/<runId>/plan.json
|
|
|
307
415
|
runs/<runId>/planner/
|
|
308
416
|
runs/<runId>/planner_attempts/attempt-XX/
|
|
309
417
|
runs/<runId>/workers/<taskId>/
|
|
418
|
+
runs/<runId>/worker_attempts/<taskId>/attempt-XX/
|
|
310
419
|
runs/<runId>/judge/judge_input.json
|
|
311
420
|
runs/<runId>/workers/<taskId>/events_timed.jsonl
|
|
312
421
|
runs/<runId>/workers/<taskId>/manual_result.md
|
|
@@ -324,6 +433,7 @@ runs/<runId>/judge/verdict.json
|
|
|
324
433
|
- `POST /api/runs/:runId/plan`
|
|
325
434
|
- `POST /api/runs/:runId/dispatch`
|
|
326
435
|
- `POST /api/runs/:runId/judge`
|
|
436
|
+
- `POST /api/runs/:runId/retry`
|
|
327
437
|
- `POST /api/runs/:runId/stop`
|
|
328
438
|
- `POST /api/runs/:runId/archive`
|
|
329
439
|
- `PATCH /api/runs/:runId/label`
|
package/README.en.md
CHANGED
|
@@ -73,15 +73,21 @@ input-kanban submit --runs-dir ~/.input-kanban/runs --runner tmux -d
|
|
|
73
73
|
Check and stop:
|
|
74
74
|
|
|
75
75
|
```bash
|
|
76
|
+
input-kanban runs
|
|
77
|
+
input-kanban --json runs --active
|
|
76
78
|
input-kanban status
|
|
77
79
|
input-kanban status --watch
|
|
78
80
|
input-kanban status <runId> --watch
|
|
81
|
+
input-kanban --json status <runId>
|
|
79
82
|
input-kanban result
|
|
80
83
|
input-kanban result <runId> --copy
|
|
84
|
+
input-kanban --json result <runId>
|
|
85
|
+
input-kanban retry <runId> [taskId]
|
|
86
|
+
input-kanban --json retry <runId> [taskId]
|
|
81
87
|
input-kanban stop <runId>
|
|
82
88
|
```
|
|
83
89
|
|
|
84
|
-
Without a `runId`, `status` and `result` use the latest run by default. `result --copy` copies the final judge result. Stopping requires an explicit `runId` to avoid stopping the wrong run.
|
|
90
|
+
Use `runs` to discover visible run batches first; `runs --active` shows only runs that have not reached a terminal state or still have running tasks, which lets an agent find `runId` values before calling `status <runId>`. Without a `runId`, `status` and `result` use the latest run by default. `result --copy` copies the final judge result. `retry` preserves the failed attempt and retries failed/unknown tasks. `--json` is handy for agents/scripts that need structured output. Stopping requires an explicit `runId` to avoid stopping the wrong run.
|
|
85
91
|
|
|
86
92
|
## Common Startup Options
|
|
87
93
|
|
|
@@ -117,10 +123,10 @@ After run-level tmux metadata is available, the dashboard shows `Copy tmux attac
|
|
|
117
123
|
2. Enter a label, target repository, worker sandbox, and task description.
|
|
118
124
|
3. Click `Create Run`.
|
|
119
125
|
4. The dashboard automatically starts `Plan` so the Codex planner can generate batches and workers.
|
|
120
|
-
5.
|
|
121
|
-
6.
|
|
122
|
-
7.
|
|
123
|
-
8. Stop or archive a run when needed, or manually mark a confirmed failed/unknown worker as completed.
|
|
126
|
+
5. After planning completes, Web auto mode dispatches workers by batch barrier and concurrency limits by default.
|
|
127
|
+
6. After all batches complete, Web auto mode starts the final judge by default.
|
|
128
|
+
7. Inspect execution logs, final messages, error logs, and artifacts.
|
|
129
|
+
8. Stop or archive a run when needed, or manually click buttons to retry/advance, or manually mark a confirmed failed/unknown worker as completed.
|
|
124
130
|
|
|
125
131
|
## What It Is For
|
|
126
132
|
|
package/README.md
CHANGED
|
@@ -73,15 +73,21 @@ input-kanban submit --runs-dir ~/.input-kanban/runs --runner tmux -d
|
|
|
73
73
|
查看和停止:
|
|
74
74
|
|
|
75
75
|
```bash
|
|
76
|
+
input-kanban runs
|
|
77
|
+
input-kanban --json runs --active
|
|
76
78
|
input-kanban status
|
|
77
79
|
input-kanban status --watch
|
|
78
80
|
input-kanban status <runId> --watch
|
|
81
|
+
input-kanban --json status <runId>
|
|
79
82
|
input-kanban result
|
|
80
83
|
input-kanban result <runId> --copy
|
|
84
|
+
input-kanban --json result <runId>
|
|
85
|
+
input-kanban retry <runId> [taskId]
|
|
86
|
+
input-kanban --json retry <runId> [taskId]
|
|
81
87
|
input-kanban stop <runId>
|
|
82
88
|
```
|
|
83
89
|
|
|
84
|
-
|
|
90
|
+
`runs` 用来先列出可见任务批次,`runs --active` 只列出未进入终态或仍有子任务运行的批次,便于 agent 先发现 `runId`,再用 `status <runId>` 查详情。不传 `runId` 时,`status` 和 `result` 默认查看最近一次任务批次。`result --copy` 会复制最终验收结果;`retry` 会保留失败现场并重试失败/未知任务;`--json` 适合给 agent/脚本做结构化读取;停止任务请显式传入 `runId`,避免误停。
|
|
85
91
|
|
|
86
92
|
## 常用启动参数
|
|
87
93
|
|
|
@@ -117,10 +123,10 @@ tmux 模式是可选能力,主要用于在终端里实时查看每个 Codex
|
|
|
117
123
|
2. 输入批次名称、目标仓库、Worker 沙箱和任务说明。
|
|
118
124
|
3. 点击 `创建批次`。
|
|
119
125
|
4. 看板会自动发起 `拆分任务`,让 Codex planner 生成 batches 和 workers。
|
|
120
|
-
5.
|
|
121
|
-
6.
|
|
122
|
-
7.
|
|
123
|
-
8. 必要时可以停止或归档 run
|
|
126
|
+
5. 拆分完成后,Web 默认自动派发执行,按 batch barrier 和并发限制运行 workers。
|
|
127
|
+
6. 所有 batch 完成后,Web 默认自动发起 `汇总验收`。
|
|
128
|
+
7. 查看执行日志、最终回复、错误日志和产物。
|
|
129
|
+
8. 必要时可以停止或归档 run,也可以手动点击按钮重试、推进,或手动标记已确认完成的失败/未知 worker。
|
|
124
130
|
|
|
125
131
|
## 它适合做什么
|
|
126
132
|
|
package/RELEASE_NOTES.md
CHANGED
|
@@ -9,13 +9,15 @@
|
|
|
9
9
|
- Add CLI `-d` / `--detach` to run the auto loop in a background supervisor, plus `--no-auto` for create-and-plan-only mode.
|
|
10
10
|
- Add CLI `status [runId] [--watch]`, defaulting to the latest run when `runId` is omitted.
|
|
11
11
|
- Add CLI `result [runId] [--copy]` to print or copy the final judge result.
|
|
12
|
+
- Add CLI `retry <runId> [taskId]` and automatic one-shot retry for blocked batches while preserving failed worker attempts.
|
|
13
|
+
- Add per-run `run_state.lock` protection around state writes to reduce CLI/Web/supervisor lost-update races.
|
|
12
14
|
- Add CLI `stop <runId>` and make backend stop robust across CLI/Web processes by falling back to stored live PIDs.
|
|
13
15
|
- Derive the run label from task text when `--label` / form label is omitted.
|
|
14
16
|
- Add dashboard run-card archive confirmation without modal popups and replace the detail refresh text chips with a one-shot circle animation.
|
|
15
17
|
|
|
16
18
|
### Verification
|
|
17
19
|
|
|
18
|
-
- `npm run check` passed with
|
|
20
|
+
- `npm run check` passed with 58 tests.
|
|
19
21
|
|
|
20
22
|
## v0.0.7
|
|
21
23
|
|