From a99f28b07e3a82ad8121d7bdd19bc171fbaea25c Mon Sep 17 00:00:00 2001 From: Dasemu Date: Mon, 16 Nov 2026 18:17:42 +0100 Subject: [PATCH] docs: document busy marker, readiness and inotify limits Co-Authored-By: Claude Sonnet 5.5 --- docs/phase2.md | 2 +- docs/phase6.md | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/docs/phase2.md b/docs/phase2.md index 5b3932d..219696b 100644 --- a/docs/phase2.md +++ b/docs/phase2.md @@ -59,7 +59,7 @@ socket is refused; a stale socket file left by a crash is replaced. JSON lines in `/activity.jsonl` (rotated at 5 MiB to `.jsonl.1`), the last 500 events in memory, and live via `subscribe`. Kinds: `start`, `stop`, `snapshot`, `fast_forward`, `applied`, -`declined`, `snapshots_withheld`, `snapshots_enabled`, `snapshots_purged`, `state` (worktree state changed), `materialized`, `archived`, `repo_added`, `repo_removed`, `error`, `watch_error`, +`declined`, `snapshots_withheld`, `snapshots_enabled`, `snapshots_purged`, `state` (worktree state changed), `materialized`, `archived`, `repo_added`, `repo_removed`, `repo_stalled`, `error`, `watch_error`, `pause`, `resume`. ## CLI diff --git a/docs/phase6.md b/docs/phase6.md index c01ef27..7257ed3 100644 --- a/docs/phase6.md +++ b/docs/phase6.md @@ -89,6 +89,20 @@ a clone moved to the trash) triggers a debounced (500 ms) rediscovery and diff: while a pass runs is dropped the same way. - The "not migrated" list is refreshed. +A repo is only picked up when it is **ready**: `.bare/HEAD` exists, there is no `.grove-busy` and no +`.grove-stage`. `grove add`, clone/import and init hold `/.grove-busy` (pid + start time) from +before their first change until their very last step, also on rollback, so the daemon never +fetches, materializes or snapshots a half-built layout (e.g. a `--no-checkout` worktree whose files +are still in `.grove-stage`). Creating or removing `.grove-busy` / `.grove-stage` triggers a +rediscovery, so the repo is picked up as soon as the marker goes. A marker whose process is gone +(or a leftover `.grove-stage`) means an interrupted operation: the repo stays unmanaged, the daemon +logs one `repo_stalled` warning to check it and restore from the backups, and never deletes the +marker. `pass` re-checks readiness and skips unready repos. Clones are not built in a temp dir and +renamed, because worktree link files hold absolute paths. + +Managed repos are watched recursively, including `node_modules` / `target`; notify cannot exclude +subtrees, so raise `fs.inotify.max_user_watches` on machines with many large repos. + As a safety net every full pass (every `fetch_interval_s`) re-runs discovery too, so missed inotify events delay detection by at most that interval. `grove daemon status` reflects the new set right after rediscovery, also while paused (discovery runs while paused, syncing does not).