summaryrefslogtreecommitdiffhomepage
path: root/packages/session-orchestrator/src
diff options
context:
space:
mode:
authorAdam Malczewski <[email protected]>2026-07-01 03:30:42 +0900
committerAdam Malczewski <[email protected]>2026-07-01 03:30:42 +0900
commit665672eccff531f7a785295a8f16e57e98106deb (patch)
tree4a9fd97fd332bbc153987b617e184570c6558706 /packages/session-orchestrator/src
parent6bca0a8b65506239b0ce72d7f86ba96f825152b1 (diff)
parent918b8cddf9013c20943310e0c02a724aecb3fe94 (diff)
downloaddispatch-665672eccff531f7a785295a8f16e57e98106deb.tar.gz
dispatch-665672eccff531f7a785295a8f16e57e98106deb.zip
Merge branch 'feature/mcp-transport-fixes' into predev
Diffstat (limited to 'packages/session-orchestrator/src')
-rw-r--r--packages/session-orchestrator/src/orchestrator.ts5
-rw-r--r--packages/session-orchestrator/src/tools-filter.ts10
2 files changed, 15 insertions, 0 deletions
diff --git a/packages/session-orchestrator/src/orchestrator.ts b/packages/session-orchestrator/src/orchestrator.ts
index badb8dd..a2e141a 100644
--- a/packages/session-orchestrator/src/orchestrator.ts
+++ b/packages/session-orchestrator/src/orchestrator.ts
@@ -819,6 +819,11 @@ export function createSessionOrchestrator(
conversationId,
...(effectiveCwd !== undefined ? { cwd: effectiveCwd } : {}),
...(effectiveComputerId !== undefined ? { computerId: effectiveComputerId } : {}),
+ // Thread the turn's abort signal into the filter chain so a filter
+ // awaiting slow I/O (the MCP tools filter connecting to MCP servers)
+ // can be interrupted by POST /conversations/:id/stop instead of
+ // blocking the turn until its own timeout fires.
+ signal: controller.signal,
});
const dispatch = deps.resolveDispatch?.() ?? defaultDispatchPolicy();
const turnLogger = deps.logger?.child({ conversationId, turnId });
diff --git a/packages/session-orchestrator/src/tools-filter.ts b/packages/session-orchestrator/src/tools-filter.ts
index 28e82bf..22bc5cd 100644
--- a/packages/session-orchestrator/src/tools-filter.ts
+++ b/packages/session-orchestrator/src/tools-filter.ts
@@ -15,6 +15,15 @@ export interface ToolAssembly {
readonly computerId?: string;
/** The conversation this turn belongs to. */
readonly conversationId: string;
+ /**
+ * The turn's abort signal, threaded through the filter chain so a filter that
+ * awaits slow I/O (e.g. the MCP tools filter connecting to MCP servers) can be
+ * interrupted by `POST /conversations/:id/stop` instead of blocking the turn
+ * until its own timeout fires. Optional: omitted by paths that have no turn
+ * controller (e.g. the cache-warm probe), in which case filters fall back to
+ * their own timeouts. Filters that return a fresh assembly MUST preserve it.
+ */
+ readonly signal?: AbortSignal;
}
/** Filter chain run once per turn to transform the tool set before it reaches runTurn. */
@@ -55,5 +64,6 @@ export function filterRemoteIncompatibleTools(assembly: ToolAssembly): ToolAssem
...(assembly.cwd !== undefined ? { cwd: assembly.cwd } : {}),
...(assembly.computerId !== undefined ? { computerId: assembly.computerId } : {}),
conversationId: assembly.conversationId,
+ ...(assembly.signal !== undefined ? { signal: assembly.signal } : {}),
};
}