Files
hermes-agent/tests/tools/test_delegate_completion_model.py
Teknium 71fa6e176a fix: async delegation completions name the inherited child model
With delegation.model blank (children inherit the parent model), the
completion header read creds["model"] (None) and printed "Model: ?".
Fall back to the model the built children actually run on.
2026-10-18 20:17:19 -07:00

25 lines
1.0 KiB
Python

"""The async completion header names the model the children actually run on."""
from dataclasses import fields
from types import SimpleNamespace
from tools import async_delegation
from tools.delegate_tool_dispatch import _Batch, _dispatch_unit
def _unit(configured_model):
batch = _Batch(**{field.name: None for field in fields(_Batch)})
task = {"goal": "probe"}
batch.task_list, batch.live_writers, batch.top_role = [task], [], "leaf"
batch.children = [(0, task, SimpleNamespace(model="inherited/model"))]
batch.creds = {"model": configured_model}
return batch
def test_completion_model_falls_back_to_inherited_child_model(monkeypatch):
seen = []
monkeypatch.setattr(async_delegation, "dispatch_async_delegation_batch", lambda **kw: seen.append(kw["model"]))
_dispatch_unit(_unit(None), None, None, {}) # delegation.model blank: children inherit the parent's model
_dispatch_unit(_unit("configured/model"), None, None, {})
assert seen == ["inherited/model", "configured/model"]