Trust mode isn't propagated to running subagents
To upvote this issue, give it a thumbs up. See this list for the most upvoted issues.
Please avoid AI slops, be concise, and focus on what matters for this issue.
Describe the bug
When I enable trust-mode when subagent runs, it is not respected.
To Reproduce
Steps to reproduce the behavior:
- Start a subagent
- Enable trust mode
- Tools still ask for approval
Expected behavior
Trust mode is respected in any running subagent.
I traced the code path to find the root cause. The issue is in src/eca/features/tools/agent.clj in the spawn-agent function.
The bug: When a subagent chat is created (around line 155-172), the chat record is initialized without copying :trust from the parent:
(swap! db* assoc-in [:chats subagent-chat-id]
(cond-> {:id subagent-chat-id
:parent-chat-id chat-id
:agent-name agent-name
:subagent subagent
:current-step 0}
max-steps-limit (assoc :max-steps max-steps-limit)))
The trust value IS available at the call site — it is destructured from the chat context on line 127:
[arguments {:keys [db* config messenger metrics chat-id tool-call-id call-state-fn trust]}]
But it never propagates into the subagent chat record.
Why it breaks: Later, during tool call execution (tool_calls.clj lines 832/881):
:trust (get-in @db* [:chats chat-id :trust])
This reads :trust from the subagent chat — which is nil because it was never set. So every subagent tool call falls through to full approval.
The fix: Add :trust trust to the subagent chat initialization:
(swap! db* assoc-in [:chats subagent-chat-id]
(cond-> {:id subagent-chat-id
:parent-chat-id chat-id
:agent-name agent-name
:subagent subagent
:current-step 0
:trust trust}
max-steps-limit (assoc :max-steps max-steps-limit)))
One-liner fix. The same pattern applies to any other per-chat settings that should cascade to subagents.