docs: clarify session destroy vs delete semantics#599
Conversation
Clarify the distinction between destroy() (closes session, releases in-memory resources, preserves disk state for resumption) and deleteSession() (permanently removes all data from disk). Update doc comments across all four SDK languages (Go, Node.js, Python, .NET) and the session persistence guide to make the behavioral difference explicit and help users choose the right method. Fixes #526 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR clarifies the semantic distinction between destroy() and deleteSession() methods across all four SDK languages (Go, Node.js, Python, .NET) and updates the session persistence guide. The changes address issue #526, which reported that the API documentation around session disposal was counterintuitive and contradictory.
Changes:
- Updated
destroy()/DisposeAsync()documentation to explicitly state it releases in-memory resources only, preserves disk state, and can be resumed - Updated
stop()/StopAsync()documentation to clarify it closes (not "destroys") sessions and preserves disk data - Updated
deleteSession()/DeleteSessionAsync()documentation to explicitly contrast withdestroy()and emphasize permanent deletion - Restructured session persistence guide with separate sections for "Closing a Session" vs "Permanently Deleting a Session" and added a callout box
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| python/copilot/session.py | Updated destroy() docstring to clarify it closes session and releases in-memory resources while preserving disk state |
| python/copilot/client.py | Updated stop() to clarify it closes (not destroys) sessions; updated delete_session() to contrast with destroy() |
| nodejs/src/session.ts | Updated destroy() JSDoc to clarify it closes session and releases in-memory resources while preserving disk state |
| nodejs/src/client.ts | Updated stop() to clarify it closes sessions; updated deleteSession() to contrast with destroy() |
| go/session.go | Updated Destroy() doc comment to clarify it closes session and releases in-memory resources while preserving disk state |
| go/client.go | Updated Stop() to clarify it closes sessions; updated DeleteSession() to contrast with Destroy() |
| dotnet/src/Session.cs | Updated DisposeAsync() XML doc to clarify it closes session and releases in-memory resources while preserving disk state |
| dotnet/src/Client.cs | Updated StopAsync() to clarify it closes sessions; updated DeleteSessionAsync() to contrast with DisposeAsync() |
| docs/guides/session-persistence.md | Restructured with separate sections for closing vs deleting; added callout box and updated summary table |
|
@SteveSandersonMS would be great to chat about this |
✅ Cross-SDK Consistency Review: APPROVEDThis PR demonstrates excellent cross-language consistency in clarifying the Consistent Changes Across All Languages1. Session
2. Client
3. Client
4. Documentation guide:
Language-Specific Adaptations (Appropriate)The following differences respect language conventions and are not consistency issues:
These variations follow each language's idiomatic documentation and naming conventions. ConclusionThis PR maintains complete feature parity and semantic consistency across all four SDK implementations. The documentation now provides clear, consistent guidance on session lifecycle management regardless of which SDK language developers are using. Great work addressing issue #526! 🎉
|
Summary
Clarifies the distinction between
destroy()anddeleteSession()across all four SDK languages and the session persistence guide.Fixes #526
Problem
As reported in #526, the API documentation around session disposal is counterintuitive:
destroy()says it "destroys this session and releases all associated resources" but then says the session can be resumed — contradicting what "destroy" impliesdeleteSession()is the truly permanent operation, but there's no clear guidance on when to use one vs the otherstop()says it "destroys all active sessions" but actually leaves session data on disk, which isn't mentionedChanges
All four SDK languages (Go, Node.js, Python, .NET) — updated doc comments for:
destroy()/DisposeAsync(): Now explicitly states it releases in-memory resources only, preserves disk state, and points todeleteSession()for permanent removalstop()/StopAsync(): Clarifies it closes sessions (not "destroys") and notes that disk data is preserved — users wanting permanent removal must calldeleteSession()firstdeleteSession()/DeleteSessionAsync(): Now explicitly contrasts withdestroy()to make the difference clearSession persistence guide (
docs/guides/session-persistence.md):destroy()vsdeleteSession()