deerflow2/backend/packages/harness/deerflow
Shawn Jasper 55474011c9
fix(subagent): inherit parent agent's tool_groups in task_tool (#2305)
* fix(subagent): inherit parent agent's tool_groups in task_tool

When a custom agent defines tool_groups (e.g. [file:read, file:write, bash]),
the restriction is correctly applied to the lead agent. However, when the lead
agent delegates work to a subagent via the task tool, get_available_tools() is
called without the groups parameter, causing the subagent to receive ALL tools
(including web_search, web_fetch, image_search, etc.) regardless of the parent
agent's configuration.

This fix propagates tool_groups through run metadata so that task_tool passes
the same group filter when building the subagent's tool set.

Changes:
- agent.py: include tool_groups in run metadata
- task_tool.py: read tool_groups from metadata and pass to get_available_tools()

* fix: initialize metadata before conditional block and update tests for tool_groups propagation

- Initialize metadata = {} before the 'if runtime is not None' block to
  avoid Ruff F821 (possibly-undefined variable) and simplify the
  parent_tool_groups expression.
- Update existing test assertion to expect groups=None in
  get_available_tools call signature.
- Add 3 new test cases:
  - test_task_tool_propagates_tool_groups_to_subagent
  - test_task_tool_no_tool_groups_passes_none
  - test_task_tool_runtime_none_passes_groups_none
2026-04-18 22:17:37 +08:00
..
agents fix(subagent): inherit parent agent's tool_groups in task_tool (#2305) 2026-04-18 22:17:37 +08:00
community fix(backend): fix uploads for mounted sandbox providers (#2199) 2026-04-14 10:44:31 +08:00
config fix: validate bootstrap agent names before filesystem writes (#2274) 2026-04-16 08:36:42 +08:00
guardrails feat(guardrails): add pre-tool-call authorization middleware with pluggable providers (#1240) 2026-03-23 18:07:33 +08:00
mcp fix(mcp): prevent RuntimeError from escaping except block in get_cach… (#2252) 2026-04-18 21:07:30 +08:00
models feat(config): add when_thinking_disabled support for model configs (#1970) 2026-04-09 18:49:00 +08:00
reflection refactor: split backend into harness (deerflow.*) and app (app.*) (#1131) 2026-03-14 22:55:52 +08:00
runtime feat: implement full checkpoint rollback on user cancellation (#1867) 2026-04-09 17:56:36 +08:00
sandbox fix(sandbox): add missing path masking in ls_tool output (#2317) 2026-04-18 08:46:59 +08:00
skills Implement skill self-evolution and skill_manage flow (#1874) 2026-04-06 22:07:11 +08:00
subagents feat(subagents): allow model override per subagent in config.yaml (#2064) 2026-04-12 16:40:21 +08:00
tools fix(subagent): inherit parent agent's tool_groups in task_tool (#2305) 2026-04-18 22:17:37 +08:00
tracing feat(tracing): add optional Langfuse support (#1717) 2026-04-02 13:06:10 +08:00
uploads feat(harness): integration ACP agent tool (#1344) 2026-03-26 14:20:18 +08:00
utils fix(uploads): handle split-bold headings and ** ** artefacts in extract_outline (#1838) 2026-04-04 14:25:08 +08:00
__init__.py refactor: split backend into harness (deerflow.*) and app (app.*) (#1131) 2026-03-14 22:55:52 +08:00
client.py feat: show token usage per assistant response (#2270) 2026-04-16 08:56:49 +08:00