mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-28 20:46:57 +02:00
test(agents): share subagent spawn workspace fixture
This commit is contained in:
@@ -148,51 +148,40 @@ describe("spawnSubagentDirect workspace inheritance", () => {
|
||||
});
|
||||
});
|
||||
|
||||
it("passes lightweight bootstrap context flags for lightContext subagent spawns", async () => {
|
||||
await spawnSubagentDirect(
|
||||
{
|
||||
task: "inspect workspace",
|
||||
lightContext: true,
|
||||
},
|
||||
{
|
||||
agentSessionKey: "agent:main:main",
|
||||
agentChannel: "telegram",
|
||||
agentAccountId: "123",
|
||||
agentTo: "456",
|
||||
workspaceDir: "/tmp/requester-workspace",
|
||||
},
|
||||
);
|
||||
async function spawnAndReadAgentParams(task: { task: string; lightContext?: boolean }) {
|
||||
await spawnSubagentDirect(task, {
|
||||
agentSessionKey: "agent:main:main",
|
||||
agentChannel: "telegram",
|
||||
agentAccountId: "123",
|
||||
agentTo: "456",
|
||||
workspaceDir: "/tmp/requester-workspace",
|
||||
});
|
||||
|
||||
const agentCall = hoisted.callGatewayMock.mock.calls.find(
|
||||
([request]) => (request as { method?: string }).method === "agent",
|
||||
)?.[0] as { params?: Record<string, unknown> } | undefined;
|
||||
return agentCall?.params;
|
||||
}
|
||||
|
||||
expect(agentCall?.params).toMatchObject({
|
||||
it("passes lightweight bootstrap context flags for lightContext subagent spawns", async () => {
|
||||
const agentParams = await spawnAndReadAgentParams({
|
||||
task: "inspect workspace",
|
||||
lightContext: true,
|
||||
});
|
||||
|
||||
expect(agentParams).toMatchObject({
|
||||
bootstrapContextMode: "lightweight",
|
||||
bootstrapContextRunKind: "default",
|
||||
});
|
||||
});
|
||||
|
||||
it("omits bootstrap context flags for default subagent spawns", async () => {
|
||||
await spawnSubagentDirect(
|
||||
{
|
||||
task: "inspect workspace",
|
||||
},
|
||||
{
|
||||
agentSessionKey: "agent:main:main",
|
||||
agentChannel: "telegram",
|
||||
agentAccountId: "123",
|
||||
agentTo: "456",
|
||||
workspaceDir: "/tmp/requester-workspace",
|
||||
},
|
||||
);
|
||||
const agentParams = await spawnAndReadAgentParams({
|
||||
task: "inspect workspace",
|
||||
});
|
||||
|
||||
const agentCall = hoisted.callGatewayMock.mock.calls.find(
|
||||
([request]) => (request as { method?: string }).method === "agent",
|
||||
)?.[0] as { params?: Record<string, unknown> } | undefined;
|
||||
|
||||
expect(agentCall?.params).not.toHaveProperty("bootstrapContextMode");
|
||||
expect(agentCall?.params).not.toHaveProperty("bootstrapContextRunKind");
|
||||
expect(agentParams).not.toHaveProperty("bootstrapContextMode");
|
||||
expect(agentParams).not.toHaveProperty("bootstrapContextRunKind");
|
||||
});
|
||||
|
||||
it("deletes the provisional child session when a non-thread subagent start fails", async () => {
|
||||
|
||||
Reference in New Issue
Block a user