mirror of
https://github.com/bytedance/deer-flow.git
synced 2026-09-15 17:18:38 +00:00
* feat(subagents): add capacity controls and durable batches * fix(helm): sync subagent config schema version * fix(subagents): preserve batch history without worker * fix(subagents): support explicit factory runtimes * fix: address durable batch review findings
58 lines
1.5 KiB
TypeScript
58 lines
1.5 KiB
TypeScript
import { beforeEach, describe, expect, it, rs } from "@rstest/core";
|
|
|
|
rs.mock("@/core/api/fetcher", () => ({ fetch: rs.fn() }));
|
|
rs.mock("@/core/config", () => ({ getBackendBaseURL: () => "" }));
|
|
|
|
import { fetch } from "@/core/api/fetcher";
|
|
import { fetchSubagentBatchesCapability } from "@/core/features/api";
|
|
|
|
const mockedFetch = rs.mocked(fetch);
|
|
|
|
function jsonResponse(body: unknown): Response {
|
|
return new Response(JSON.stringify(body), {
|
|
status: 200,
|
|
headers: { "Content-Type": "application/json" },
|
|
});
|
|
}
|
|
|
|
beforeEach(() => {
|
|
mockedFetch.mockReset();
|
|
});
|
|
|
|
describe("subagent batch feature capability", () => {
|
|
it("keeps repository and worker availability independent", async () => {
|
|
mockedFetch.mockResolvedValueOnce(
|
|
jsonResponse({
|
|
agents_api: { enabled: true },
|
|
subagent_batches: {
|
|
enabled: false,
|
|
repository_available: true,
|
|
worker_running: false,
|
|
max_running: 3,
|
|
},
|
|
}),
|
|
);
|
|
|
|
await expect(fetchSubagentBatchesCapability()).resolves.toEqual({
|
|
repositoryAvailable: true,
|
|
workerRunning: false,
|
|
maxRunning: 3,
|
|
});
|
|
});
|
|
|
|
it("falls back to the legacy enabled flag during rolling upgrades", async () => {
|
|
mockedFetch.mockResolvedValueOnce(
|
|
jsonResponse({
|
|
agents_api: { enabled: true },
|
|
subagent_batches: { enabled: true, max_running: 4 },
|
|
}),
|
|
);
|
|
|
|
await expect(fetchSubagentBatchesCapability()).resolves.toEqual({
|
|
repositoryAvailable: true,
|
|
workerRunning: true,
|
|
maxRunning: 4,
|
|
});
|
|
});
|
|
});
|