Skip to content

fix(agent): preserve SOUL identity for delegated children - #79052

Open
tachyon-r wants to merge 2 commits into
NousResearch:mainfrom
tachyon-r:fix/delegate-soul-identity
Open

fix(agent): preserve SOUL identity for delegated children#79052
tachyon-r wants to merge 2 commits into
NousResearch:mainfrom
tachyon-r:fix/delegate-soul-identity

Conversation

@tachyon-r

Copy link
Copy Markdown
Contributor

Summary

  • keep delegated children isolated from project context and persistent memory
  • explicitly preserve the user's global SOUL.md identity for delegated children
  • add a regression test covering all three constructor invariants

Why

Delegated children currently set skip_context_files=True and skip_memory=True without setting load_soul_identity=True. Prompt assembly therefore falls back to the generic Hermes identity instead of the user's global operator identity.

This is the narrow delegate-only repair extracted from the broader, now-conflicting #28061. It does not change --ignore-rules, safe mode, batch/eval behavior, curator behavior, or the default meaning of load_soul_identity for other callers.

Credit to @nuriygold for the original fix in #28061; authorship is preserved in the commit trailer.

Validation

  • RED: the new regression test failed on current main with KeyError: 'load_soul_identity'
  • GREEN: scripts/run_tests.sh tests/tools/test_delegate.py -q — 63 passed
  • scripts/run_tests.sh tests/run_agent/test_run_agent.py -k 'soul or context_files' -q — 1 passed
  • uv run --no-sync ruff check tools/delegate_tool.py tests/tools/test_delegate.py — passed
  • git diff --check origin/main...HEAD — passed

Risk

Low. The change adds one explicit constructor argument to a single execution path. Children continue to skip project context and memory; only the already-supported global identity layer is restored.

@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint tool/delegate Subagent delegation labels Aug 5, 2026
@tachyon-r
tachyon-r force-pushed the fix/delegate-soul-identity branch 2 times, most recently from 701ab1d to 9b55c9b Compare August 15, 2026 05:24
@Enough1122

Copy link
Copy Markdown
Contributor

AI code review — automated review for reference, author can ignore or act on any point.

fix(agent): preserve SOUL identity for delegated children

  1. load_soul_identity=True is applied unconditionally to every delegated child (tools/delegate_tool.py, _build_child_agent), including role="leaf" workers that already opt out of context files and memory. The SOUL persona text now ships in every child's system prompt for every child call — a per-child context/cost consideration. Consider gating on role or a parent-side flag if persona-free neutral workers are ever needed.
  2. The test only asserts kwargs pass-through to AIAgent; it doesn't prove the child actually renders the soul identity into its system prompt while still skipping context files and memory. An integration-level assertion (child system prompt contains the SOUL text, context files/memory still absent) would pin the real behavior.
  3. Behavior-change note: children that previously ran persona-free now inherit the parent's persona. Any consumer relying on neutral/blank children (e.g. summarizers) silently changes; if intentional that's fine, otherwise consider making it opt-in per role.

@tachyon-r
tachyon-r force-pushed the fix/delegate-soul-identity branch from 83cc152 to 093edf5 Compare August 20, 2026 11:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint P2 Medium — degraded but workaround exists tool/delegate Subagent delegation type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants