Merge pull request #4074 from code-yeongyu/fix/delegate-task-spawn

fix(delegate-task): start child prompts reliably
This commit is contained in:
YeonGyu-Kim
2026-05-17 01:00:03 +09:00
committed by GitHub
22 changed files with 1385 additions and 216 deletions
+8 -11
View File
@@ -1,16 +1,15 @@
import { describe, test, expect } from "bun:test"
import { describe, expect, test } from "bun:test"
import { buildAgent } from "./agent-builder"
import type { AgentFactory } from "./types"
describe("#given an agent factory with mode", () => {
const mockFactory = ((model: string) => ({
const mockFactory: AgentFactory = Object.assign((model: string) => ({
name: "test-agent",
description: "Test",
instructions: "test",
model,
temperature: 0.1,
})) as AgentFactory
mockFactory.mode = "subagent"
}), { mode: "subagent" as const })
test("#when building agent from factory", () => {
const agent = buildAgent(mockFactory, "test-model")
@@ -19,14 +18,13 @@ describe("#given an agent factory with mode", () => {
})
describe("#given an agent factory with mode=primary", () => {
const mockFactory = ((model: string) => ({
const mockFactory: AgentFactory = Object.assign((model: string) => ({
name: "primary-agent",
description: "Primary Test",
instructions: "test",
model,
temperature: 0.1,
})) as AgentFactory
mockFactory.mode = "primary"
}), { mode: "primary" as const })
test("#when building agent from factory", () => {
const agent = buildAgent(mockFactory, "test-model")
@@ -50,15 +48,14 @@ describe("#given an agent config object without mode", () => {
})
describe("#given an agent factory with mode but config already has mode", () => {
const mockFactory = ((model: string) => ({
const mockFactory: AgentFactory = Object.assign((model: string) => ({
name: "override-agent",
description: "Override Test",
instructions: "test",
model,
temperature: 0.1,
mode: "all",
})) as AgentFactory
mockFactory.mode = "subagent"
mode: "all" as const,
}), { mode: "subagent" as const })
test("#when building agent from factory", () => {
const agent = buildAgent(mockFactory, "test-model")
@@ -2,10 +2,12 @@ import { describe, expect, test } from "bun:test"
import { buildAvailableSkills } from "./available-skills"
type DiscoveredSkills = Parameters<typeof buildAvailableSkills>[0]
describe("buildAvailableSkills", () => {
test("includes team-mode when team mode is enabled", () => {
// given
const discoveredSkills = []
const discoveredSkills: DiscoveredSkills = []
// when
const availableSkills = buildAvailableSkills(discoveredSkills, undefined, undefined, true)
@@ -16,7 +18,7 @@ describe("buildAvailableSkills", () => {
test("excludes team-mode when team mode is disabled", () => {
// given
const discoveredSkills = []
const discoveredSkills: DiscoveredSkills = []
// when
const availableSkills = buildAvailableSkills(discoveredSkills, undefined, undefined, false)