Skip to content
Open
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
d001bdb
fix(server): cancelling a background-only delegated task reports it i…
only21mil Oct 19, 2026
da285c2
fix(server): end a cancelled task's async questions and prove it acro…
only21mil Oct 19, 2026
ae19059
fix(server): end only the cancelled run's questions, not a later foll…
only21mil Oct 19, 2026
e4630ca
fix(server): tie a cancel's question cleanup to the run it stopped
only21mil Oct 19, 2026
b63b483
fix(server): record the cancelled run when the task settles, not at Stop
only21mil Oct 19, 2026
ed128ea
docs(server): task_cancel keeps a failed result failed
only21mil Oct 19, 2026
af60691
Merge main (af17eb9331) into fix/a4-2-cancel-background-only-task
only21mil Oct 20, 2026
016597c
fix(server): task_cancel settles a follow-up waiting on background work
only21mil Oct 24, 2026
0daef1f
Merge main (3f3a1bf419) into fix/a4-2-cancel-background-only-task
only21mil Oct 24, 2026
dfe8f2e
test(server): task_cancel integration watches start from a fixed cursor
only21mil Oct 24, 2026
a0f6c4b
chore: merge main into delegated cancellation fix
maria-rcks Oct 26, 2026
a24c909
fix(server): commit delegated cancellation with its stop
maria-rcks Oct 26, 2026
3188d3d
fix(server): cancel the active delegated continuation
maria-rcks Oct 26, 2026
2405ed0
fix(server): hold child intake closed during task cancellation
maria-rcks Oct 26, 2026
2a4f6ff
chore: merge main into delegated cancellation fix
maria-rcks Oct 30, 2026
583361e
fix(server): keep delegated cancellation within its held locks
maria-rcks Oct 30, 2026
1c0503d
test(server): accept a pending remote descendant stop
maria-rcks Oct 30, 2026
faea42d
chore: merge main into delegated cancellation fix
maria-rcks Nov 1, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions apps/server/src/mcp/OrchestratorMcpService.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -521,6 +521,7 @@ describe("OrchestratorMcpService", () => {
Ref.update(dispatched, (commands) => [...commands, command]).pipe(
Effect.andThen(Effect.fail(new Error("simulated stop failure") as never)),
),
cancelDelegatedTask: ({ stop }) => stop,
}),
ServerSettings.layerTest(),
Layer.mock(ProviderRegistry.ProviderRegistry)({ getProviders: Effect.succeed([]) }),
Expand Down Expand Up @@ -606,6 +607,7 @@ describe("OrchestratorMcpService", () => {
),
),
stopDelegatedTasks: () => Effect.void,
cancelDelegatedTask: ({ stop }) => stop,
}),
ServerSettings.layerTest(),
Layer.mock(ProviderRegistry.ProviderRegistry)({ getProviders: Effect.succeed([]) }),
Expand Down Expand Up @@ -692,6 +694,7 @@ describe("OrchestratorMcpService", () => {
),
),
stopDelegatedTasks: () => Effect.void,
cancelDelegatedTask: ({ stop }) => stop,
}),
ServerSettings.layerTest(),
Layer.mock(ProviderRegistry.ProviderRegistry)({ getProviders: Effect.succeed([]) }),
Expand Down Expand Up @@ -804,6 +807,7 @@ describe("OrchestratorMcpService", () => {
Ref.update(dispatched, (commands) => [...commands, command]).pipe(
Effect.as({} as never),
),
cancelDelegatedTask: ({ stop }) => stop,
stopDelegatedTasks: () =>
Effect.gen(function* () {
const limit = yield* DispatchModeLimit;
Expand Down
16 changes: 14 additions & 2 deletions apps/server/src/mcp/OrchestratorMcpService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1583,7 +1583,11 @@ const make = Effect.gen(function* () {
: childRun,
)
: workState === "result_available"
? taskStatusForRun(taskResultRun ?? childRun)
? // A cancelled task's finished turn settles it as interrupted.
task.cancelRequestedAt !== undefined &&
taskStatusForRun(taskResultRun ?? childRun) === "completed"
? "interrupted"
: taskStatusForRun(taskResultRun ?? childRun)
: taskStatusForRun(taskResultRun ?? childRun) === "queued"
? "queued"
: "running";
Expand Down Expand Up @@ -2385,7 +2389,7 @@ const make = Effect.gen(function* () {
const stopChild = Effect.gen(function* () {
const commandId = stableCommandId({ scope, requestKey: key, operation: "cancel-task" });
const reason = agentStopReason(input.reason);
yield* threadManagement
const stopThread = threadManagement
.dispatch({
type: "thread.stop",
commandId,
Expand All @@ -2401,6 +2405,14 @@ const make = Effect.gen(function* () {
),
),
);
// An unsettled task records the cancel, so it settles as interrupted once its turn ends.
yield* isTerminalTaskStatus(current.status)
? stopThread
: threadManagement.cancelDelegatedTask({
parentThreadId: scope.thread.threadId,
taskId: input.taskId,
stop: stopThread,
});
yield* threadManagement
.stopDelegatedTasks({ threadId: current.childThreadId, commandId, reason })
.pipe(
Expand Down
Loading
Loading