Skip to content

Render pipeline broken when agent-shell-dispatch-start is called via emacsclient #2

Description

@vleonbonnet

Summary

When agent-shell-dispatch-start is called via emacsclient --eval (which is how the dispatch skill instructs agents to set up), three issues prevent the task graph from rendering:

Bug 1: Buffer-local render state set in wrong buffer

agent-shell-dispatch-render-set-tasks sets agent-shell-dispatch-render--ctx and agent-shell-dispatch-render--task-defs, which are defvar-local. When called via emacsclient, the current buffer is " *server*", not the dispatcher's agent-shell buffer. So the render context is created in the wrong buffer.

The with-current-buffer at the end of agent-shell-dispatch-start enables agent-shell-dispatch-render-mode, but the mode's body checks agent-shell-dispatch-render--ctx (line 1136) — which is nil in the dispatcher buffer — and immediately disables itself.

Fix: Move agent-shell-dispatch-render-set-tasks and all the setq calls for render variables inside the with-current-buffer block.

Bug 2: agent-shell-dispatch-render-mode variable not created with native compilation

define-minor-mode doesn't create the mode variable when the package is native-compiled. Calling (agent-shell-dispatch-render-mode 1) silently fails — the variable stays nil.

Workaround: Add (defvar agent-shell-dispatch-render-mode nil) before the minor mode is used. Same issue exists for agent-shell-dispatch-global-mode (already worked around with agent-shell-dispatch--global-dummy).

Bug 3: Dispatcher buffer detection in SKILL.md

The dispatch skill instructs the agent to register as dispatcher with:

(setq agent-shell-dispatch--primary-buffer (buffer-name))

(buffer-name) returns " *server*" when evaluated via emacsclient, not the agent's buffer. This causes permissions and the task graph to render in the wrong buffer.

Fix: PR #1 addresses this by using (buffer-name (window-buffer (selected-window))), though this is also fragile if the user has switched windows.

Environment

  • Emacs 30.2.50 (native-compiled, macOS)
  • agent-shell-dispatch @ 475fd96

🤖 Generated with Claude Code

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions