-
Notifications
You must be signed in to change notification settings - Fork 0
Reactions leak into background task lane via shared IPC input directoryΒ #84
Description
Bug
When a reaction arrives while a background task is running, the reaction message gets piped into the background task's active agent query instead of only reaching the message lane.
Observed behavior
Logs from a session where the task lane was running an accessibility audit and a π reaction came in:
[agent-runner] [msg #98] tool=Bash grep -n "sr-only" ... β task lane working
[agent-runner] [msg #99] type=user
Reaction on bot message in Discord β reaction arrives
[agent-runner] Piping IPC message into active query (164 chars) β LEAKED into task
[agent-runner] [msg #10] type=system/init β message lane also spins up
[agent-runner] Session initialized: 47c712a1-...
The reaction was handled by both:
- A new message-lane session (correct) β responded with
<internal>no-response - The running task-lane agent (incorrect) β piped in via IPC, agent happened to ignore it
Expected behavior
Reactions (and all message-lane IPC) should only reach the message-lane container, never the task-lane container.
Root cause
queue.sendMessage() writes to the input/ IPC directory. Task containers are supposed to be isolated via an overlaid mount (input-task/ β /workspace/ipc/input/), but the reaction message still reached the task container's active query.
Relevant code:
- Host write:
group-queue.ts:231βsendMessage()writes todata/ipc/{folder}/input/ - Mount setup:
local-backend.ts:147-162β task containers mountinput-task/overinput/ - Container read:
agent-runner/src/index.ts:512-516βdrainIpcInput()polls/workspace/ipc/input/
The mount overlay (input-task/ β /workspace/ipc/input/) may not fully isolate the directories, possibly due to Apple Container mount ordering or timing.
Impact
- Low severity now: Reactions generate short messages the agent tends to ignore
- High severity potential: If a user sends a real message while a task is running, the message content could be injected into the task agent's context, causing it to act on unrelated instructions mid-task
Possible fixes
- Verify mount isolation: Debug whether the Apple Container overlaid mount actually shadows
input/for task containers β may needcontainer execto confirm - Separate directory trees entirely: Instead of mount overlays, use completely separate IPC root dirs per lane (e.g.,
ipc-message/andipc-task/) and pass the path via env var to the agent-runner - Lane-aware IPC polling: Add a
NANOCLAW_IPC_LANEenv var so the agent-runner knows which subdirectory to poll, rather than hardcoding/workspace/ipc/input