feat: migrate Thin SDK to sidecar control session - #4
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR migrates the Python Thin SDK’s bootstrap/session implementation from the legacy OpenSession server-streaming flow to the OpenControlSession bidirectional control stream (wire v2), adding local service registration lifecycle support and updating the vendored contract + generated stubs accordingly.
Changes:
- Switch SidecarSession connection logic to
OpenControlSessionand introduce a request-queue based client event stream. - Add local service registration/unregistration APIs, status tracking, and replay of desired registrations after reconnect.
- Update contract assets (proto, version, checksums), generated protobuf/gRPC code, tests, and README to reflect Session v2.
Reviewed changes
Copilot reviewed 10 out of 11 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/test_thin_sdk.py | Updates UDS session tests to validate OpenControlSession, and adds coverage for local service registration/status replay/unregistration and stream close behavior. |
| src/pole_client/bootstrap.py | Implements v2 control session, client event queueing, local service registration APIs, and status handling. |
| src/pole_client/_generated/bootstrap_pb2.py | Updates generated protobuf definitions for ClientEvent, local service messages, and OpenControlSession. |
| src/pole_client/_generated/bootstrap_pb2_grpc.py | Updates generated gRPC stubs/servicer definitions to include OpenControlSession. |
| src/pole_client/init.py | Exposes new local-service public API types from the package root. |
| README.md | Documents the new control-session flow and local service registration APIs. |
| contract/VERSION | Bumps Sidecar session wire version to 2 and pins specification commit. |
| contract/SHA256SUMS | Updates checksums for the updated vendored bootstrap.proto. |
| contract/bootstrap.proto | Adds OpenControlSession and local service registration/status messages + documentation. |
| context-kg/tasks/todo.md | Records the v2 migration task checklist and verification notes. |
| context-kg/tasks/lessons.md | Updates process guidance about pinning merged specification commits before submitting. |
Files not reviewed (1)
- src/pole_client/_generated/bootstrap_pb2.py: Generated file
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+258
to
+265
| def unregister_local_service(self, registration_id: str) -> bool: | ||
| normalized_registration_id = _normalize_required_text( | ||
| registration_id, "registration_id" | ||
| ) | ||
| with self._lock: | ||
| registration = self._desired_registrations.pop( | ||
| normalized_registration_id, None | ||
| ) |
Comment on lines
318
to
320
| first_event = next(stream) | ||
| self._install_snapshot(self._parse_initial_event(first_event)) | ||
| delay = self._reconnect_initial_backoff_seconds |
Comment on lines
+15
to
17
| `pole.sidecar.v1.SidecarSessionService/OpenControlSession`;包内 `_generated/` 是其通过官方 | ||
| `grpcio-tools 1.71.0` 生成的 Python 代码。语言原生测试执行全部 TargetService SDK | ||
| 向量,并验证 UDS server-streaming 的会话行为。 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
概要
验证