Skip to content

Add configurable session idle timeout option#1093

Merged
SteveSandersonMS merged 11 commits intomainfrom
mackinnonbuck/add-session-idle-timeout-option
Apr 23, 2026
Merged

Add configurable session idle timeout option#1093
SteveSandersonMS merged 11 commits intomainfrom
mackinnonbuck/add-session-idle-timeout-option

Conversation

@MackinnonBuck
Copy link
Copy Markdown
Collaborator

@MackinnonBuck MackinnonBuck commented Apr 16, 2026

Summary

Adds SDK-side support for configurable session idle timeout across all four SDK languages, addressing github/copilot-sdk-partners#28.

The corresponding runtime changes that add the --session-idle-timeout CLI arg are in github/copilot-agent-runtime#6414.

Changes

Node.js

  • nodejs/src/types.ts -- Added sessionIdleTimeoutSeconds?: number to CopilotClientOptions.
  • nodejs/src/client.ts -- Defaults to 0 (disabled); passes --session-idle-timeout <seconds> to the CLI when positive.
  • nodejs/test/client.test.ts -- Unit tests for default and custom values.

Go

  • go/types.go -- Added SessionIdleTimeoutSeconds int to ClientOptions.
  • go/client.go -- Copies the option in NewClient() and passes --session-idle-timeout <seconds> to the CLI when positive.
  • go/client_test.go -- Unit tests for default and custom values.

Python

  • python/copilot/client.py -- Added session_idle_timeout_seconds: int | None = None to SubprocessConfig; passes --session-idle-timeout <seconds> to the CLI when positive.
  • python/test_client.py -- Unit tests for default and custom values.

.NET

  • dotnet/src/Types.cs -- Added SessionIdleTimeoutSeconds int? to CopilotClientOptions (including copy constructor).
  • dotnet/src/Client.cs -- Passes --session-idle-timeout <seconds> to the CLI when positive.
  • dotnet/test/ClientTests.cs -- Unit tests for default and custom values.
  • dotnet/test/CloneTests.cs -- Clone test updated.

Docs

  • docs/features/session-persistence.md -- Updated the "Automatic Cleanup: Idle Timeout" section to reflect that sessions now have no idle timeout by default and document the new option.

Notes

  • This is a CopilotClientOptions field (server/process level), not a per-session config.
  • The option is only relevant when the SDK spawns the runtime process (not when using cliUrl to connect to an existing server).
  • Minimum value is 300 seconds (5 minutes); validation is handled by the runtime.

@MackinnonBuck MackinnonBuck requested a review from a team as a code owner April 16, 2026 18:28
Copilot AI review requested due to automatic review settings April 16, 2026 18:28
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new Node SDK client option to configure a server-wide session idle timeout and wires it through to the spawned Copilot CLI runtime via a new --session-idle-timeout argument, with accompanying documentation updates.

Changes:

  • Adds sessionIdleTimeoutMs?: number to CopilotClientOptions with documented defaults/minimums.
  • Sets a default of 0 (disabled) and forwards --session-idle-timeout <ms> when configured to a positive value.
  • Updates session persistence docs to describe the new default behavior and configuration caveats (only applies when the SDK spawns the runtime).
Show a summary per file
File Description
nodejs/src/types.ts Introduces the new CopilotClientOptions.sessionIdleTimeoutMs option and documents intended semantics.
nodejs/src/client.ts Applies defaulting and forwards the new option to the CLI as --session-idle-timeout.
docs/features/session-persistence.md Documents the new option, updated defaults, and cliUrl caveat.

Copilot's findings

  • Files reviewed: 3/3 changed files
  • Comments generated: 2

Comment thread nodejs/src/client.ts
Comment thread nodejs/src/client.ts Outdated
@MackinnonBuck MackinnonBuck marked this pull request as draft April 16, 2026 20:24
MackinnonBuck and others added 4 commits April 16, 2026 16:45
Add a new optional sessionIdleTimeoutMs field to CopilotClientOptions that
allows consumers to configure the server-wide session idle timeout. When set
to a positive value, the SDK passes --session-idle-timeout to the CLI process.

