Skip to content

⚡ Bolt: parallelize session destruction#4

Open
AkCodes23 wants to merge 1 commit intomainfrom
bolt/parallel-session-destruction-4164875521305754820
Open

⚡ Bolt: parallelize session destruction#4
AkCodes23 wants to merge 1 commit intomainfrom
bolt/parallel-session-destruction-4164875521305754820

Conversation

@AkCodes23
Copy link
Owner

Parallelize session destruction during client shutdown in Go, .NET, and Python SDKs to improve performance and match the Node.js implementation. Added retry logic with exponential backoff for increased robustness.


PR created automatically by Jules for task 4164875521305754820 started by @AkCodes23

This commit parallelizes session destruction during client shutdown across the Go, .NET, and Python SDKs.

💡 What:
- Transitioned from sequential to parallel session destruction in Stop/StopAsync methods.
- Implemented 3-attempt retry logic with exponential backoff (100ms, 200ms) for robustness.
- Used language-specific parallelization primitives: goroutines (Go), Task.WhenAll (.NET), and asyncio.gather (Python).

🎯 Why:
Sequential session destruction was a performance bottleneck, especially when multiple sessions were active, as each destruction involves an IPC/Network request.

📊 Impact:
Reduces shutdown latency from O(N*T) to O(T), where N is the number of sessions and T is the time to destroy a single session.

🔬 Measurement:
Verified with unit tests in Go and Python, and successful builds in .NET. Added documentation comments explaining the optimization.

Co-authored-by: AkCodes23 <135016848+AkCodes23@users.noreply.github.com>
@google-labs-jules
Copy link

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

Copilot AI review requested due to automatic review settings February 9, 2026 18:10
Copy link

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

Parallelizes session destruction during client shutdown for the Python, Go, and .NET SDKs (bringing behavior in line with the Node.js approach) and adds bounded retry + backoff to make shutdown more resilient to transient failures.

Changes:

  • Python: destroy active sessions concurrently in CopilotClient.stop() with retry/backoff and aggregated StopErrors.
  • Go: destroy active sessions concurrently in Client.Stop() using goroutines/WaitGroup with retry/backoff and aggregated errors.
  • .NET: destroy active sessions concurrently in CopilotClient.StopAsync() via Task.WhenAll with retry/backoff and aggregated exceptions.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
python/copilot/client.py Parallelizes session destruction during stop() and adds retry/backoff while preserving the “return errors instead of throwing” contract.
go/client.go Parallelizes session destruction during Stop() using goroutines and adds retry/backoff before proceeding with connection/process cleanup.
dotnet/src/Client.cs Parallelizes session disposal during StopAsync() using Task.WhenAll and adds retry/backoff while maintaining aggregated error behavior.
.jules/bolt.md Updates Bolt journal entry to reflect the parallel session destruction performance learning/action.

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.

1 participant