Skip to content

refactor(delegate_task): tasks-only interface + depth-derived delegation (1,201 → 773 tok/call, −36%) - #96424

Merged
teknium1 merged 2 commits into
mainfrom
delegate-task-schema-diet
Aug 27, 2026
Merged

teknium1 merged 2 commits into
mainfrom
delegate-task-schema-diet

Conversation

@teknium1

@teknium1 teknium1 commented Aug 27, 2026 •

Copy link
Copy Markdown
Collaborator

Campaign entry (#95681). NOTE: the tracker's old 651-tok figure was the static stub — this tool builds its real text via dynamic_schema_overrides; AS-SERVED on a default config is 1,201 tok/call. All numbers measured through model_tools.get_tool_definitions() (the wire path).

Three maintainer-directed interface changes + diet, in commit order:

Commit 1 — depth-derived delegation, session-filtered rules, background unadvertised

role retired. The old model made the CALLER declare role='leaf'|'orchestrator', then silently coerced it when config disagreed. Now the runtime derives it: a child may itself delegate iff delegation.orchestrator_enabled and its depth < max_spawn_depth (_build_child_agent, the existing enforcement point). role/tasks[].role leave the schema; handler accepts+ignores them (old transcripts, kanban dispatcher). Depth-1 installs (default): the word "orchestrator" appears NOWHERE in the served schema. Behavior delta on nesting-enabled installs only: children with depth budget now always get delegate_task (previously only when the caller remembered to ask).

Restrictions rule session-filtered. The "children cannot call X" line now names only tools the SESSION actually has (same model_tools seam as the browser_exec terminal-gate; memo key already includes toolsets): full kit → full list · partial → filtered · none → line dropped. send_message is never named — gateway-internal vocabulary; enforcement unchanged (DELEGATE_BLOCKED_TOOLS still strips all five).

background (86 tok of "DEPRECATED / IGNORED") unadvertised; handler unchanged.

Commit 2 — tasks[] is the only advertised shape (the clarify #95907 pattern)

The runtime already wrapped single-goal calls into a one-entry task list internally; the schema was the only place the two-shape fiction lived — and it bred real confusion (top-level context looked like shared/broadcast context; it never was: each child sees only its own tasks[i].context).

  • Top-level goal/context/output_schema leave the schema (handler-accepted legacy, wrapped at dispatch as before; do-not-re-add comments in place).
  • tasks[] (minItems 1) is the one shape; item fields now carry the full teaching, including the context-isolation rule models previously had to guess: "Each child sees only its own context — repeat shared background in every task that needs it."
  • The min-2 batch gate is gone (a one-entry array is now canonical, matching the runtime's internal shape); the placeholder/template goal checks still run on every entry, and the short-goal check applies only to multi-task fan-outs (single tasks legitimately use short goals — preserves the historical exemption including the gpt-5.4-mini tasks=[]+goal regression case).
  • Missing-input error teaches the canonical shape.

Numbers (as served, o200k_base, default config)

tok/call
main 1,201
commit 1 819
commit 2 773 (−428, −36%)

4 advertised params (tasks, action, subagent_id, message), down from 9.

Verification

  • E2E (wire path): depth-1 + depth-3 (temp HERMES_HOME) variants; all four session-filter shapes; role/orchestrator/leaf/send_message asserted absent from serialized schema.
  • E2E (dispatch): one-entry array with short goal spawns clean; legacy goal=/context=/role= still flow; bare call gets the teaching error.
  • 153/156 delegate tests pass — 3 failures are the pre-existing output_schema trio (reproduced identically on clean origin/main via stash). 5 contract tests updated to pin the new interface, incl. flipping the one that REQUIRED the min-2 rejection into one that requires one-entry acceptance.

…), session-filtered restrictions, background unadvertised — 1,201->819 tok/call
@github-actions

github-actions Bot commented Aug 27, 2026 •

Copy link
Copy Markdown

૮ >ﻌ< ა ci review

ran on 2d54f00 — refactor(delegate_task): tasks[] is the only advertised shap

⚠️ Warnings

OSV vulnerability scan · View job

6 known vulnerabilities found in pinned dependencies.

How to fix:

Review the findings in the Security tab. Update the affected dependencies if a patched version is available.


debug info

CI timings

CI timings · View report · View job

Wall time 4m8s vs 4m17s (-3.5%). 7 job(s) slower, 5 faster,

  • Check contributors / check-attribution: +9.0s
  • OSV scan / Scan lockfiles / osv-scan: -8.0s
  • Python tests / Run tests: +6.0s
  • OS-specific tests / Windows-only tests: -6.0s
  • Python lints / ruff enforcement (blocking): +4.0s

@alt-glitch alt-glitch added type/refactor Code restructuring, no behavior change P3 Low — cosmetic, nice to have comp/tools Tool registry, model_tools, toolsets tool/delegate Subagent delegation labels Aug 27, 2026
…e task = one-entry array (legacy goal/context/output_schema stay handler-accepted)
@teknium1 teknium1 changed the title refactor(delegate_task): depth-derived delegation + schema diet (1,201 → 819 tok/call as served, −32%) refactor(delegate_task): tasks-only interface + depth-derived delegation (1,201 → 773 tok/call, −36%) Aug 27, 2026
@teknium1
teknium1 merged commit 9dfbde1 into main Aug 27, 2026
35 checks passed
@teknium1
teknium1 deleted the delegate-task-schema-diet branch August 27, 2026 14:38
and7777 pushed a commit to and7777/hermes-agent that referenced this pull request Aug 27, 2026
…ion (1,201 → 773 tok/call, −36%) (NousResearch#96424)

* refactor(delegate_task): depth-derived delegation (role param retired), session-filtered restrictions, background unadvertised — 1,201->819 tok/call

* refactor(delegate_task): tasks[] is the only advertised shape — single task = one-entry array (legacy goal/context/output_schema stay handler-accepted)
melon-xf added a commit to melon-xf/hermes-agent that referenced this pull request Sep 3, 2026
…ion (1,201 → 773 tok/call, −36%) (NousResearch#96424)

* refactor(delegate_task): depth-derived delegation (role param retired), session-filtered restrictions, background unadvertised — 1,201->819 tok/call

* refactor(delegate_task): tasks[] is the only advertised shape — single task = one-entry array (legacy goal/context/output_schema stay handler-accepted)
zapabob pushed a commit to zapabob/hermes-agent-windows that referenced this pull request Sep 5, 2026
…ion (1,201 → 773 tok/call, −36%) (NousResearch#96424)

* refactor(delegate_task): depth-derived delegation (role param retired), session-filtered restrictions, background unadvertised — 1,201->819 tok/call

* refactor(delegate_task): tasks[] is the only advertised shape — single task = one-entry array (legacy goal/context/output_schema stay handler-accepted)
ppazosp added a commit to useomnia/hermes-agent that referenced this pull request Sep 18, 2026
* fix(skills): make omitted instructions explicit and recoverable

Adapt NousResearch#98736 (2fce577) to the fork without its upstream-only repeat-view cache. Preserve linked-file selectors and recover complete sections through both per-result and aggregate budgets.

Co-authored-by: Mira Solari <268252643+mira-solari@users.noreply.github.com>

* fix(delegation): preserve worker context and deliver complete artifacts

Adapt the current-prompt budget correction from upstream NousResearch#103486, cache-path mapping from NousResearch#103667, and tasks-only schema from NousResearch#96424. Retain the legacy call interface, preserve shared batch context, and transfer only active-profile delegation artifacts into the paired Toolbox using existing file APIs.

* fix(execute-code): deliver large RPC results without replaying tools

Use the existing file transport or bounded shell chunks, publish atomically, and retain dispatched results through delivery retries. Fail explicitly after exhausted delivery instead of executing the same request again.

* docs(delegation): explain remote transcript refresh behavior

* test(execute-code): assert transferred bytes instead of shell command order

---------

Co-authored-by: Mira Solari <268252643+mira-solari@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/tools Tool registry, model_tools, toolsets P3 Low — cosmetic, nice to have tool/delegate Subagent delegation type/refactor Code restructuring, no behavior change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants