Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Feature request: Plumb AbortSignal through ToolInvocation so session.abort() can cancel in-flight tool handlers

オープン
#1,433 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
45/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
静か
技術スタック
node.js, typescript
領域
api

調査の方向性

types.d.ts にある言及された ToolInvocation 宣言と、session.js にある _executeToolAndRespond および session.abort() から始めます。既存のキャンセルフローとハンドラーの呼び出しを追跡し、その後、キャンセルの動作と互換性に関する期待事項を定義します。実行中のハンドラーが既存のハンドラーを壊すことなくキャンセルを検知できれば完了です。

索引モデルが issue の本文から書いたものです。

説明

enhancement

Feature request: Plumb AbortSignal through ToolInvocation so session.abort() can cancel in-flight tool handlers

Summary

session.abort() cancels the agentic loop (no further tool calls scheduled) but does not propagate cancellation into a currently-executing tool handler. The handler runs to completion regardless. This forces SDK consumers building wedge-recovery to implement OS-level process tree kills at their own layer, when the cooperative cancellation primitive could live in the SDK.

Verified state at @github/copilot-sdk (dist/)

1. ToolInvocation interface (types.d.ts:224-233):

export interface ToolInvocation {
    sessionId: string;
    toolCallId: string;
    toolName: string;
    arguments: unknown;
    /** W3C Trace Context traceparent from the CLI's execute_tool span. */
    traceparent?: string;
    /** W3C Trace Context tracestate from the CLI's execute_tool span. */
    tracestate?: string;
}

No signal, no abortSignal, no cancellation handle.

2. _executeToolAndRespond (session.js:278-309):

async _executeToolAndRespond(requestId, toolName, toolCallId, args, handler, traceparent, tracestate) {
  try {
    const rawResult = await handler(args, { sessionId, toolCallId, toolName, arguments: args, traceparent, tracestate });
    ...
  } catch (error) { ... }
}

Handler is awaited synchronously; no signal threaded through; no race against an abort source.

3. session.abort() (session.js:765-769):

async abort() {
  await this.connection.sendRequest("session.abort", { sessionId: this.sessionId });
}

JSDoc: "and can continue to be used for new messages" + "resolves when the abort request is acknowledged." Confirms scope is the agentic loop, not the handler.

4. Searched node_modules/@github/copilot-sdk/dist/ for AbortSignal|AbortController|signal:|cancel\(|cancellation: zero matches.

Proposed API

Add an optional AbortSignal to ToolInvocation that aborts when session.abort() (or a new session.cancelToolCall(toolCallId)) is called:

export interface ToolInvocation {
    sessionId: string;
    toolCallId: string;
    toolName: string;
    arguments: unknown;
    /** Aborts when session.abort() or session.cancelToolCall(toolCallId) is invoked. */
    signal: AbortSignal;
    traceparent?: string;
    tracestate?: string;
}

Optional addition: a more granular session.cancelToolCall(toolCallId) that cancels a specific in-flight handler without aborting the broader agentic loop.

Why it matters

Without handler-level cancellation, consumers building wedge-recovery (long-running shell handlers, network calls, file I/O on large files) must:

  1. Track child PIDs at handler-spawn or via shell tool event streams,
  2. Issue OS-level kills (Windows taskkill /F /T /PID, POSIX SIGKILL fan-out across descendant tree),
  3. Re-probe survivors with bounded wait,
  4. Manage orphan-leak edge cases.

That's ~125 lines of code per consumer plus cross-platform paths. A cooperative AbortSignal in the SDK lets handlers self-terminate cleanly — fetch(url, { signal }), await sleep(ms, { signal }), child_process.spawn(...).on(signal.aborted, kill) — which is the well-trodden Node.js cancellation idiom.

Backwards compatibility

AbortSignal is non-required for handlers that don't consume it (existing handlers continue to work). Handlers that opt in get cooperative cancellation; the SDK keeps its existing process-isolation guarantees.

Concrete consumer evidence

Parley (multi-agent orchestration system built on @github/copilot-sdk) ships at present a 313-line wedge-kill primitive in our orchestrator (Windows taskkill /F /T /PID + POSIX SIGKILL fan-out + bounded post-kill verify + tracker reset) that exists specifically because session.abort() doesn't propagate. With this feature, that primitive would be ~30 lines of if (signal.aborted) cleanup() in the consumer's tool handlers.

Workaround until landed

OS-level process tree kill via tracked child PIDs from tool start events, gated by a bounded post-kill verify. Functional but not durable. Issue tracks the durable layer.

Affected versions

Verified against @github/copilot-sdk shipped in current Parley node_modules snapshot (May 2026). Please confirm whether the proposed API has been considered or is on the roadmap.

主要言語
TypeScript
スター
10.5k
フォーク
1.5k
平均マージ
1日 7時間
マージ済み PR(30日)
98

環境構築

Codespaces で開く

このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

github/copilot-sdk のほかの issue

github/copilot-sdk の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。