Skip to content

Commit 6c993aa

Browse files
committed
docs: document EnableSessionStore and one-shot session guidance
Add EnableSessionStore to SessionConfig documentation and a new One-shot / Hosted Environments section across all language READMEs. Explains when to disable infinite sessions and the session store in ephemeral containers to avoid unnecessary SQLite persistence. Related to #1814
1 parent 8c3ecbd commit 6c993aa

6 files changed

Lines changed: 135 additions & 0 deletions

File tree

dotnet/README.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ Create a new conversation session.
125125
- `Provider` - Custom API provider configuration (BYOK)
126126
- `Streaming` - Enable streaming of response chunks (default: false)
127127
- `InfiniteSessions` - Configure automatic context compaction (see below)
128+
- `EnableSessionStore` - Enables the cross-session store for search and retrieval across sessions. When unset in `CopilotCli` mode, the runtime default applies (enabled). In `Empty` mode, defaults to disabled. See [One-shot / Hosted Environments](#one-shot--hosted-environments).
128129
- `OnPermissionRequest` - Optional handler called before each tool execution to approve or deny it. When omitted, permission requests are emitted as events and left pending for manual resolution. Use `PermissionHandler.ApproveAll` to allow everything, or provide a custom function for fine-grained control. See [Permission Handling](#permission-handling) section.
129130
- `OnUserInputRequest` - Handler for user input requests from the agent (enables ask_user tool). See [User Input Requests](#user-input-requests) section.
130131
- `Hooks` - Hook handlers for session lifecycle events. See [Session Hooks](#session-hooks) section.
@@ -416,6 +417,27 @@ When enabled, sessions emit compaction events:
416417
- `SessionCompactionStartEvent` - Background compaction started
417418
- `SessionCompactionCompleteEvent` - Compaction finished (includes token counts)
418419

420+
## One-shot / Hosted Environments
421+
422+
When running the SDK in ephemeral containers or other one-shot environments (one request per container), the default session configuration enables SQLite-backed persistence features that you typically do not need:
423+
424+
- **Infinite sessions** — background compaction and workspace persistence (enabled by default)
425+
- **Session store** — cross-session search and retrieval via a shared SQLite store (enabled by default in `CopilotCli` mode when `EnableSessionStore` is unset)
426+
427+
In restricted or short-lived environments, explicitly disable both to avoid unnecessary disk I/O and transient SQLite lock errors:
428+
429+
```csharp
430+
var session = await client.CreateSessionAsync(new SessionConfig
431+
{
432+
Model = "gpt-5",
433+
EnableSessionStore = false,
434+
InfiniteSessions = new InfiniteSessionConfig { Enabled = false },
435+
OnPermissionRequest = PermissionHandler.ApproveAll,
436+
});
437+
```
438+
439+
In `CopilotClientMode.Empty`, the SDK already defaults `EnableSessionStore` to `false`; in the default `CopilotCli` mode, you must set it explicitly.
440+
419441
## Memory
420442

421443
Sessions can opt into persistent memory, allowing the agent to read and write memory across turns. Memory is configured per session and applies to both `CreateSessionAsync` and `ResumeSessionAsync`.

go/README.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,7 @@ Event types: `SessionLifecycleCreated`, `SessionLifecycleDeleted`, `SessionLifec
169169
- `Provider` (\*ProviderConfig): Custom API provider configuration (BYOK). See [Custom Providers](#custom-providers) section.
170170
- `Streaming` (*bool): Enable streaming delta events (nil = runtime default)
171171
- `InfiniteSessions` (\*InfiniteSessionConfig): Automatic context compaction configuration
172+
- `EnableSessionStore` (\*bool): Enables the cross-session store for search and retrieval across sessions. When unset in `ModeCopilotCli`, the runtime default applies (enabled). In `ModeEmpty`, defaults to disabled. See [One-shot / Hosted Environments](#one-shot--hosted-environments).
172173
- `OnPermissionRequest` (PermissionHandlerFunc): Optional handler called before each tool execution to approve or deny it. When nil, permission requests are emitted as events and left pending for manual resolution. Use `copilot.PermissionHandler.ApproveAll` to allow everything, or provide a custom function for fine-grained control. See [Permission Handling](#permission-handling) section.
173174
- `OnUserInputRequest` (UserInputHandler): Handler for user input requests from the agent (enables ask_user tool). See [User Input Requests](#user-input-requests) section.
174175
- `Hooks` (\*SessionHooks): Hook handlers for session lifecycle events. See [Session Hooks](#session-hooks) section.
@@ -507,6 +508,29 @@ When enabled, sessions emit compaction events:
507508
- `session.compaction_start` - Background compaction started
508509
- `session.compaction_complete` - Compaction finished (includes token counts)
509510

511+
## One-shot / Hosted Environments
512+
513+
When running the SDK in ephemeral containers or other one-shot environments (one request per container), the default session configuration enables SQLite-backed persistence features that you typically do not need:
514+
515+
- **Infinite sessions** — background compaction and workspace persistence (enabled by default)
516+
- **Session store** — cross-session search and retrieval via a shared SQLite store (enabled by default in `ModeCopilotCli` when `EnableSessionStore` is unset)
517+
518+
In restricted or short-lived environments, explicitly disable both to avoid unnecessary disk I/O and transient SQLite lock errors:
519+
520+
```go
521+
falseVal := false
522+
session, _ := client.CreateSession(context.Background(), &copilot.SessionConfig{
523+
Model: "gpt-5",
524+
EnableSessionStore: &falseVal,
525+
InfiniteSessions: &copilot.InfiniteSessionConfig{
526+
Enabled: copilot.Bool(false),
527+
},
528+
OnPermissionRequest: copilot.PermissionHandler.ApproveAll,
529+
})
530+
```
531+
532+
In `ModeEmpty`, the SDK already defaults `EnableSessionStore` to `false`; in the default `ModeCopilotCli` mode, you must set it explicitly.
533+
510534
## Memory
511535

512536
Sessions can opt in to the memory feature, which lets the agent persist and recall

java/README.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,30 @@ Or run it directly from the repository:
132132
jbang https://github.com/github/copilot-sdk/blob/main/java/jbang-example.java
133133
```
134134

135+
## One-shot / Hosted Environments
136+
137+
When running the SDK in ephemeral containers or other one-shot environments (one request per container), the default session configuration enables SQLite-backed persistence features that you typically do not need:
138+
139+
- **Infinite sessions** — background compaction and workspace persistence (enabled by default)
140+
- **Session store** — cross-session search and retrieval via a shared SQLite store (enabled by default in `CopilotClientMode.COPILOT_CLI` when `enableSessionStore` is unset)
141+
142+
In restricted or short-lived environments, explicitly disable both to avoid unnecessary disk I/O and transient SQLite lock errors:
143+
144+
```java
145+
import com.github.copilot.rpc.InfiniteSessionConfig;
146+
import com.github.copilot.rpc.PermissionHandler;
147+
import com.github.copilot.rpc.SessionConfig;
148+
149+
var session = client.createSession(new SessionConfig()
150+
.setOnPermissionRequest(PermissionHandler.APPROVE_ALL)
151+
.setModel("gpt-5")
152+
.setEnableSessionStore(false)
153+
.setInfiniteSessions(new InfiniteSessionConfig().setEnabled(false))
154+
).get();
155+
```
156+
157+
In `CopilotClientMode.EMPTY`, the SDK already defaults `enableSessionStore` to `false`; in the default `CopilotClientMode.COPILOT_CLI` mode, you must set it explicitly.
158+
135159
## Memory
136160

137161
Sessions can opt into persistent memory, allowing the agent to read and write memory across turns. Memory is configured per session and applies to both `createSession` and `resumeSession`.

nodejs/README.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ Create a new conversation session.
127127
- `tools?: Tool[]` - Custom tools exposed to the CLI. Tools without `handler` are declaration-only and must be resolved via pending tool-call RPCs.
128128
- `systemMessage?: SystemMessageConfig` - System message customization (see below)
129129
- `infiniteSessions?: InfiniteSessionConfig` - Configure automatic context compaction (see below)
130+
- `enableSessionStore?: boolean` - Enables the cross-session store for search and retrieval across sessions. When unset in `"copilot-cli"` mode, the runtime default applies (enabled). In `"empty"` mode, defaults to disabled. See [One-shot / Hosted Environments](#one-shot--hosted-environments).
130131
- `provider?: ProviderConfig` - Custom API provider configuration (BYOK - Bring Your Own Key). See [Custom Providers](#custom-providers) section.
131132
- `onPermissionRequest?: PermissionHandler` - Optional handler called before each tool execution to approve or deny it. When omitted, permission requests are emitted as events and left pending for manual resolution. Use `approveAll` to allow everything, or provide a custom function for fine-grained control. See [Permission Handling](#permission-handling) section.
132133
- `onUserInputRequest?: UserInputHandler` - Handler for user input requests from the agent. Enables the `ask_user` tool. See [User Input Requests](#user-input-requests) section.
@@ -680,6 +681,26 @@ When enabled, sessions emit compaction events:
680681
- `session.compaction_start` - Background compaction started
681682
- `session.compaction_complete` - Compaction finished (includes token counts)
682683

684+
### One-shot / Hosted Environments
685+
686+
When running the SDK in ephemeral containers or other one-shot environments (one request per container), the default session configuration enables SQLite-backed persistence features that you typically do not need:
687+
688+
- **Infinite sessions** — background compaction and workspace persistence (enabled by default)
689+
- **Session store** — cross-session search and retrieval via a shared SQLite store (enabled by default in `"copilot-cli"` mode when `enableSessionStore` is unset)
690+
691+
In restricted or short-lived environments, explicitly disable both to avoid unnecessary disk I/O and transient SQLite lock errors:
692+
693+
```typescript
694+
const session = await client.createSession({
695+
model: "gpt-5",
696+
enableSessionStore: false,
697+
infiniteSessions: { enabled: false },
698+
onPermissionRequest: approveAll,
699+
});
700+
```
701+
702+
In `"empty"` mode, the SDK already defaults `enableSessionStore` to `false`; in the default `"copilot-cli"` mode, you must set it explicitly.
703+
683704
### Memory
684705

685706
Sessions can opt in to the memory feature, which lets the agent persist and recall

python/README.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,7 @@ These are passed as keyword arguments to `create_session()`:
217217
- `streaming` (bool): Enable streaming delta events
218218
- `provider` (ProviderConfig): Custom API provider configuration (BYOK). See [Custom Providers](#custom-providers) section.
219219
- `infinite_sessions` (InfiniteSessionConfig): Automatic context compaction configuration
220+
- `enable_session_store` (bool): Enables the cross-session store for search and retrieval across sessions. When unset in `"copilot-cli"` mode, the runtime default applies (enabled). In `"empty"` mode, defaults to disabled. See [One-shot / Hosted Environments](#one-shot--hosted-environments).
220221
- `on_permission_request` (callable): Optional handler called before each tool execution to approve or deny it. When omitted, permission requests are emitted as events and left pending for manual resolution. Use `PermissionHandler.approve_all` to allow everything, or provide a custom function for fine-grained control. See [Permission Handling](#permission-handling) section.
221222
- `on_user_input_request` (callable): Handler for user input requests from the agent (enables ask_user tool). See [User Input Requests](#user-input-requests) section.
222223
- `hooks` (SessionHooks): Hook handlers for session lifecycle events. See [Session Hooks](#session-hooks) section.
@@ -502,6 +503,27 @@ When enabled, sessions emit compaction events:
502503
- `session.compaction_start` - Background compaction started
503504
- `session.compaction_complete` - Compaction finished (includes token counts)
504505

506+
## One-shot / Hosted Environments
507+
508+
When running the SDK in ephemeral containers or other one-shot environments (one request per container), the default session configuration enables SQLite-backed persistence features that you typically do not need:
509+
510+
- **Infinite sessions** — background compaction and workspace persistence (enabled by default)
511+
- **Session store** — cross-session search and retrieval via a shared SQLite store (enabled by default in `"copilot-cli"` mode when `enable_session_store` is unset)
512+
513+
In restricted or short-lived environments, explicitly disable both to avoid unnecessary disk I/O and transient SQLite lock errors:
514+
515+
```python
516+
async with await client.create_session(
517+
on_permission_request=PermissionHandler.approve_all,
518+
model="gpt-5",
519+
enable_session_store=False,
520+
infinite_sessions={"enabled": False},
521+
) as session:
522+
...
523+
```
524+
525+
In `"empty"` mode, the SDK already defaults `enable_session_store` to `False`; in the default `"copilot-cli"` mode, you must set it explicitly.
526+
505527
## Memory
506528

507529
Sessions can opt into persistent memory, allowing the agent to read and write memory across turns. Memory is configured per session and applies to both `create_session` and `resume_session`.

rust/README.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -571,6 +571,28 @@ config.infinite_sessions = Some(infinite);
571571

572572
The CLI emits `session.compaction_start` / `session.compaction_complete` events around each compaction. The session id remains stable across compactions; resume with `Client::resume_session` to pick up a prior conversation. Workspace state lives under `~/.copilot/session-state/{sessionId}` by default — override with `workspace_path` to relocate.
573573

574+
`enable_session_store` on `SessionConfig` controls the cross-session store for search and retrieval across sessions. When unset in the default client mode, the runtime default applies (enabled). In empty mode, the SDK defaults it to disabled.
575+
576+
### One-shot / Hosted Environments
577+
578+
When running the SDK in ephemeral containers or other one-shot environments (one request per container), the default session configuration enables SQLite-backed persistence features that you typically do not need:
579+
580+
- **Infinite sessions** — background compaction and workspace persistence (enabled by default)
581+
- **Session store** — cross-session search and retrieval via a shared SQLite store (enabled by default when `enable_session_store` is unset)
582+
583+
In restricted or short-lived environments, explicitly disable both to avoid unnecessary disk I/O and transient SQLite lock errors:
584+
585+
```rust,ignore
586+
let config = SessionConfig::default()
587+
.with_enable_session_store(false)
588+
.with_infinite_sessions(InfiniteSessionConfig {
589+
enabled: Some(false),
590+
..Default::default()
591+
});
592+
```
593+
594+
In empty mode, the SDK already defaults `enable_session_store` to `false`; in the default client mode, you must set it explicitly.
595+
574596
### Memory
575597

576598
Configure the runtime memory feature for a session:

0 commit comments

Comments
 (0)