revert #6130: doesn't really work well

This commit is contained in:
can1357
2026-07-22 23:54:15 +02:00
parent 59877a01bd
commit 242bcbef8c
11 changed files with 130 additions and 309 deletions
@@ -125,30 +125,19 @@ describe("task.batch schema gating", () => {
expect(items?.properties?.schemaMode).toBeDefined();
});
it("places isolation controls per item in the batch shape and top-level in the flat shape", async () => {
it("places isolated per item in the batch shape when isolation is enabled", async () => {
mockDiscovery();
const batch = await TaskTool.create(
const tool = await TaskTool.create(
createSession({ settings: { "task.batch": true, "task.isolation.mode": "auto" } }),
);
const batchProperties = getSchemaProperties(batch);
expect(batchProperties.isolated).toBeUndefined();
expect(batchProperties.apply).toBeUndefined();
const items = (batchProperties.tasks as { items?: { properties?: Record<string, unknown> } }).items;
const properties = getSchemaProperties(tool);
expect(properties.isolated).toBeUndefined();
const items = (properties.tasks as { items?: { properties?: Record<string, unknown> } }).items;
expect(items?.properties?.isolated).toBeDefined();
expect(items?.properties?.apply).toBeDefined();
expect(batch.description).toContain("`apply`");
expect(batch.description).toContain("without modifying the parent");
const flat = await TaskTool.create(
createSession({ settings: { "task.batch": false, "task.isolation.mode": "auto" } }),
);
const flatProperties = getSchemaProperties(flat);
expect(flatProperties.isolated).toBeDefined();
expect(flatProperties.apply).toBeDefined();
});
it("hides isolation controls from the dynamic batch schema in plan mode", async () => {
it("hides isolation from the dynamic batch schema in plan mode", async () => {
mockDiscovery();
const tool = await TaskTool.create(
createSession({
@@ -159,9 +148,7 @@ describe("task.batch schema gating", () => {
const properties = getSchemaProperties(tool);
const items = (properties.tasks as { items?: { properties?: Record<string, unknown> } }).items;
expect(items?.properties?.isolated).toBeUndefined();
expect(items?.properties?.apply).toBeUndefined();
expect(tool.description).not.toContain("`isolated`");
expect(tool.description).not.toContain("`apply`");
});
it("exposes outputSchema but never the stale schema field", async () => {
@@ -225,22 +212,6 @@ describe("task.batch validation", () => {
expect(text).toContain("Missing `context`");
});
it("rejects apply without effective isolation before spawning", async () => {
const runSubprocess = vi.spyOn(executorModule, "runSubprocess");
const flat = await executeText(
{ agent: "task", task: "Work.", apply: false },
{ "task.batch": false, "task.isolation.mode": "worktree" },
);
expect(flat).toContain("`apply` control requires `isolated: true`");
const batch = await executeText(
{ context: "Shared.", tasks: [{ task: "Work.", isolated: false, apply: false }] },
{ "task.batch": true, "task.isolation.mode": "worktree" },
);
expect(batch).toContain("`apply` control requires `isolated: true`");
expect(runSubprocess).not.toHaveBeenCalled();
});
it("rejects duplicate provided names case-insensitively", async () => {
const text = await executeText(
{