Skip to content

Commit 0787266

Browse files
mbelinkyMariano Belinky
andauthored
tasks: extract detached task lifecycle runtime (#68886)
* tasks: extract detached task lifecycle runtime * tests: relax gateway seam expectation --------- Co-authored-by: Mariano Belinky <mariano@mb-server-643.local>
1 parent 2ecea93 commit 0787266

22 files changed

Lines changed: 273 additions & 22 deletions

src/acp/control-plane/manager.core.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {
1010
completeTaskRunByRunId,
1111
failTaskRunByRunId,
1212
startTaskRunByRunId,
13-
} from "../../tasks/task-executor.js";
13+
} from "../../tasks/detached-task-runtime.js";
1414
import type { DeliveryContext } from "../../utils/delivery-context.js";
1515
import {
1616
AcpRuntimeError,

src/agents/acp-spawn-parent-stream.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { enqueueSystemEvent } from "../infra/system-events.js";
88
import { scopedHeartbeatWakeOptions } from "../routing/session-key.js";
99
import { normalizeAssistantPhase } from "../shared/chat-message-content.js";
1010
import { normalizeOptionalString } from "../shared/string-coerce.js";
11-
import { recordTaskRunProgressByRunId } from "../tasks/task-executor.js";
11+
import { recordTaskRunProgressByRunId } from "../tasks/detached-task-runtime.js";
1212
import type { DeliveryContext } from "../utils/delivery-context.types.js";
1313

1414
const DEFAULT_STREAM_FLUSH_MS = 2_500;

src/agents/acp-spawn.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ vi.mock("../infra/heartbeat-wake.js", () => ({
122122
areHeartbeatsEnabled: hoisted.areHeartbeatsEnabledMock,
123123
}));
124124

125-
vi.mock("../tasks/task-executor.js", () => ({
125+
vi.mock("../tasks/detached-task-runtime.js", () => ({
126126
createRunningTaskRun: hoisted.createRunningTaskRunMock,
127127
}));
128128

src/agents/acp-spawn.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ import {
5959
normalizeOptionalLowercaseString,
6060
normalizeOptionalString,
6161
} from "../shared/string-coerce.js";
62-
import { createRunningTaskRun } from "../tasks/task-executor.js";
62+
import { createRunningTaskRun } from "../tasks/detached-task-runtime.js";
6363
import {
6464
deliveryContextFromSession,
6565
formatConversationTarget,

src/agents/openclaw-tools.subagents.sessions-spawn.test-harness.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ vi.mock("../config/sessions.js", () => ({
307307
},
308308
}));
309309

310-
vi.mock("../tasks/task-executor.js", () => ({
310+
vi.mock("../tasks/detached-task-runtime.js", () => ({
311311
completeTaskRunByRunId: vi.fn(),
312312
createRunningTaskRun: vi.fn(),
313313
failTaskRunByRunId: vi.fn(),

src/agents/pi-embedded-runner/context-engine-maintenance.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import {
1515
recordTaskRunProgressByRunId,
1616
setDetachedTaskDeliveryStatusByRunId,
1717
startTaskRunByRunId,
18-
} from "../../tasks/task-executor.js";
18+
} from "../../tasks/detached-task-runtime.js";
1919
import {
2020
cancelTaskByIdForOwner,
2121
findTaskByRunIdForOwner,

src/agents/subagent-registry-lifecycle.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ const browserLifecycleCleanupMocks = vi.hoisted(() => ({
2727
cleanupBrowserSessionsForLifecycleEnd: vi.fn(async () => {}),
2828
}));
2929

30-
vi.mock("../tasks/task-executor.js", () => ({
30+
vi.mock("../tasks/detached-task-runtime.js", () => ({
3131
completeTaskRunByRunId: taskExecutorMocks.completeTaskRunByRunId,
3232
failTaskRunByRunId: taskExecutorMocks.failTaskRunByRunId,
3333
setDetachedTaskDeliveryStatusByRunId: taskExecutorMocks.setDetachedTaskDeliveryStatusByRunId,

src/agents/subagent-registry-lifecycle.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {
77
completeTaskRunByRunId,
88
failTaskRunByRunId,
99
setDetachedTaskDeliveryStatusByRunId,
10-
} from "../tasks/task-executor.js";
10+
} from "../tasks/detached-task-runtime.js";
1111
import { normalizeDeliveryContext } from "../utils/delivery-context.js";
1212
import {
1313
captureSubagentCompletionReply,

src/agents/subagent-registry-run-manager.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import type { OpenClawConfig } from "../config/types.openclaw.js";
33
import { callGateway } from "../gateway/call.js";
44
import { createSubsystemLogger } from "../logging/subsystem.js";
55
import { getGlobalHookRunner } from "../plugins/hook-runner-global.js";
6-
import { createRunningTaskRun } from "../tasks/task-executor.js";
6+
import { createRunningTaskRun } from "../tasks/detached-task-runtime.js";
77
import { type DeliveryContext, normalizeDeliveryContext } from "../utils/delivery-context.js";
88
import { waitForAgentRun } from "./run-wait.js";
99
import type { ensureRuntimePluginsLoaded as ensureRuntimePluginsLoadedFn } from "./runtime-plugins.js";

src/agents/tools/media-generate-background-shared.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {
1010
createRunningTaskRun,
1111
failTaskRunByRunId,
1212
recordTaskRunProgressByRunId,
13-
} from "../../tasks/task-executor.js";
13+
} from "../../tasks/detached-task-runtime.js";
1414
import { sendMessage } from "../../tasks/task-registry-delivery-runtime.js";
1515
import type { DeliveryContext } from "../../utils/delivery-context.js";
1616
import { INTERNAL_MESSAGE_CHANNEL } from "../../utils/message-channel.js";

0 commit comments

Comments
 (0)