FLEET: resumeSession() with customAgents errors with malformed timeout message "[object Object]ms"
- Ngôn ngữ chính
- Java
- Star
- 10.5k
- Fork
- 1.5k
- Merge trung bình
- 1 ngày 11 giờ
- Pull request đã merge (30 ngày)
- 128
Mô tả
## Summary
Calling `client.resumeSession(sessionId, { customAgents: [...] })` on a live session produces a timeout error with a malformed message: `"Timeout after [object Object]ms"`. This reveals two bugs: (1) `resumeSession` with `customAgents` fails, and (2) the timeout value is being stringified via implicit `.toString()` instead of extracting the numeric value.
## Steps to Reproduce
```javascript
import { CopilotClient, approveAll } from '@github/copilot-sdk';
const client = new CopilotClient();
await client.start();
const session = await client.createSession({ onPermissionRequest: approveAll });
const sessionId = session.id;
await session.destroy();
try {
const resumed = await client.resumeSession(sessionId, {
onPermissionRequest: approveAll,
customAgents: [{
name: 'post-creation-agent',
displayName: 'Post Creation Agent',
description: 'Added during resume',
prompt: 'You are a post-creation agent.',
tools: ['view'],
infer: false,
}],
});
} catch (err) {
console.error(err.message);
// → "Timeout after [object Object]ms waiting for session.idle"
}
```
## Observed Behaviour
Spike data (2026-03-17):
```json
{
"resumeSucceeded": false,
"resumeError": "Timeout after [object Object]ms waiting for session.idle",
"answer": "NO/ERROR"
}
```
## Bug 1: resumeSession with customAgents fails
The TypeScript type `ResumeSessionConfig` accepts `customAgents`, but the CLI backend appears to reject or ignore it and the session never reaches `idle`. Either:
- `customAgents` is not supported on resume (the type should exclude it), or
- There is a backend defect handling `customAgents` in `session.resume`
## Bug 2: Malformed timeout error message
`"Timeout after [object Object]ms"` is a string formatting bug. The timeout config value (likely `{ ms: number }` or similar) is being coerced to string via `.toString()` instead of extracting the numeric value.
Expected: `"Timeout after 30000ms waiting for session.idle"`
## Workaround
Only set `customAgents` at initial `createSession` time. Do not attempt to add agents via `resumeSession`:
```javascript
// ✅ Works
const session = await client.createSession({
onPermissionRequest: approveAll,
customAgents: [{ name: 'my-agent', ... }],
});
// ❌ Errors with malformed timeout
const session = await client.resumeSession(id, {
customAgents: [{ name: 'my-agent', ... }],
});
```
## Environment
- SDK: `@github/copilot-sdk` v0.1.32
- CLI: latest
- Node: v24.13.1
Hướng dẫn đóng góp
Hướng nghiên cứu
Bắt đầu từ TypeScript ResumeSessionConfig và điểm vào resumeSession(sessionId, ...), sau đó so sánh cách xử lý customAgents với createSession. Theo dõi đường dẫn session.resume và cách định dạng lỗi timeout. Hoàn thành khi hành vi của customAgents lúc tiếp tục phiên được hỗ trợ hoặc bị từ chối một cách rõ ràng, và các thông báo timeout hiển thị một giá trị số thay vì [object Object].
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, typescript
- Lĩnh vực
- api, backend
- Loại issue
- Lỗi
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức độ hoạt động
- Ít trao đổi
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 48/100