fix(durable): drop redundant nested-call parent check; test ownedTasks() with a held child

This commit is contained in:
Mario Zechner 2026-10-10 17:40:24 +00:00
parent b9f2b3e827
commit e37cdc4206
2 changed files with 4 additions and 2 deletions

View file

@ -681,7 +681,6 @@ async function startNestedCall(
const input = (await tx.task(existing))?.input as ToolTaskInput | undefined;
const same =
input?.kind === "nested" &&
input.parent === runtime.taskId &&
input.call.name === name &&
jsonEqual(input.call.arguments as JsonValue, call.arguments as JsonValue);
if (!same) throw new Error(`Nested call ${call.id} was already made with another tool or other arguments`);

View file

@ -205,7 +205,7 @@ describe("TaskRuntime.ownedTasks", () => {
let opened = await openTasks(await openNodeSqliteStorage(path), [Hold, Probe]);
const root = await opened.harness.root(context);
opened.harness.resume();
// The probe owns: two held tasks, one that ends, a grandchild below one of them, and a conversation with a task.
// The probe owns: two held tasks, one that ends, a grandchild below the first, and a conversation with a task.
const ids = await root.commit(async (tx) => {
const probe = await tx.createTask(Probe, { name: "probe" }, { ownership: { kind: "conversation" } });
const first = await tx.createTask(Hold, { name: "first" }, { ownership: { kind: "task", taskId: probe } });
@ -222,6 +222,9 @@ describe("TaskRuntime.ownedTasks", () => {
}, context);
gate("ends").resolve();
await opened.harness.waitForTask(ids.ends, context);
// The first ends too, but holds its outcome as `completing` while its grandchild runs: still live, so listed.
gate("first").resolve();
await eventually(async () => (await state(opened.harness, ids.first)).state.status === "completing");
gate("look.probe").resolve();
await eventually(() => owned.has("probe"));
expect(owned.get("probe")).toEqual([ids.first, ids.second]);