Skip to content

Feat/delegate task profile#11169

Open
DJHellscream wants to merge 14 commits into
NousResearch:mainfrom
DJHellscream:feat/delegate-task-profile
Open

Feat/delegate task profile#11169
DJHellscream wants to merge 14 commits into
NousResearch:mainfrom
DJHellscream:feat/delegate-task-profile

Conversation

@DJHellscream

@DJHellscream DJHellscream commented Apr 16, 2026

Copy link
Copy Markdown

What Does This PR Do?

This PR makes delegate_task(profile=...) reliably launch a profile-backed Hermes ACP worker under the selected profile's runtime/home instead of silently falling back to the parent runtime.

It also tightens delegated-worker isolation:

  • Delegated profile-backed ACP workers now skip context-file injection and memory injection.
  • Child toolsets are derived from the parent's effective tool surface, but blocked composite toolsets are stripped so blocked tools cannot leak indirectly.
  • ACP-backed child runtime metadata and usage handling are normalized so the parent/runtime surfaces stay truthful.

This is the right approach because it makes named-profile delegation explicit and reliable without changing the behavior of normal non-profile delegation.

Related Issue

No dedicated issue for this change.

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Security fix
  • Documentation update
  • Tests (adding or improving test coverage)
  • Refactor (no behavior change)
  • New skill (bundled or hub)

Changes Made

  • tools/delegate_tool.py
    • Make delegate_task(profile=...) build a profile-backed Hermes ACP child reliably.
    • Derive child toolsets from the parent's effective toolsets.
    • Strip blocked composite toolsets, including messaging, so send_message cannot leak into children.
  • run_agent.py
    • Preserve profile/transport/launch metadata on delegated children.
    • Keep child ACP/profile runtime state aligned with the selected worker profile.
  • acp_adapter/session.py
    • Honor delegated worker env overrides and preserve worker isolation.
    • Force delegated profile-backed workers to skip context files and memory.
  • agent/copilot_acp_client.py
    • Normalize ACP usage/runtime metadata surfaced back to Hermes.
  • tests/tools/test_delegate.py
    • Add coverage for profile-backed delegate routing and blocked composite toolset stripping.
  • tests/acp/test_session.py
    • Add delegated-worker env/toolset isolation coverage.
  • tests/agent/test_copilot_acp_client.py
    • Add ACP usage/runtime metadata coverage.
  • tests/run_agent/test_run_agent.py
    • Add end-to-end delegate/profile runtime coverage.
  • Documentation updates:
    • website/docs/guides/delegation-patterns.md
    • website/docs/reference/tools-reference.md
    • website/docs/user-guide/features/delegation.md

How to Test

  1. Run the targeted delegate/profile test slice:

    unset API_SERVER_KEY API_SERVER_HOST API_SERVER_PORT HERMES_HOME
    uv run --extra dev python -m pytest -o addopts='' \
      tests/tools/test_delegate.py \
      tests/acp/test_session.py \
      tests/agent/test_copilot_acp_client.py \
      tests/run_agent/test_run_agent.py -q
  2. In a Hermes session with any existing named profile, invoke delegate_task(profile="<your-profile>", toolsets=["terminal","file"]).

  3. Confirm the delegated worker:

    • Launches via hermes --profile <your-profile> acp.
    • Uses the selected profile's runtime/home.
    • Does not expose blocked child tools such as delegate_task, clarify, memory, execute_code, or send_message.

Checklist

Code

  • I've read the Contributing Guide.
  • My commit messages follow Conventional Commits (fix(scope):, feat(scope):, etc.).
  • I searched for existing PRs to make sure this isn't a duplicate.
  • My PR contains only changes related to this fix/feature (no unrelated commits).
  • I've run pytest tests/ -q and all tests pass. See full-suite note below.
  • I've added tests for my changes (required for bug fixes, strongly encouraged for features).
  • I've tested on my platform: Ubuntu 24.04.3 LTS.

Documentation & Housekeeping

  • I've updated relevant documentation (README, docs/, docstrings) - or N/A.
  • I've updated cli-config.yaml.example if I added/changed config keys - or N/A.
  • I've updated CONTRIBUTING.md or AGENTS.md if I changed architecture or workflows - or N/A.
  • I've considered cross-platform impact (Windows, macOS) per the compatibility guide - or N/A.
  • I've updated tool descriptions/schemas if I changed tool behavior - or N/A.

Screenshots / Logs

Targeted delegate/profile slice:

370 passed in 18.77s

Local disposable delegate-profile smoke also passed after rebasing onto current main.

Full-suite note:

  • Current origin/main is baseline-red.
  • I did run a branch-vs-main full-suite comparison after rebasing onto current main.
  • Raw full-suite counts still differ, but spot-checking the branch-only failures individually on both the rebased branch and current main did not confirm a branch-only regression.

@alt-glitch alt-glitch added type/feature New feature or request P3 Low — cosmetic, nice to have tool/delegate Subagent delegation comp/agent Core agent loop, run_agent.py, prompt builder comp/acp Agent Communication Protocol adapter labels Apr 25, 2026
@thesunofdog

Copy link
Copy Markdown

This closes a gap I've been working around for months — profile routing via terminal subprocess. The profile/toolset separation as orthogonal concerns is the right call. Good to see this moving.

@DJHellscream DJHellscream force-pushed the feat/delegate-task-profile branch from c217bd9 to 8b07886 Compare April 28, 2026 19:06
@DJHellscream

Copy link
Copy Markdown
Author

Resolved conflicts with base branch

@DJHellscream DJHellscream force-pushed the feat/delegate-task-profile branch from 8b07886 to 95e4096 Compare May 14, 2026 18:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/acp Agent Communication Protocol adapter comp/agent Core agent loop, run_agent.py, prompt builder P3 Low — cosmetic, nice to have tool/delegate Subagent delegation type/feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants