From e498bf07432a246cca0eb454b4a7acb8309c57c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Igor=20=C5=A0=C4=87eki=C4=87?= Date: Tue, 28 Jul 2026 14:45:31 +0200 Subject: [PATCH 1/9] docs(workflow): record dispatch-role tmux session targeting trap --- ...role-outside-tmux-targets-wrong-session.md | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 .kilo_workflow/learnings/dispatch-role-outside-tmux-targets-wrong-session.md diff --git a/.kilo_workflow/learnings/dispatch-role-outside-tmux-targets-wrong-session.md b/.kilo_workflow/learnings/dispatch-role-outside-tmux-targets-wrong-session.md new file mode 100644 index 0000000000..7d101bf8c9 --- /dev/null +++ b/.kilo_workflow/learnings/dispatch-role-outside-tmux-targets-wrong-session.md @@ -0,0 +1,20 @@ +# dispatch-role.sh lands in a foreign session when invoked outside tmux + +- Symptom: a dispatched role agent (plan-reviewer, implementer, impl-reviewer) appears as a + window in **another** workflow run's tmux session, so its dispatcher cannot see it, and the + foreign run's monitor sees a window it did not start. +- Cause: `dispatch-role.sh` targets `tmux new-window -t "$(tmux display-message -p '#S')"`. With + no client attached to the caller's session — e.g. a Claude Code starter/planner driving the run + from a plain shell — `display-message` resolves against tmux's most-recently-used session, which + is whatever another run last attached to. The `e2e-verifier` path is unaffected (it creates its + own session by name). +- Fix: never call `dispatch-role.sh` from a shell outside the section's own session. Launch it + through the section session so `$TMUX` is set inside the calling pane: + + ```bash + tmux new-window -d -t "$SECTION" -n "dispatch-$ROLE-$LABEL" \ + "cd $WT && .kilo_workflow/dispatch-role.sh $ROLE $SECTION $LABEL $WT $SCRATCH 'Review …' --file $SCRATCH/plan.md" + ``` + + The log path is deterministic (`$SCRATCH/-