Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 27, 2026

Sessions auto-close after 35 minutes of idle time, causing "Session not found" errors. The issue description and agent instructions suggest removing timeout/reaping/touch logic from the SDK clients.

Investigation Result

No timeout logic exists in the SDK. Exhaustive search across all clients (Node.js, Python, Go, .NET) confirms:

  • No session.touch or keep-alive RPC calls
  • No session activity tracking (lastTouched, lastActivity)
  • No timer/interval-based cleanup code
  • No timeout configuration options

All SDK clients are stateless JSON-RPC wrappers. They only call: session.create, session.resume, session.send, session.getMessages, session.destroy, session.abort, session.delete, session.list, session.getLastId.

Root Cause

The 35-minute (2094s) timeout is implemented in the Copilot CLI server (separate codebase). Evidence from issue logs:

[WARNING] Session ... has been idle for 2094s, cleaning up
[INFO] Closing session ...
[INFO] Cleaned up stale session: ...

These logs originate from the CLI server process, not the SDK.

Action Required

The timeout removal must be made in the Copilot CLI server codebase, not this SDK repository. No SDK changes needed.

Original prompt

This section details on the original issue you should resolve

<issue_title>session auto-closes after 35m of idle time</issue_title>
<issue_description>This was unexpected & not mentioned in the docs. The downstream effects of this is that any reference to a sessionId or a CopilotSession must always attempt to manually resume(). This is more likely to occur after #76 since long-running sessions are now better enabled.

Reproduction

  • create a session / send message
  • wait 35m of idle time (2094s)
  • attempt to send new message into same session

Error

error: Request session.send failed with message: Session not found: b23dfbfc-32f5-4eb3-a90c-1b476a180a75
 code: -32603,
 data: undefined,
[vm:01KFXZ9B]
      at handleResponse (/.../node_modules/.bun/vscode-jsonrpc@8.2.1/node_modules/vscode-jsonrpc/lib/common/connection.js:565:48)
      at handleMessage (/.../node_modules/.bun/vscode-jsonrpc@8.2.1/node_modules/vscode-jsonrpc/lib/common/connection.js:345:13)
      at processMessageQueue (/.../node_modules/.bun/vscode-jsonrpc@8.2.1/node_modules/vscode-jsonrpc/lib/common/connection.js:362:17)
      at <anonymous> (/.../node_modules/.bun/vscode-jsonrpc@8.2.1/node_modules/vscode-jsonrpc/lib/common/connection.js:334:13)

Copilot logs

2026-01-26T20:18:58.553Z [INFO] Successfully downloaded package, restart to update to version 0.0.395
2026-01-26T20:53:24.433Z [WARNING] Session b23dfbfc-32f5-4eb3-a90c-1b476a180a75 has been idle for 2094s, cleaning up
2026-01-26T20:53:24.434Z [INFO] Closing session b23dfbfc-32f5-4eb3-a90c-1b476a180a75
2026-01-26T20:53:24.434Z [INFO] Cleaned up stale session: b23dfbfc-32f5-4eb3-a90c-1b476a180a75
2026-01-26T20:55:22.749Z [ERROR] Session not found: b23dfbfc-32f5-4eb3-a90c-1b476a180a75
```</issue_description>

<agent_instructions>We actually don't need the timeout/reaping stale session/touch logic, let's just remove all of that code in the nodejs client. Look at the other clients to make sure we're not doing the same thing and remove that logic too if needed. Update/delete any tests made irrelevant after this change.</agent_instructions>

## Comments on the Issue (you are @copilot in this section)

<comments>
<comment_new><author>@friggeri</author><body>
Thanks for the report @lukeed, there are a couple of ways we could tackle this, let me chat with the team and get back to you.</body></comment_new>
</comments>


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI changed the title [WIP] Fix session auto-closes after 35 minutes of idle time Confirm SDK has no session timeout logic - issue is in CLI server Jan 27, 2026
Copilot AI requested a review from friggeri January 27, 2026 19:08
@friggeri friggeri closed this Jan 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

session auto-closes after 35m of idle time

2 participants