Skip to content

feat(delegation): add opt-in context projection - #67929

Open
HEROISM-WQL wants to merge 5 commits into
NousResearch:mainfrom
HEROISM-WQL:feat/delegate-context-compiler
Open

feat(delegation): add opt-in context projection#67929
HEROISM-WQL wants to merge 5 commits into
NousResearch:mainfrom
HEROISM-WQL:feat/delegate-context-compiler

Conversation

@HEROISM-WQL

Copy link
Copy Markdown

Summary

  • add a deterministic compiler for projecting selected parent context into delegated tasks
  • keep the feature disabled by default
  • pass parent messages explicitly instead of reading hidden agent state
  • preserve prompt-cache stability by compiling context only at delegation boundaries
  • authenticate runtime out-of-band steering via a sidecar rather than mixing it into user history
  • include a reproducible spike and fixtures documenting the decision evidence

Safety and compatibility

  • existing delegation behavior is unchanged when context projection is disabled
  • projected context is bounded and deterministic
  • role alternation and the parent conversation history are not mutated
  • nested delegation remains subject to existing depth and role limits

Testing

  • pytest tests/tools/test_delegate_context.py tests/tools/test_delegate.py tests/run_agent/test_run_agent.py -q
    • 611 passed
  • ruff check on all changed Python and test files
    • passed

Notes

The implementation is opt-in and introduces no new always-on core tool schema.

@alt-glitch alt-glitch added type/feature New feature or request comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint comp/cli CLI entry point, hermes_cli/, setup wizard tool/delegate Subagent delegation P3 Low — cosmetic, nice to have needs-decision Awaiting maintainer decision before any implementation sweeper:risk-session-state Sweeper risk: may lose/corrupt/mis-associate session or context state sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades labels Jul 20, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

This was generated by AI during triage.

Related to prior delegation/profile/context work (#36663, #55066, #55286). This is a broader default-off core/delegation policy addition rather than a duplicate; maintainers should decide whether this projection belongs in the core path.

@teknium1 teknium1 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.

Thanks for the carefully bounded, default-off implementation. The current main implementation still intentionally gives delegated children a fresh conversation and only explicit context (tools/delegate_tool.py:11, tools/delegate_tool.py:1317), so this remains a design decision rather than a duplicate fix.

Problems

  • The PR adds defaults in hermes_cli/config.py, but current main moved DEFAULT_CONFIG into hermes_cli/config_defaults.py:1543 in 1fe06115d1. A salvage needs to port those defaults to the canonical block.
  • tests/tools/test_delegate_context.py:207 asserts the complete generated child prompt. Please test projection invariants instead of pinning unrelated instruction wording.

Suggested changes

  • Rebase the config portion onto the current config_defaults.py layout and cover the active config-loading path.
  • Keep tests focused on explicit-mode isolation, role filtering, bounded deterministic projection, and task placement.

This is an automated hermes-sweeper review.



def test_default_config_and_child_prompt_are_byte_stable() -> None:
from hermes_cli.config import DEFAULT_CONFIG

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 test snapshots the entire child prompt, so unrelated valid edits to the standing child instructions will fail it. Please replace the exact-string assertion with focused behavior contracts for default-mode isolation and the relevant task/context ordering.

@teknium1 teknium1 added sweeper:risk-caching Sweeper risk: may break/degrade prompt caching or cache-key stability (invariant) sweeper:risk-security-boundary Sweeper risk: may affect sandboxing, auth, credentials, or sensitive data sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform labels Jul 30, 2026
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 comp/cli CLI entry point, hermes_cli/, setup wizard needs-decision Awaiting maintainer decision before any implementation P3 Low — cosmetic, nice to have sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform 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 sweeper:risk-session-state Sweeper risk: may lose/corrupt/mis-associate session or context state 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