Skip to content

Fix gateway#393

Merged
bishoy-at-pieces merged 2 commits intomainfrom
fix-gateway
Aug 13, 2025
Merged

Fix gateway#393
bishoy-at-pieces merged 2 commits intomainfrom
fix-gateway

Conversation

@bishoy-at-pieces
Copy link
Collaborator

No description provided.

Copilot AI review requested due to automatic review settings August 13, 2025 14:28
Copy link
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

This PR fixes connection management issues in the MCP gateway by improving error handling, cleanup coordination, and connection lifecycle management.

  • Implements proper async cleanup coordination using events and tasks to prevent race conditions
  • Adds thread-safe exception handling for connection errors with automatic cleanup requests
  • Refactors connection management to use dedicated tasks with proper cancellation and timeout handling

Reviewed Changes

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

File Description
src/pieces/settings.py Adds type annotation for headless_mode boolean field
src/pieces/mcp/gateway.py Major refactoring of connection handling with cleanup coordination, exception handlers, and improved error management
src/pieces/base_command.py Simplifies headless mode logic into single line conditional
src/pieces/_vendor/pieces_os_client/wrapper/websockets/base_websocket.py Changes default error handler from print to no-op

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@bishoy-at-pieces bishoy-at-pieces force-pushed the fix-gateway branch 8 times, most recently from 70749c9 to 79fb7fb Compare August 13, 2025 17:29
Copy link
Contributor

@tsavo-at-pieces tsavo-at-pieces left a comment

Choose a reason for hiding this comment

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

Great fix!

@bishoy-at-pieces bishoy-at-pieces merged commit fa51ac8 into main Aug 13, 2025
7 checks passed
@bishoy-at-pieces bishoy-at-pieces deleted the fix-gateway branch August 13, 2025 18:54
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