Skip to content

Feat/delegate task profile - #11169

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

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 runtime: loop, agent_init, prompt builder, context-compression, responses endpoint 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
@teknium1 teknium1 added sweeper:risk-security-boundary Sweeper risk: may affect sandboxing, auth, credentials, or sensitive data sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:risk-caching Sweeper risk: may break/degrade prompt caching or cache-key stability (invariant) sweeper:blast-massive Sweeper blast radius: massive — everyone, every turn (invariant surface) labels Jul 12, 2026
@teknium1 teknium1 added the area/profiles Multi-profile isolation, HERMES_HOME scoping label Jul 19, 2026

@GottZ GottZ left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was generated by AI during triage.

Summary

Three PRs are associated with this complex, but they cover two distinct scopes: #11169 implements profile-backed Hermes ACP delegation and worker isolation, while #14568 and #15454 document the existing delegation concurrency and spawn-depth controls. The latter pair does not address the profile-routing failure fixed by #11169.

Related pull requests

  • #11169 related — (+1121/-90) — primary implementation: adds an explicit profile path that launches hermes --profile <name> acp, forwards the selected profile through dispatch, applies the child toolset boundary inside the ACP worker, skips parent context/memory injection, and adds transport, timeout, identity, display, documentation, and regression coverage. Its concurrency/depth documentation overlaps already-merged #15454 and should be rebased or trimmed, but that overlap does not replace its profile-routing fix.
  • #14568 [closed] related — (+33/-7) — superseded documentation patch: documents max_concurrent_children and max_spawn_depth, adds a high-concurrency cost warning, and updates the delegation tool description; it does not implement profile-backed delegation. It remains relevant because its substantive changes and authorship were carried into merged #15454, with the example configuration knobs kept commented following the documented maintainer decision.
  • #15454 [merged] related — (+34/-7) — merged reference implementation for the concurrency/depth documentation from #14568: lands the warning, tool-description update, tuning table, configuration comments, and attribution mapping. It addresses documentation discoverability rather than the profile/runtime fallback corrected by #11169.

Duplicates

#14568 and #15454 are substantially the same documentation change; #15454 is the merged salvage that supersedes #14568. #11169 is not a duplicate, although some of its concurrency/depth documentation overlaps #15454.

Suggested consolidation

Merge #11169 after rebasing and removing or reconciling the documentation already landed through #15454 — its diff uniquely fixes profile-backed worker routing and ACP-side isolation. Keep #15454 as the merged documentation reference; #14568 can remain closed as superseded by #15454, and neither #14568 nor #15454 should be treated as a substitute for #11169.

Cross-PR triage: Reviewed 3 pull requests and 0 issues in this complex. Each diff was read against this issue; Assessment working set: 95 kB of PR diffs, 7 kB of issue/PR text, 1 kB of discussion (6 comments), 1 verify verdict. verdicts reflect diff content, not PR titles. Part of an automated triage batch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/profiles Multi-profile isolation, HERMES_HOME scoping comp/acp Agent Communication Protocol adapter comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint P3 Low — cosmetic, nice to have sweeper:blast-massive Sweeper blast radius: massive — everyone, every turn (invariant surface) sweeper:risk-caching Sweeper risk: may break/degrade prompt caching or cache-key stability (invariant) sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:risk-security-boundary Sweeper risk: may affect sandboxing, auth, credentials, or sensitive data tool/delegate Subagent delegation type/feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants