@oisin-ee/pi-dogsled 0.13.1 → 0.14.0

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 CHANGED
@@ -11,13 +11,13 @@ Install the binary on each Herdr host. Use the same release tag in each command.
11
11
  Binary:
12
12
 
13
13
  ```sh
14
- mise use github:oisin-ee/dogsled@v0.13.0
14
+ mise use github:oisin-ee/dogsled@v0.14.0
15
15
  ```
16
16
 
17
17
  Pi (extension, tools, and skill), from npm or as part of `@oisin-ee/oisinpi`:
18
18
 
19
19
  ```sh
20
- pi install npm:@oisin-ee/pi-dogsled@0.13.0
20
+ pi install npm:@oisin-ee/pi-dogsled@0.14.0
21
21
  ```
22
22
 
23
23
  At session start the extension compares its version with `dogsled --version` and warns when they differ.
@@ -25,14 +25,14 @@ At session start the extension compares its version with `dogsled --version` and
25
25
  Claude Code (hooks, tools, and skill):
26
26
 
27
27
  ```sh
28
- claude plugin marketplace add oisin-ee/dogsled#v0.13.0
28
+ claude plugin marketplace add oisin-ee/dogsled#v0.14.0
29
29
  claude plugin install dogsled@dogsled
30
30
  ```
31
31
 
32
32
  Codex (hooks, tools, and skill):
33
33
 
34
34
  ```sh
35
- codex plugin marketplace add oisin-ee/dogsled --ref v0.13.0
35
+ codex plugin marketplace add oisin-ee/dogsled --ref v0.14.0
36
36
  codex plugin add dogsled@dogsled
37
37
  ```
38
38
 
@@ -42,7 +42,7 @@ The [Codex CLI reference](https://developers.openai.com/codex/cli/reference#code
42
42
  Herdr (status-board popup):
43
43
 
44
44
  ```sh
45
- herdr plugin install oisin-ee/dogsled --ref v0.13.0 --yes
45
+ herdr plugin install oisin-ee/dogsled --ref v0.14.0 --yes
46
46
  ```
47
47
 
48
48
  Harness plugins use the binary on `PATH`. They do not install it or start host services.
@@ -156,7 +156,7 @@ dogsled close w9:p1 --host netcup --json
156
156
  `close` ends a child now, for an owner who does not want to wait for the sweep. `--host` defaults to the host of the pane's open item, else local.
157
157
  In an agent worktree (locked `agent:worktree`, as dogsled makes them), it runs the repository's `teardown` commands in the worktree (see [Repository configuration](#repository-configuration)).
158
158
  Then it closes every pane that uses the worktree and the Herdr workspace that shows it, unlocks the worktree, and runs `git worktree remove` without force.
159
- It deletes the branch only when dogsled's integration check finds it integrated (see [Cleanup](#cleanup)). An unmerged branch, or a branch still at the base tip, stays.
159
+ Close uses the same loss rule as cleanup: a clean checkout and every commit held by the default branch or freshly fetched remote refs. It deletes the branch under that same rule. Local-only work refuses close, including an explicit owner close.
160
160
  When `place` opened the main checkout's workspace as the anchor and no linked worktree is open in Herdr any more, close closes that anchor too. It does so only while the anchor is unfocused, is not the caller's, and has one pane with no agent.
161
161
  A pane outside a worktree, or in an unlocked worktree (someone's own checkout), is closed alone; the checkout stays.
162
162
  A child tab in the caller's own workspace is closed. Close refuses a missing pane, the caller's own pane, a worktree the caller works in or whose workspace is the caller's, a worktree outside the repository's worktree directory, a dirty or detached worktree, and any other lock.
@@ -204,7 +204,7 @@ A host that cannot be read shows `retry in 40s` on the board. `dogsled retry HOS
204
204
  Run `dogsled serve` on every host. Dotfiles owns launchd and systemd user-service installation.
205
205
  The measurement step uses no SSH. It reads CPU busy time, cores, memory, home disk space, Herdr agents, and Herdr panes.
206
206
  When it has owned items or tickets, the service reads peers through the status cache and can launch admitted work through SSH.
207
- Separate watchdog, admission, sweep, and inbox workers keep check-ins, slow setup, cleanup, and delivery independent from snapshot publication. Routine calls and lock waits have 30-second limits. Setup calls have a 10-minute limit.
207
+ Separate watchdog, admission, child-completion, inbox, and requested-cleanup workers keep slow actions independent from snapshot publication. Routine calls and lock waits have 30-second limits. Setup calls have a 10-minute limit.
208
208
  An admission timeout records a failed ticket. The service continues publication and later actions.
209
209
  It writes `~/.local/state/dogsled/host.json` through atomic replacement.
210
210
  Each `probe.agent_panes` entry contains `pane`, `agent`, `state`, `name`, `transcript`, `transcript_modified`, `terminal_id`, `completion_seq`, `cwd`, the session's model and latest activity, and the worktree's branch, commits ahead, dirty state, and whether it landed.
@@ -294,18 +294,21 @@ dogsled prune targets
294
294
 
295
295
  Doctor changes no candidates. It reports `worktrees`, `branches`, `workspaces`, `panes`, `jobs`, `targets`, `disk`, `processes`, and `repositories`.
296
296
  Doctor lists linked worktrees on a branch and detached ones.
297
- A removable worktree has a HEAD that has not moved more than 24 hours after Git made it and no commits beyond the base, or an integrated branch.
298
- A detached worktree is removable when it is clean, no pane holds it, and a remote branch holds its HEAD. Otherwise doctor reports its commits on no remote. A worktree whose HEAD has not moved is not integrated, even when its base moved past it. It also needs a clean tree, no foreign lock, and no pane that uses it.
299
- A worktree whose branch has unmerged commits and that no pane uses is report-only. Doctor shows the commits ahead, how many are on no remote, and the age of the last commit.
297
+ One loss rule in `src/loss.rs` governs worktrees, detached HEADs, branches, close, and board facts.
298
+ A checkout must have no tracked or untracked changes. Ignored files do not count. A ref without a checkout skips this condition.
299
+ Every commit must be held by the default branch or remote-tracking refs. Each cleanup pass runs `git fetch --all --prune` before remote refs count.
300
+ A failed fetch produces a repository warning. Only the default branch counts for that repository. Deleted upstream branches receive no special treatment.
300
301
  A branch is integrated when it is deleted, when it is an ancestor of Git's remote default branch (local `main` is the fallback), or when commits on that branch apply it.
301
302
  The branch's commits split into consecutive runs, and each run needs one commit that applies it. A commit applies a run when it changes every path the run changed, and merging the run into the commit's parent gives the commit's content on those paths.
302
303
  One run is a merge, squash, or cherry-pick of the whole branch. Several runs are a stack: the branch holds an earlier branch's commits, and each branch landed as its own squash. Git alone decides this.
303
304
  Each path merges on its own. An addition, deletion, or mode change on a path the base also changed differently is a conflict, and renames are not followed, so a doubtful run is not applied.
304
305
  Results use the remote-tracking branch, so `git fetch` keeps them current.
305
306
  A local branch with no worktree is removable when it is integrated or every commit is on a remote branch. Other branches are report-only. The default branch is never a candidate. Prune deletes a branch with `git branch -D` after it rechecks the planned commit.
306
- A pane holds a worktree when it works in it or sits in its workspace. A shell with no foreground command does not hold it.
307
- An agent holds it until it has been `idle` or `done` for 24 hours. Before that, the sweep closes a finished child that has nothing left to land.
308
- Held, dirty, and locked integrated worktrees are reported with the reason and are not removed.
307
+ Prune and the sweep share the same holds: active panes or processes, the caller, an unreadable process table, and pending preparations or launches.
308
+ An open agent item holds its checkout in prune and the sweep; `close` ends it and keeps the reply. Within `close`, a live owner holds the checkout until the default branch holds its work.
309
+ An idle shell, an idle or done agent without an open item, and a workspace alone are not holds. The processes of an idle agent pane are not holds, but a background job that a shell started is. Foreign locks still prevent removal.
310
+ A dirty checkout whose commits are in the default branch gets a `landed_dirty` finding when no hold applies.
311
+ The finding includes the repository, checkout, branch or HEAD, dirty-path count, and up to ten paths. It is never removable.
309
312
  A registered worktree whose directory is gone is a stale registration. Prune drops the record only.
310
313
  A shell with no foreground command in an ended job's tab is idle at once: the job log keeps its output. So is a shell whose directory no longer exists.
311
314
  Other panes need more than 24 hours continuously idle or done, based on service observations and a fresh snapshot.
@@ -318,30 +321,39 @@ Prune removes it after it checks the tag again. A worktree that the same plan re
318
321
  Processes above 100% CPU outside Herdr pane ancestry are report-only. Prune never kills processes or frees arbitrary disk paths.
319
322
 
320
323
  Prune displays a plan and asks before removal. `--yes` skips that question, not safety checks.
321
- Each removal rechecks current state. Working or blocked panes, held worktrees, dirty worktrees, and unintegrated branches remain untouched.
324
+ Each removal rechecks current state. Working or blocked panes, held worktrees, dirty worktrees, and local-only commits remain untouched.
322
325
  Removal rechecks Git path, branch, HEAD, and repository against the approved plan. Any identity change stops removal.
323
- Worktree removal is the same as `close`: `teardown`, the panes and workspace, unlock, `git worktree remove`, the branch when integrated, and the idle anchor. Dogsled checks that the worktree is gone afterwards.
326
+ Worktree removal is the same as `close`: `teardown`, the panes and workspace, unlock, `git worktree remove`, the branch when its commits are held, and the idle anchor. Dogsled checks that the worktree is gone afterwards.
324
327
  Each entry is independent. A failed or refused entry does not stop the others; prune reports each failure, then exits with status 2.
325
328
  `--json` returns `{results,failures}`. A result names the removed path and the closed panes. A failed `teardown` command's error includes its last lines of output.
326
329
 
327
330
  Placement records repositories in `repositories.json`, independently of `worktrees.json`. Repository registrations survive the last worktree removal.
328
331
  Doctor also discovers repositories from the caller, live pane directories, Herdr workspaces, and `cleanup.repositories`. It never scans the whole home directory.
329
- A configured path that is not a Git checkout is a report-only `repositories` entry.
332
+ A missing or unreadable repository produces a report-only `repositories` warning. The warning names its registration or configuration, and the survey continues.
333
+ Repository registrations stay unchanged.
330
334
  ### The sweep in `serve`
331
335
 
332
336
  The sweep closes finished children (see [Items and closing](#items-and-closing)), and a job closes its own tab. That closed loop ends most work.
333
337
  The sweep catches what a broken loop leaves behind: a crashed owner, a killed process, or a worktree that something else made.
334
- On each pass, the service's sweep worker builds the doctor plan in sweep scope. It applies only entries whose removal loses nothing:
338
+ The Stop gate writes `sweep-request.json` and wakes the local service through `sweep.sock`. It never runs the survey inside the hook.
339
+ The service checks the durable request at startup, on notification, and on each publication iteration. No request means no survey.
340
+ The socket is optional. A bind failure produces a warning, and pending requests still reach the worker on the publication interval.
341
+ A Stop request failure produces a warning without preventing existing gate or inbox messages from reaching the agent.
342
+ Each requested pass builds the doctor plan in sweep scope. It applies only entries whose removal loses nothing:
335
343
 
336
344
  - `panes` and `workspaces`: a shell at an empty prompt in an ended job's tab, or in a directory that no longer exists. A workspace closes whole when every pane in it is one of these.
337
- - `worktrees`: a clean worktree whose branch is integrated, or a clean detached worktree whose HEAD is on a remote branch. Nothing may hold it: no pane works in it, no workspace shows it, and no process works in it. An idle shell holds it too.
338
- - `branches`: a local branch with no worktree whose every commit is on a remote ref. An integrated branch with commits on no remote waits for `prune`.
339
- - Orphaned children: an open agent item whose owner pane no longer exists, whose child is `idle` or `done`, whose worktree is clean, and whose every commit is on a remote ref. The sweep closes it as `dogsled close` does: `teardown`, the workspace, the worktree, and the item. A remote child closes over SSH with `host close --pushed`.
345
+ - `worktrees` and `branches`: the shared loss rule and holds described above, identical to prune.
346
+ - Orphaned children: an idle or done child whose owner is gone and whose checkout passes the shared loss rule. Close runs teardown and removes its workspace, checkout, and item.
340
347
 
341
348
  The sweep runs the same checks as `close` and `prune`. It never closes the service's own pane or workspace, or a worktree that the service works in. It skips a worktree it cannot check, and a failure on one entry does not stop the others.
342
- Each removal is a `dogsled sweep:` line on stderr, the service journal.
349
+ The service keeps seven days of completed passes in `sweeps.jsonl` and the latest pass in `sweep.json`.
350
+ Each history entry has a `ts_ms` timestamp; each new pass removes entries older than seven days.
351
+ The report includes start and finish times, removals, failures, repository warnings, and landed-dirty findings.
352
+ `dogsled status` and `status --json` show the latest pass. Prompt context adds one summary line when that pass has errors or warnings.
353
+ The service also writes removals, failures, and repository warnings to stderr.
354
+ Child completion and orphan checks remain independent of requested doctor cleanup.
343
355
  An orphan that is dirty, unpushed, `working`, `blocked`, or on an unreachable host stays open. Status shows `orphaned:` and the reason on its item line, the brief counts it, and every check-in on the host lists it.
344
- Everything else is for a confirmed `prune`: idle shells and agents after a day, a worktree with no commits a day after it was made, integrated branches with unpushed commits, ended jobs, stale registrations, and `targets`. Disk, process, and repository findings are report-only.
356
+ Prune also handles idle panes after a day, ended jobs, stale registrations, and `targets`. Disk, process, and repository findings are report-only.
345
357
 
346
358
  ## Placement
347
359
 
@@ -460,6 +472,14 @@ Claude Code and Codex include the reminder in their existing `Stop` inbox respon
460
472
  The reminder requests a review, a commit from dirty children, integration, or an explicit blocker or deferral.
461
473
  It never commits, merges, closes, or discards work itself. Clean readers and working children do not trigger it.
462
474
 
475
+ The gate reports failures, repository warnings, and landed-dirty findings from the latest completed pass, without waiting for the requested pass.
476
+ Successful removals remain in status and the journal; they do not continue an agent turn.
477
+ Repository warnings name the repository and state entries, and request delegation to a dogsled agent instead of manual state edits.
478
+ Landed-dirty findings reach only panes in the same main repository, including linked worktrees and symlink paths.
479
+ The message asks the owner to read and preserve wanted changes, or obtain user approval before discarding abandoned work.
480
+ It forbids forced worktree removal, `git clean`, and `rm -rf` on the checkout.
481
+ Cleanup reminders use separate, once-per-set histories in `gate.json`, so an unchanged warning cannot cause a continuation loop.
482
+
463
483
  The gate records each set of child item IDs, commit counts, and dirty states in `gate.json`.
464
484
  It continues once per distinct set, across process restarts. Row order and idle/done transitions do not cause another reminder.
465
485
  New states can trigger another reminder. Closing all owner items clears the history.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oisin-ee/pi-dogsled",
3
- "version": "0.13.1",
3
+ "version": "0.14.0",
4
4
  "description": "Pi extension for dogsled: the board, the /dogsled panel, the inbox reader, and the dogsled tools. Needs the dogsled binary of the same version.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -63,7 +63,8 @@ Blocked and working children never close, and nothing closes on a timer. To end
63
63
  dogsled close PANE [--host HOST]
64
64
  ```
65
65
 
66
- It runs the repository's `teardown`, closes the panes and workspace that use the worktree, removes the worktree, and ends the item. It deletes the branch only when it is integrated. A child in an unlocked checkout loses only its pane.
66
+ Close, prune, and the sweep use one loss rule: a clean checkout and every commit held by the default branch or freshly fetched remote refs. Ignored files do not count. A failed fetch disables remote-ref evidence for that repository.
67
+ Close runs `teardown`, closes the panes and workspace, removes the checkout, and ends the item. The same loss rule governs branch deletion. A child in an unlocked checkout loses only its pane.
67
68
  It refuses, before it changes anything, a busy agent, a dirty or detached worktree, a foreign lock, your own pane, and a worktree you work in. Report a refusal; do not remove a worktree by hand.
68
69
 
69
70
  ## Run a job
@@ -100,8 +101,10 @@ dogsled doctor --host HOST --json
100
101
  dogsled prune --host HOST worktrees jobs
101
102
  ```
102
103
 
103
- Doctor is read-only. Prune shows candidates and asks; `--yes` skips only the question. Never use cleanup to close working or blocked agents.
104
- `serve` sweeps only what loses nothing: ended job tabs, shells in deleted directories, clean integrated worktrees that nothing holds, fully pushed branches, and orphaned children (owner gone, idle or done, clean, pushed).
104
+ Doctor removes nothing, but refreshes remote refs. Prune shows candidates and asks. `--yes` skips only the question. Never close working or blocked agents through cleanup.
105
+ Worktrees, detached HEADs, branches, and orphan close use the loss rule in Closing. Prune and the sweep use identical worktree and branch decisions.
106
+ Holds protect active panes or processes, the caller, open agent items (only `close` ends them; a live owner also holds until landing), and pending preparations or launches. An unreadable process table also holds worktrees. An idle shell, an idle agent's own processes, or a workspace alone does not.
107
+ Doctor reports unheld dirty checkouts whose work is in the default branch as `landed_dirty`, with up to ten dirty paths. Missing repositories produce warnings, and the survey continues.
105
108
 
106
109
  ## Hosts
107
110