Sessions have no idle timeout by default (infinite lifetime). The minimum
configurable value is 300000ms (5 minutes).

Also updates the session persistence documentation to reflect the new
default behavior and configuration option.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@MackinnonBuck MackinnonBuck force-pushed the mackinnonbuck/add-session-idle-timeout-option branch from f3008df to ede32da Compare April 16, 2026 23:52
@github-actions

This comment has been minimized.

Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generated by SDK Consistency Review Agent for issue #1093 · ● 603.8K

Comment thread nodejs/src/types.ts
Add the session idle timeout option across all remaining SDK languages,
consistent with the Node.js implementation and the runtime CLI's
--session-idle-timeout flag.

- Go: SessionIdleTimeoutSeconds int on ClientOptions
- Python: session_idle_timeout_seconds on SubprocessConfig
- .NET: SessionIdleTimeoutSeconds int? on CopilotClientOptions

Each SDK passes --session-idle-timeout <seconds> to the CLI when the
value is positive, and omits it otherwise (disabled by default).

Includes unit tests for all three languages and updates the .NET clone
test to cover the new property.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions

This comment has been minimized.

Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generated by SDK Consistency Review Agent for issue #1093 · ● 278.9K

Comment thread nodejs/src/types.ts
Comment thread python/copilot/client.py
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions

This comment has been minimized.

Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generated by SDK Consistency Review Agent for issue #1093 · ● 291.2K

Comment thread nodejs/src/types.ts
MackinnonBuck and others added 2 commits April 21, 2026 10:31
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions

This comment has been minimized.

The runtime does not enforce a minimum value for the session idle
timeout - any positive value is accepted. Remove the 'Minimum value:
300 (5 minutes)' note from all SDK docstrings and docs.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions

This comment has been minimized.

The option was only copied when > 0, which silently normalized negative
inputs. Other SDKs preserve the caller's value and gate only at spawn
time. Align Go to match.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions
Copy link
Copy Markdown
Contributor

Cross-SDK Consistency Review ✅

This PR maintains excellent cross-language consistency for the new sessionIdleTimeoutSeconds option. Here's a quick breakdown:

SDK Field name Type Default CLI arg
Node.js sessionIdleTimeoutSeconds number? 0 (normalized) --session-idle-timeout
Python session_idle_timeout_seconds int | None None --session-idle-timeout
Go SessionIdleTimeoutSeconds int 0 --session-idle-timeout
.NET SessionIdleTimeoutSeconds int? null --session-idle-timeout

Observations:

  • ✅ All four SDKs implement the feature
  • ✅ Naming conventions are correctly adapted per language (camelCase / snake_case / PascalCase)
  • ✅ CLI argument (--session-idle-timeout) is identical across all SDKs
  • ✅ Disable behavior is consistent: 0, None, or null all skip passing the flag
  • ✅ Documentation updated, tests added for all four SDKs
  • ✅ Python correctly places the option on SubprocessConfig (semantically accurate since it only applies in subprocess mode); this matches the existing pattern in that SDK

Minor note (no action needed): Go uses a non-nullable int (zero = disabled) while .NET and Python use nullable types. This is idiomatic per language and the runtime behavior is identical.

No consistency gaps found. 🎉

Generated by SDK Consistency Review Agent for issue #1093 · ● 166.9K ·

@MackinnonBuck MackinnonBuck marked this pull request as ready for review April 21, 2026 18:33
@SteveSandersonMS SteveSandersonMS added this pull request to the merge queue Apr 23, 2026
Merged via the queue into main with commit b4ef955 Apr 23, 2026
55 checks passed
@SteveSandersonMS SteveSandersonMS deleted the mackinnonbuck/add-session-idle-timeout-option branch April 23, 2026 09:37
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.

3 participants