Skip to content

delivery.sh set tears down sibling watchers (kill scoped by project only, and runs for no-watcher rule-file types) #218

Description

@fujibee

Problem

delivery.sh set <mode> <type> <project> tears down watchers belonging to other agents / other concurrent sessions of the same project, not just the one whose delivery mode is changing.

kill_all_watchers "$PROJECT" scopes the kill by project path only (it matches the <project> field in each watch.sh <session_id> <project> <type> [name] argv). In a setup where multiple agents share one project directory, changing delivery for agent/type B kills agent/type A's live monitor too. The inline comment claims it "never tears down ... another concurrent session's monitor", but a same-project different-session watcher is matched and killed.

Two issues:

  1. Scope too wide. The teardown should be keyed on project + type (the argv already carries <type>), or project + session, so reconfiguring one agent's delivery leaves sibling agents' monitors in the same project alone.
  2. Runs for no-watcher delivery types. Rule-file / monitor=no types (e.g. the new grok-build type) have no watch.sh watcher at all, yet set still invokes the generic watcher teardown — so it is pure collateral: it can only kill other types' watchers in the project.

Repro

In one project dir with two agents joined (agent A = a monitor type with a live watch.sh; agent B = any type):

delivery.sh set turn <typeB> <project>
# -> agent A's monitor watch.sh is killed

Suggested fix

  • Scope kill_all_watchers matching to project + type (or project + session), not project alone.
  • Skip the watcher teardown entirely for types whose manifest is monitor=no (rule-file delivery) — they own no watcher.

Surfaced while dogfooding the grok-build type (rule-file delivery): delivery.sh set turn grok-build <project> killed an unrelated Claude Code monitor running in the same project.

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedExtra attention is needed

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions