Tool call hangs after extension startup fails
Chưa có ai nhận issue này.
- Ngôn ngữ chính
- Shell
- Star
- 11.2k
- Fork
- 1.9k
- Merge trung bình
- 14 giờ 16 phút
- Pull request đã merge (30 ngày)
- 6
Mô tả
Describe the bug
After I resumed a large session, an extension failed inside joinSession() before reporting ready, and its process exited.
The CLI continued to offer the extension's custom tool. I asked the CLI to call it. The CLI started the call, but the handler did not run and the call reported no error. I aborted it after 9 minutes 38 seconds.
This issue concerns cleanup and dispatch after extension startup failure. A separate large-session attachment defect triggered the failure in this run.
Environment
GitHub Copilot CLI 1.0.82
@github/copilot-sdk 1.0.9-preview.2
Node.js v24.18.1
Linux x86_64
Confirmed startup trigger
I traced the installed 1.0.82 app.js bundle. joinSession() sends a session.resume request containing registration options rather than session history. The host still serializes the resident session's full event array while attaching the extension:
handleSessionResumeCore()handlessession.resumeand calls the host'sinitializeSession()withreplayEvents: false.- The host's
initializeSession()ignores that option and passessession.getEvents()toseamHost.initializeSession(). seamHost.initializeSession()callsJSON.stringify(events).
Node.js v24.18.1 rejects JavaScript strings longer than 536,870,888 UTF-16 code units and throws Invalid string length. I estimated each serialized event array's length from its session event log. Extension attachment succeeded below the limit and failed above it.
In the run that reproduced the stale registration, joinSession() failed with Invalid string length. That session's events.jsonl file was about 1.2 GB.
Honoring replayEvents: false would remove this trigger. Registration cleanup must still handle every startup failure.
Reduced extension
import { writeFile } from "node:fs/promises";
import { joinSession } from "@github/copilot-sdk/extension";
await joinSession({
tools: [{
name: "stale_tool_probe",
description: "Verify extension tool lifecycle.",
parameters: {
type: "object",
properties: {},
additionalProperties: false,
},
skipPermission: true,
handler: async () => {
await writeFile(
new URL("handler-ran.marker", import.meta.url),
"handler ran\n",
);
return "handler-ran";
},
}],
});
Observed sequence
- I stored the reduced extension under
~/.copilot/session-state/<session-id>/extensions/stale-tool-probe/extension.mjs. - I resumed the large session.
joinSession()failed withInvalid string lengthbefore the extension reported ready, and the extension process exited.- I asked the CLI to call
stale_tool_probe. The CLI started the call instead of rejecting it as an unknown tool. - The call was still pending when I aborted it.
handler-ran.markerdid not appear.
Expected behavior
- The CLI offers an extension's registrations only while the extension is ready and connected.
- Startup failure or process exit removes every registration owned by that extension.
- A tool call fails promptly if its owning extension is unavailable at dispatch or exits while the call is pending.
Actual behavior
- The failed extension's tool remained available after its process exited.
- The call did not reach the handler or report an error.
Related issues
#4590 reports a different session.resume failure involving hook-processor disposal during extension reconnects.
#3856 reports the inverse symptom: Extension tools disappear after a resume.
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Hướng nghiên cứu
Bắt đầu với vòng đời extension xung quanh joinSession(), handleSessionResumeCore(), initializeSession() và seamHost.initializeSession(), sử dụng extension stale_tool_probe được tái hiện làm điểm bắt đầu. Truy vết lỗi khởi động, việc dọn dẹp các đăng ký và dispatch trong khi process không khả dụng. Được xem là hoàn tất khi các extension bị lỗi hoặc đã thoát không còn expose các đăng ký, và các lệnh gọi tool đang chờ hoặc mới sẽ fail ngay thay vì bị treo.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- javascript, node.js
- Lĩnh vực
- backend, cli
- Loại issue
- Lỗi
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức độ hoạt động
- Sôi nổi
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 64/100