GitHub Issue: delegate_task HOME env bug
Repo: NousResearch/hermes-agent
Labels: bug
Title
delegate_task subagent environments lack $HOME, causing cascading Path.home() failures
Body
Bug Description
When using delegate_task, spawned subagent environments do not inherit the $HOME environment variable. This causes Path.home() and os.path.expanduser() to fail in hermes_tools during API calls, triggering retry loops that consume ~40x more time than actual compute.
Steps to Reproduce
- Call
delegate_task with a task that requires hermes_tools (e.g., read_file, terminal)
- Observe error:
Could not determine home directory
- Subagent retries, each retry takes ~10-15s of recovery overhead
Expected Behavior
Subagent environments should inherit $HOME from the parent process, or hermes_tools should include a fallback:
home = os.environ.get('HOME') or os.path.expanduser('~') or '/home/openclaw'
Actual Behavior
- 6 API call failures in a 9-call task
- 869s total runtime, ~20s actual compute, ~849s retry/recovery overhead
- Error originates from
pathlib.Path.home() when HOME is unset
Environment
- OS: Linux (Ubuntu, VPS)
- Hermes Agent: latest (NousResearch/hermes-agent)
- Python: 3.12
- Tool: delegate_task with toolsets=['terminal','file','web']
Evidence
Session log shows repeated pattern:
❌ Error during OpenAI-compatible API call #6: Could not determine home directory.
Proposed Fix
Either:
delegate_task injects HOME into subagent process environment before spawning
hermes_tools adds fallback chain: $HOME → getent passwd → /home/openclaw
The init scripts (init_run.py, validate_run.py) already implement this fallback — the same pattern should apply to the tool runtime.
GitHub Issue: delegate_task HOME env bug
Repo: NousResearch/hermes-agent
Labels: bug
Title
delegate_tasksubagent environments lack$HOME, causing cascadingPath.home()failuresBody
Bug Description
When using
delegate_task, spawned subagent environments do not inherit the$HOMEenvironment variable. This causesPath.home()andos.path.expanduser()to fail inhermes_toolsduring API calls, triggering retry loops that consume ~40x more time than actual compute.Steps to Reproduce
delegate_taskwith a task that requireshermes_tools(e.g.,read_file,terminal)Could not determine home directoryExpected Behavior
Subagent environments should inherit
$HOMEfrom the parent process, orhermes_toolsshould include a fallback:Actual Behavior
pathlib.Path.home()when HOME is unsetEnvironment
Evidence
Session log shows repeated pattern:
Proposed Fix
Either:
delegate_taskinjectsHOMEinto subagent process environment before spawninghermes_toolsadds fallback chain:$HOME → getent passwd → /home/openclawThe init scripts (
init_run.py,validate_run.py) already implement this fallback — the same pattern should apply to the tool runtime.