fix(delegation): preserve child workspace hints and queue busy input while subagents run - #5501
Closed
MestreY0d4-Uninter wants to merge 1 commit into
Closed
Conversation
MestreY0d4-Uninter
force-pushed
the
work/delegation-clean-validate
branch
from
April 6, 2026 17:03
668f014 to
e68c7b0
Compare
MestreY0d4-Uninter
marked this pull request as ready for review
April 6, 2026 17:46
teknium1
pushed a commit
that referenced
this pull request
Apr 7, 2026
Selectively cherry-picked from PR #5501 by MestreY0d4-Uninter. - Add _resolve_workspace_hint() to detect parent's working directory - Inject WORKSPACE PATH into child system prompts - Add rule: never assume /workspace/ container paths - Excludes the cli.py queue-busy-input changes from the original PR
teknium1
pushed a commit
that referenced
this pull request
Apr 7, 2026
Selectively cherry-picked from PR #5501 by MestreY0d4-Uninter. - Add _resolve_workspace_hint() to detect parent's working directory - Inject WORKSPACE PATH into child system prompts - Add rule: never assume /workspace/ container paths - Excludes the cli.py queue-busy-input changes from the original PR
Contributor
|
Partially merged via PR #5748 — the workspace path hints from delegate_tool.py were cherry-picked with authorship preserved. The cli.py queue-busy-input changes were excluded. Thanks @MestreY0d4-Uninter! |
Tommyeds
pushed a commit
to Tommyeds/hermes-agent
that referenced
this pull request
Apr 12, 2026
Selectively cherry-picked from PR NousResearch#5501 by MestreY0d4-Uninter. - Add _resolve_workspace_hint() to detect parent's working directory - Inject WORKSPACE PATH into child system prompts - Add rule: never assume /workspace/ container paths - Excludes the cli.py queue-busy-input changes from the original PR
angelburgosrosado
pushed a commit
to angelburgosrosado/hermes-agent
that referenced
this pull request
Apr 27, 2026
Selectively cherry-picked from PR NousResearch#5501 by MestreY0d4-Uninter. - Add _resolve_workspace_hint() to detect parent's working directory - Inject WORKSPACE PATH into child system prompts - Add rule: never assume /workspace/ container paths - Excludes the cli.py queue-busy-input changes from the original PR
02356abc
pushed a commit
to 02356abc/hermes-agent
that referenced
this pull request
May 14, 2026
Selectively cherry-picked from PR NousResearch#5501 by MestreY0d4-Uninter. - Add _resolve_workspace_hint() to detect parent's working directory - Inject WORKSPACE PATH into child system prompts - Add rule: never assume /workspace/ container paths - Excludes the cli.py queue-busy-input changes from the original PR
gweeteve
pushed a commit
to gweeteve/hermes-agent
that referenced
this pull request
Jun 2, 2026
Selectively cherry-picked from PR NousResearch#5501 by MestreY0d4-Uninter. - Add _resolve_workspace_hint() to detect parent's working directory - Inject WORKSPACE PATH into child system prompts - Add rule: never assume /workspace/ container paths - Excludes the cli.py queue-busy-input changes from the original PR
waefrebeorn
pushed a commit
to waefrebeorn/slermes
that referenced
this pull request
Jul 2, 2026
Selectively cherry-picked from PR NousResearch#5501 by MestreY0d4-Uninter. - Add _resolve_workspace_hint() to detect parent's working directory - Inject WORKSPACE PATH into child system prompts - Add rule: never assume /workspace/ container paths - Excludes the cli.py queue-busy-input changes from the original PR
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
/workspace/...for local repo tasksProblem
A real delegated batch hit two separate failure modes at once:
/workspace/hermes-agent) and immediately failed terminal calls on the local backend.These are independent failures, so fixing only one still leaves the delegation flow fragile.
Root cause
1. Missing explicit workspace hint for child agents
Repo-centric child tasks had enough context to know they should inspect a repository, but not enough to know the exact local path. In that situation, the child could guess a container-style path and emit invalid terminal tool calls.
2. CLI interrupt policy was too aggressive during active delegation
display.busy_input_mode: interruptis reasonable for a single active agent, but when delegated child agents are still running it is too destructive. Interrupting the parent propagates directly to active children, which turns an ordinary follow-up message into delegated work loss.What changed
Delegation workspace hinting
tools/delegate_tool.py:_build_child_system_prompt()with an optionalworkspace_path/workspace/...unless that path is explicitly provided_resolve_workspace_hint(parent_agent)to derive a best-effort absolute local path from the parent runtime (TERMINAL_CWD, subdirectory hints, or parent cwd fields)_build_child_agent()now injects that workspace hint into the child prompt when availableBusy-input handling during active child runs
HermesCLI._should_queue_busy_input()HermesCLI.chat()This preserves the normal interrupt behavior when no children are active, while protecting active delegated work from being aborted by a routine follow-up message.
Files changed
tools/delegate_tool.pycli.pytests/tools/test_delegate.pytests/test_cli_init.pyValidation
Focused tests on the patched checkout
uv run pytest tests/tools/test_delegate.py -q -o addopts=''uv run pytest tests/test_cli_init.py -q -o addopts=''uv run pytest tests/test_real_interrupt_subagent.py -q -o addopts=''Focused tests on a clean worktree from latest
origin/mainApplied the patch on top of a clean worktree created from the latest upstream
main, then ran:uv run pytest tests/tools/test_delegate.py -q -o addopts=''uv run pytest tests/test_cli_init.py -q -o addopts=''uv run pytest tests/test_real_interrupt_subagent.py -q -o addopts=''Additional runtime smoke
Ran a small runtime harness against the clean worktree to verify the intended CLI behavior:
interrupt()was not calledWhy this shape
This keeps the change small and local: