eca icon indicating copy to clipboard operation
eca copied to clipboard

Trust mode isn't propagated to running subagents

Open zikajk opened this issue 5 months ago • 1 comments

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:

  1. Start a subagent
  2. Enable trust mode
  3. Tools still ask for approval

Expected behavior

Trust mode is respected in any running subagent.

zikajk avatar Jun 17 '26 14:06 zikajk

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.

cschanhniem avatar Jun 19 '26 06:06 cschanhniem