MCPcopy Create free account
hub / github.com/compozy/agh / TestSpawnCommandMapsBoundedChildRequest

Function TestSpawnCommandMapsBoundedChildRequest

internal/cli/agent_kernel_test.go:118–239  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

116}
117
118func TestSpawnCommandMapsBoundedChildRequest(t *testing.T) {
119 t.Parallel()
120
121 t.Run("Should map bounded child request", func(t *testing.T) {
122 t.Parallel()
123
124 var gotRequest AgentSpawnRequest
125 client := &stubClient{}
126 deps := newAgentCommandTestDeps(t, client)
127 client.agentSpawnFn = func(
128 _ context.Context,
129 request AgentSpawnRequest,
130 credentials agentidentity.Credentials,
131 ) (AgentSpawnRecord, error) {
132 assertAgentCredentials(t, credentials)
133 gotRequest = request
134 ttl := fixedTestNow.Add(2 * time.Minute)
135 return AgentSpawnRecord{
136 Session: SessionRecord{
137 ID: "sess-child",
138 Name: request.Name,
139 AgentName: request.AgentName,
140 Provider: request.Provider,
141 WorkspaceID: "ws-1",
142 WorkspacePath: "/workspace/project",
143 Channel: "builders",
144 Type: session.SessionTypeSpawned,
145 State: session.StateActive,
146 CreatedAt: fixedTestNow,
147 UpdatedAt: fixedTestNow,
148 },
149 Lineage: contract.SessionLineagePayload{
150 ParentSessionID: "sess-agent",
151 RootSessionID: "sess-agent",
152 SpawnDepth: 1,
153 SpawnRole: request.SpawnRole,
154 TTLExpiresAt: &ttl,
155 AutoStopOnParent: request.AutoStopOnParent,
156 SpawnBudget: contract.SpawnBudgetPayload{
157 MaxChildren: 5,
158 MaxDepth: 1,
159 TTLSeconds: request.TTLSeconds,
160 },
161 PermissionPolicy: request.Permissions,
162 },
163 Permissions: request.Permissions,
164 }, nil
165 }
166
167 stdout, _, err := executeRootCommand(
168 t,
169 deps,
170 "spawn",
171 "--agent",
172 "coder",
173 "--provider",
174 "codex",
175 "--model",

Callers

nothing calls this directly

Calls 5

newAgentCommandTestDepsFunction · 0.85
assertAgentCredentialsFunction · 0.85
executeRootCommandFunction · 0.85
RunMethod · 0.65
AddMethod · 0.45

Tested by

no test coverage detected