diff --git a/CHANGELOG.md b/CHANGELOG.md index 0d83a0d..1b50c3a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,10 @@ Please choose versions by [Semantic Versioning](http://semver.org/). * MINOR version when you add functionality in a backwards-compatible manner, and * PATCH version when you make backwards-compatible bug fixes. +## Unreleased + +- fix: session-close Phase 5 no longer flags background processes from sibling sessions — candidates come from this conversation's `run_in_background` / `Monitor` calls, not a machine-wide `ps aux` scan; each session cleans up only its own daemons + ## v0.102.2 - fix(agent): `work-on-goal-assistant`'s batch status call now passes the goal in wikilink form (`--goal "[[Name]]"`). `task list --goal` matches the task's `goals:` frontmatter verbatim, so the bare name shipped in v0.102.1 returned `null` for every real goal — silently, since `null` is not an error. Correctness was preserved by the per-task fallback, but the batch path never fired, so the "one call instead of N reads" claim in v0.102.1 did not hold. Also documents the asymmetry with `goal set`, which takes the bare name, and tells the agent to treat `null` on a goal that lists task refs as a failed call rather than an empty goal. diff --git a/commands/session-close.md b/commands/session-close.md index f210fff..5af8099 100644 --- a/commands/session-close.md +++ b/commands/session-close.md @@ -167,17 +167,32 @@ Do not collapse failures into a generic warning — each unverified task is its ### Phase 5: Check for orphaned background processes +**Scope: THIS session's processes only.** Build the candidate list from the conversation, not from the process table — a machine-wide `ps` scan cannot tell a sibling session's daemon from your own, and flagging someone else's is a false positive that makes the verdict untrustworthy. + +Enumerate background work **this session started**: + +- Bash calls made with `run_in_background: true` in this conversation +- `Monitor` watches armed in this conversation +- Long-running foreground commands this session backgrounded explicitly + +If that list is empty → **skip this phase silently. Do NOT run `ps aux`.** + +Only for PIDs already on that list, confirm liveness: + ```bash -jobs -l 2>/dev/null -ps aux | grep -E '(dark-factory|daemon|watch)' | grep -v grep | head +ps -p -o pid=,etime=,command= 2>/dev/null ``` -If anything is still running that the user spawned this session, call it out. Don't kill anything without confirmation. +Report only those that are still alive. Don't kill anything without confirmation. + +**Never flag a process this session didn't spawn** — including `dark-factory daemon`, watchers, or dev servers belonging to sibling Claude sessions. Each session cleans up its own; another session's daemon is that session's business, and its `session-close` will handle it. ### Phase 6: Check for in-flight dark-factory work If `DARK_FACTORY` is absent OR no project in scope has a `.dark-factory.lock` file → skip silently. +"In scope" means a repo **this session touched** (Phase 1's `Repos` list). A dark-factory project this session never edited belongs to another session — skip it, even if its daemon is running. + Otherwise, check daemon status: ```bash @@ -356,7 +371,7 @@ Omit any line with zero entries. If nothing was touched (e.g. talk-only session) 1. : N uncommitted file(s) — 2. ~/.claude: untracked 3. Orphan worktree: ~/Documents/workspaces/ (branch , deleted from remote) — `git worktree remove ../` -4. dark-factory daemon (pid X) running in +4. dark-factory daemon (pid X) — spawned by THIS session, still running in 5. Link hygiene: [[]] orphaned — add backlink from [[]] 6. Consider /vault-cli:reflect — N knowledge file(s) created, org-level decisions captured 7. Consider /coding:self-improve — N friction signal(s): general correction, command misfire