Files
DeepSeek-Reasonix/internal/runtime/delegation/readonly_handoff_test.go
T
yhh a534ead0ab refactor(delegation): sub-agent orchestration leaves the agent package
The task tool, read-only tasks, fleets, parallel tasks, the sub-agent
store and records, profiles and the child's capability grant move from
internal/runtime/agent to internal/runtime/delegation. They are clients
of the agent: they build child agents and run them. The executor loop
now names none of them.

What the loop itself does for a child stays in agent. child_run.go holds
running an agent as a child and composing its answer and host receipts.
child_registry.go holds shaping the child's tool surface. Delegation uses
a small exported surface for these: AppendHostReceipts, AttachReviewReport,
CompleteSubtaskContract, ExpandToolPatterns, MaxToolOutputBytes,
NormalizeToolSchemas, SubagentImageNote, VisionRefFor, WithCallContext
and the host-receipt labels.

Tests followed the code. The ones that check the agent's own judgements
against the real delegation tools (batch skipping, the plan-mode barrier,
contract hints, delegation profiles across the proxy) run as agent_test
in the agent directory through export_test.go. The user-turn retention
test is split so each package pins its half. Test helpers used on both
sides are copied, since neither test binary may import the other. One
test more than before, from that split; none dropped.

Baseline: the moved files carry their debt unchanged under the new path,
and task.go gains the one import line the move costs (-allow-widen).
2026-09-23 22:36:35 -07:00

28 lines
915 B
Go

package delegation
import (
"reasonix/internal/runtime/agent"
"testing"
"reasonix/internal/contract/tool"
)
// The protocol tool is not a capability. Attaching it before the "can this
// child investigate anything?" check would let a child with no research tools
// pass as having one, and it would then report on work it could not do.
func TestReportingToolDoesNotCountAsAResearchCapability(t *testing.T) {
parent := tool.NewRegistry()
parent.Add(subagentRegistryTool{name: "write_file"}) // not read-only
sub := agent.ReadOnlySubagentToolRegistry(parent, nil)
if sub.Len() != 0 {
t.Fatalf("a parent with no read-only tools produced %v", sub.Names())
}
// And once it is attached, the registry is no longer empty — which is
// exactly why the emptiness check has to come first.
agent.AttachCompleteSubtaskTool(sub)
if sub.Len() == 0 {
t.Fatal("complete_subtask was not attached at all")
}
}