Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly refactors the internal proxying mechanism within the server by introducing a dedicated Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request effectively addresses a proxying issue by ensuring internal requests are correctly routed to localhost. The refactoring of proxy logic into a dedicated ServiceProxy class is a significant improvement for code clarity and maintainability. The change of the sticky session header to X-Ray-Serve-Request-Id is consistently applied across the client, server, and documentation. Additionally, the introduction of lazy loading for modules is a good optimization. I have one suggestion to improve code consistency.
There was a problem hiding this comment.
Pull request overview
This PR updates Twinkle’s client/server request routing to improve sticky-session request ID handling and internal proxying for the Tinker-compatible server, aiming to avoid issues caused by proxies and to reduce import overhead.
Changes:
- Switch client + server sticky-session header from
serve_multiplexed_model_idtoX-Ray-Serve-Request-Id. - Refactor Tinker server proxying into a dedicated
ServiceProxythat routes internally usinghttp_options. - Introduce lazy imports for
twinkle.server.twinkleandtwinkle.server.tinker(and adjust launcher imports accordingly).
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| src/twinkle_client/utils/patch_tinker.py | Updates patched Tinker client headers to send X-Ray-Serve-Request-Id. |
| src/twinkle_client/http/http_utils.py | Updates default HTTP headers to send X-Ray-Serve-Request-Id. |
| src/twinkle/server/utils/validation.py | Middleware now requires X-Ray-Serve-Request-Id for sticky sessions. |
| src/twinkle/server/twinkle/init.py | Converts to _LazyModule-based lazy imports for server builders. |
| src/twinkle/server/tinker/server.py | Uses ServiceProxy, adds http_options plumbed from launcher for internal routing. |
| src/twinkle/server/tinker/sampler.py | Wraps build_sampler_app with device-group env helper within the module. |
| src/twinkle/server/tinker/proxy.py | New internal proxy module handling URL building, header forwarding, and request forwarding. |
| src/twinkle/server/tinker/model.py | Wraps build_model_app with device-group env helper within the module. |
| src/twinkle/server/tinker/common/datum.py | Adds list handling when converting labels to numpy arrays. |
| src/twinkle/server/tinker/init.py | Converts to _LazyModule-based lazy imports for Tinker builders. |
| src/twinkle/server/launcher.py | Imports Twinkle builders from twinkle.server.twinkle and passes http_options into apps. |
| src/twinkle/server/init.py | Removes re-exports of build_* app builders (leaving launcher exports). |
| cookbook/client/tinker/custom_service/megatron/server_config.yaml | Changes ModelManagement autoscaling replicas from 2→1. |
PR type
PR information
Write the detail information belongs to this PR.
Experiment results
Paste your experiment result here(if needed).