Repository navigation
fix(subagent): let scoped sub-agents keep conversation-local tools like task_tracker - #5520
Conversation
|
REST API breakage checks (OpenAPI) — ✅ PASSEDResult: ✅ PASSED |
Coverage Report •
|
||||||||||||||||||||||||||||||
|
@OpenHands rebase and do e2e validation make sure there are no bugs and fill in HUMAN section in description and make sure CI is green |
|
I'm on it! simonrosenberg can track my progress at all-hands.dev |
A sub-agent scope now ignores tools that only touch their own conversation's state. task_tracker is the first such tool, so a profile with terminal and file_editor can delegate to general-purpose without also selecting it. Closes #5519 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: openhands <openhands@all-hands.dev>
aef1050 to
32f5c6e
Compare
|
@simonrosenberg I rebased on Validation
HUMAN section: I left it as it was. The repo rules (AGENTS.md and the template comment) say AI agents must not write it, and the description check needs a note in a human's own words. Please add at least 20 characters there before you mark the PR ready. The linked issue #5519 already has This comment was created by an AI agent (OpenHands) on behalf of @simonrosenberg. |
|
I rebased PR #5520 onto Rebase: The branch is now on Testing
Bugs: I found none in the fix itself. I did fix one problem in the live-check script (commit CI: All 48 checks pass on the new head. Three were skipped: HUMAN section: The repo's AGENTS.md and the PR template both say AI agents must not edit it. The description check also requires a note of at least 20 characters in a person's own words. That check will run once you mark the PR ready for review, so please add the note before then. Issue #5519 already has the Description and reply: In the PR description I updated only the AGENT section, adding the results after the rebase and the failing run against |
all-hands-bot
left a comment
There was a problem hiding this comment.
This review was posted by an AI agent (OpenHands).
Review of PR #5520
Scope check: this change belongs in OpenHands/software-agent-sdk. It modifies SDK tool-definition metadata and sub-agent scope enforcement, both owned by this repository.
What I verified
- Head matches:
32f5c6e7f805e54101f390f1a20a2953cce5fde1(title, body, links unchanged). Linked issue #5519 is open withbug,priority:medium,ready-for-dev. - CI: no failing/timed-out/action-required check runs on the current head.
- Tests (in workspace):
tests/tools/task/test_sub_agent_scope.py(15 passed),tests/sdk/subagent,tests/sdk/tool,tests/sdk/profiles,tests/tools/task,tests/tools/workflow— 614 passed. The two new tests and the updatedgeneral-purposeexpectation pass. One unrelated failure,tests/sdk/subagent/test_subagent_loader.py::test_load_user_agents_from_openhands_dir, exists in a file this PR does not touch and fails on the base revision independently. - Lint/format:
ruff checkandruff format --checkclean on all changed files.
Assessment
- The new
ToolDefinition.conversation_localClassVar defaults toFalse, so it is a no-op for every existing tool and has no serialization/persistence impact (ClassVars are not model fields). SubAgentScope.missing_fromis the single check behind the sub-agent listing, theTaskManagerstart check, and both workflow tools, so the exemption is applied consistently across all delegation entry points. I traced each caller (task/definition.py:298,task/manager.py:386).TaskTrackerTool.createtakessave_dirfromconv_state.persistence_dir; for a sub-agent that resolves toconversations/<parent>/subagents/<sub-agent>/, so the tool genuinely only reads/writes its own conversation state, matching the exemption's stated rationale. No cross-conversation write path is introduced._conversation_localresolves the class viaregistered_tool_class(name) or effective_builtin_class(name)against the already-canonicalized names from_tool_names; fortask_trackerthis resolves to the registeredTaskTrackerTool(flagTrue), confirmed at runtime.
No material correctness, security, compatibility, or acceptance-criterion defect found on the current head. The linked issue's reproducer is addressed and the PR includes before/after live evidence.
✅ APPROVED
HUMAN:
Sub-agent scoping (#5358) refuses any sub-agent that uses a tool the delegating agent doesn't have. That's right for tools that reach the workspace, network or other capabilities. It's wrong for
task_tracker, which only keeps a to-do list in the sub-agent's own conversation (TASKS.jsonin its persistence directory).AGENT:
Why
Sub-agent scoping (#5358) refuses any sub-agent that uses a tool the delegating agent doesn't have. That's right for tools that reach the workspace, network or other capabilities. It's wrong for
task_tracker, which only keeps a to-do list in the sub-agent's own conversation (TASKS.jsonin its persistence directory).So a profile with
terminal,file_editorand the task tool, but nottask_tracker, can't use the built-ingeneral-purposesub-agent:It also breaks the default delegation, because
subagent_typedefaults togeneral-purpose. This was found while QA'ing Agent Canvas's tool picker on agent-server 1.52.0.Summary
ToolDefinition.conversation_localclass flag (defaultFalse). It marks tools that only read and write their own conversation's state.SubAgentScope.missing_fromignores conversation-local tools. It's the single check behind the task tool's listing, theTaskManagerstart check and both workflow tools, so all of them change together.TaskTrackerToolsets the flag. Every other tool is still checked as before.Issue Number
Closes #5519
How to Test
Two new tests, plus one updated expectation (
general-purposenow lacks onlyfile_editor, terminalon a read-only profile). All three fail with thescope.pychange reverted and pass with it. The related suites (tests/sdk/subagent,tests/sdk/tool,tests/sdk/profiles,tests/tools/task,tests/tools/workflow): 741 passed after rebasing onmain(e3a2682). Pre-commit (ruff, pyright, import rules) is clean.Live check (
.pr/conversation_local_e2e.py): it starts a real agent-server and Agent Canvas's scripted mock LLM. A profile withterminal,file_editorandtask_tool_setdelegates togeneral-purpose, whose scripted turn callstask_tracker plan.This branch (rebased on
main, agent-server 1.54.0):mainate3a2682(1.54.0, with this branch'sscope.pychange reverted) still fails the same way:The sub-agent's
TASKS.jsonis written toconversations/<parent>/subagents/<sub-agent>/, which is the sub-agent's own persistence directory. The live check now drops the host'sOH_*variables, so the test server does not pick up the sandbox's webhooks or conversations path.Released 1.53.0 (
--server-pythonpointing at a venv withopenhands-agent-server==1.53.0):Video/Screenshots
N/A (backend change; output above).
🤖 Generated with Claude Code. Rebase and live re-validation by an AI agent (OpenHands) on behalf of @simonrosenberg.
🐳 Agent Server images for this PR — GHCR package, pull/run commands, and all pushed tags (click to expand)
• GHCR package: https://github.com/OpenHands/agent-sdk/pkgs/container/agent-server
Variants & Base Images
eclipse-temurin:17-jdkpython-node-runtimepython-node-runtimepython-node-runtimegolang:1.21-bookwormPull (multi-arch manifest)
# Each variant is a multi-arch manifest supporting both amd64 and arm64 docker pull ghcr.io/openhands/agent-server:d1123e6-pythonRun
All tags pushed for this build
About Multi-Architecture Support
d1123e6-python) is a multi-arch manifest supporting both amd64 and arm64d1123e6-python-amd64) are also available if needed