Repository navigation
Conversation
There was a problem hiding this comment.
Hey - I've found 4 issues
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="astrbot/core/astr_agent_tool_exec.py" line_range="303" />
<code_context>
+ # plugin tools, so builtin tool names never appear in `tools`).
toolset = ToolSet()
+ for runtime_tool in runtime_computer_tools.values():
+ toolset.add_tool(runtime_tool)
+ unknown_names: list[str] = []
+ inactive_names: list[str] = []
</code_context>
<issue_to_address>
**Whitelist grants extra capabilities**
When computer-use runtime is enabled and a subagent has a non-empty whitelist that intentionally omits runtime tools, the whitelist-built handoff toolset receives every runtime computer-use tool before checking the selected names, so a user who triggers a subagent configured with only a benign plugin can still have it use runtime capabilities such as sandbox file access; the configured whitelist no longer limits those tools.
Keep runtime tools available only when explicitly permitted by the subagent policy, or introduce a separate setting that clearly opts a subagent into them.
</issue_to_address>
### Comment 2
<location path="astrbot/core/astr_agent_tool_exec.py" line_range="302-303" />
<code_context>
+ # even when the whitelist cannot name them (the dashboard only lists
+ # plugin tools, so builtin tool names never appear in `tools`).
toolset = ToolSet()
+ for runtime_tool in runtime_computer_tools.values():
+ toolset.add_tool(runtime_tool)
+ unknown_names: list[str] = []
+ inactive_names: list[str] = []
</code_context>
<issue_to_address>
**Disabled builtin tools stay callable**
When a runtime computer-use builtin is deactivated and a subagent has a non-empty whitelist, `_build_handoff_toolset` adds each runtime tool without checking `active`; the full-schema path advertises it and the runner can execute it. A deactivated builtin therefore remains available to the subagent despite the whitelist path’s inactive-tool handling.
Only seed active runtime tools into the whitelist toolset.
</issue_to_address>
### Comment 3
<location path="astrbot/core/astr_agent_tool_exec.py" line_range="294" />
<code_context>
if not tools:
return None
</code_context>
<issue_to_address>
**Empty whitelist skips tool setup**
When the subagent whitelist is empty, `_build_handoff_toolset` returns at `if not tools` before seeding runtime tools or reaching the empty-toolset warning, so the caller gets no tools and the missing capabilities are not logged.
Let an empty whitelist continue through toolset construction so runtime tools are seeded and an empty result reaches the warning.
Also at `astrbot/core/astr_agent_tool_exec.py:297-303`, `astrbot/core/astr_agent_tool_exec.py:332-336`.
</issue_to_address>
### Comment 4
<location path="astrbot/core/astr_agent_tool_exec.py" line_range="302-303" />
<code_context>
+ # even when the whitelist cannot name them (the dashboard only lists
+ # plugin tools, so builtin tool names never appear in `tools`).
toolset = ToolSet()
+ for runtime_tool in runtime_computer_tools.values():
+ toolset.add_tool(runtime_tool)
+ unknown_names: list[str] = []
+ inactive_names: list[str] = []
</code_context>
<issue_to_address>
**Whitelisted subagents still lose browser tools**
When a subagent uses a non-empty persona whitelist and its sandbox runtime supports browser tools, `_get_runtime_computer_tools` omits the sandbox browser tools, so this seed loop never adds them to a whitelisted subagent. Browser tasks then have no browser tools to call, even when the sandbox supports them.
Include the browser tools in the subagent runtime tool set when the sandbox supports them, matching the main agent's capability check.
</issue_to_address>Sourcery assessment
Needs a human reviewer. 4 findings to address first, and this changes the subagent permission boundary by making configured computer-use tools available even when the persona whitelist omits them, potentially enabling shell or code execution that the whitelist was intended to prevent. Reverting stops future access but cannot undo commands, data exposure, or other side effects that occurred while the broader toolset was active.
Blocking findings: astrbot/core/astr_agent_tool_exec.py:303, astrbot/core/astr_agent_tool_exec.py:303, astrbot/core/astr_agent_tool_exec.py:294, astrbot/core/astr_agent_tool_exec.py:303
…g misses A persona tool whitelist on a subagent silently stripped the builtin execution tools. The main agent applies the runtime computer-use tools after the persona whitelist narrowing and never routes them through the whitelist, so a whitelist only narrows plugin/MCP tools there. The subagent handoff built its toolset from the whitelist alone, and since the dashboard checkbox UI only lists plugin tools, builtin names never appear in the list and the subagent lost shell, python and file access entirely. Seed the whitelist-built toolset with the runtime computer-use tools so both paths agree. The seed now covers the shipyard_neo browser tools under the same capabilities gate the main agent uses, skips and logs runtime tools that were deactivated, and an empty whitelist now flows through the same construction instead of returning early, so it keeps the runtime tools and an empty result still reaches the warning. Unknown and inactive whitelist entries keep their warnings too. Signed-off-by: Yufeng He <40085740+he-yufeng@users.noreply.github.com>
63f1c4d to
44e29cb
Compare
|
Hi, I've recently encountered issue #10456 as well. I then found this PR and built a test docker image base on this. I can confirm the issue is resolved. I installed living memory plugin which provides With latest v4.29.1 release, the control group reports that it can see all 8 tools (7 built-in + 1 living memory), and the experiment group does not answer the main agent's query but gives this instead: Seems like the With this PR, the control group still sees all 8 tools, and the experiment group reports that is can see 7 tools, as expected. Can we push this forward? |
|
Thanks for building the image and running the experiment/control split — that is exactly the confirmation this needed, and the two groups showing the whitelist takes effect on v4.29.1 closes the loop on the fix. On the web_search_tavily echo: when the subagent's whitelist hides the tool the runner has nothing to execute, so it surfaces the original tool_use block back to the caller, which looks like a missing tool rather than a denied one. That naming is a separate contract question from the whitelist itself (a denial message versus an unfound tool), and it is pre-existing on main. Happy to take it as a follow-up that reports an excluded tool explicitly instead of echoing the call, if the maintainers want that distinction here. |
…set-builtin-tools # Conflicts: # astrbot/core/astr_agent_runtime/tool_executor.py # tests/unit/test_astr_agent_tool_exec.py
|
Merged current master in Verification on the merged head with a clean local Python 3.14.2 environment: Could a maintainer take another look at the current head? The earlier external whitelist experiment confirms the intended behavior. |
|
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
|
@Soulter @RC-CHN Could you review Computer-use tools should remain inside the subagent whitelist even when they are available to the main agent, and a rejected lookup should leave a useful miss log rather than silently exposing or dropping the tool. @RC-CHN, you have recent changes in the same runtime executor. Could you check the whitelist and logging boundary for both foreground and background execution? |
|
@Soulter @RC-CHN Current master #11335 is merged in The whitelist fix now resolves explicit selections through Could you review that ownership boundary and the warning behavior? Seven selected regressions fail on unmodified current master. The tool executor, subagent, and main-agent suites pass 309 tests on this head. Full unit has 2397 passes and the same pre-existing wakeup failure as unmodified master. No live sandbox or WebUI run is claimed. |
Linked issuesChecked at commit 167a617 #10456 [Bug] 工具白名单会一并关掉框架内置工具,且界面上无法选择内置工具 · 2 of 2 met
|
Motivation
Fixes #10456.
With a persona tool whitelist on a subagent, builtin execution tools disappear, and an unresolvable or empty selection can leave the subagent running toolless without a useful warning.
The main agent applies runtime computer-use tools after persona whitelist narrowing. The subagent handoff instead built its selected
ToolSetonly from the whitelist. The Dashboard checkbox UI lists plugin tool names, so builtin tool names need not appear in that whitelist.Current master #11335 also moved runtime tools out of the shared builtin registry and into the active run context. This update preserves that architecture rather than restoring the removed registry.
Changes
astrbot/core/astr_agent_runtime/tool_executor.py:run_context.toolsfirst, preserving the executable parent-run instances introduced by fix: resolve executable builtin tools for delegated sessions #11335. The existing plugin manager remains the fallback for callers without a run-scoped toolset.browser, absent otherwise.astrbot/core/utils/media_utils.py:url2pathnameconversion. Windows UNC handling is unchanged.Tests
On merged head
167a617c24fb486b8af1eb4de0262e405ccb5735, with current master841295fa938d2cd028b9e0cb832f293c5c5c0d4bas the second parent:tool_executor.pyand pass with this change.tests/unit/test_astr_agent_tool_exec.py: 62 passed.tests/unit/subagentandtests/unit/test_astr_main_agent.py: 309 passed.tests/unit: 2397 passed with one failure intest_wakeup_pipeline.py::test_wakeup_output_policy_preserves_explicit_sends_and_history[plugin]. Unmodified current master reports the same failure with 2389 passes, and the case passes in isolation on both trees. No unrelated failure is hidden or rewritten.git diff --checkpasses. Unrelated pre-existing formatting elsewhere in the test file is left untouched.No real WebUI persona save, external sandbox, model request, or live subagent task was run.
To verify
pytest tests/unit/test_astr_agent_tool_exec.pypytest tests/unit/subagent tests/unit/test_astr_main_agent.pypytest tests/unitwith the same pre-existing wakeup failure also reproduced on current masterSummary by Sourcery
Preserve runtime computer-use tools and improve diagnostics when building subagent handoff toolsets.
Bug Fixes:
Tests: