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:
- 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.
- 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.
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 eachwatch.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:
project + type(the argv already carries<type>), orproject + session, so reconfiguring one agent's delivery leaves sibling agents' monitors in the same project alone.monitor=notypes (e.g. the new grok-build type) have nowatch.shwatcher at all, yetsetstill 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):Suggested fix
kill_all_watchersmatching toproject + type(orproject + session), not project alone.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.