refactor(grpc): reduce proto-change friction in the Go bindings - #1800
Conversation
…ction parse_chunk/parse_complete listed every proto field explicitly, so adding any field to the generate protos broke the Go binding's compile. Use ..Default::default() for the fields the bindings do not surface, so new proto fields no longer require a change here. Signed-off-by: Simo Lin <25425177+slin1237@users.noreply.github.com>
The Go bindings reimplemented the gateway's thinking-toggle detection (should_mark_reasoning_started + extract_thinking_from_kwargs), which can drift from the gateway. Expose the gateway helpers as pub and have the bindings call them, matching how they already reuse process_chat_messages. Signed-off-by: Simo Lin <25425177+slin1237@users.noreply.github.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (4)
📝 WalkthroughWalkthroughTwo gateway functions ( Reasoning detection and proto initialization
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Code Review
This pull request refactors the Go bindings and model gateway to reuse reasoning detection logic instead of duplicating it. Specifically, it exposes extract_thinking_from_kwargs and should_mark_reasoning_started as public functions from the gateway and imports them in the Go bindings. Additionally, it updates protobuf parsing in the Go bindings to use ..Default::default() to avoid future breakage when new fields are added. There are no review comments to address, and I have no additional feedback to provide.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
|
👋 The PR description doesn't fully follow
Please update the PR description so reviewers have the context they need. |
There was a problem hiding this comment.
Clean refactoring — no issues found. The ..Default::default() change is idiomatic and eliminates the proto-field maintenance burden. The visibility promotion to pub follows the existing pattern used by process_chat_messages and create_stop_decoder, and the de-duplicated reasoning detection keeps the two code paths in sync.
Summary
Two small, targeted fixes that reduce the per-proto-change cost in the gRPC bindings — the recurring friction discussed around the #1747 reasoning-token change. No behavior change.
Changes
Harden Go proto reconstruction.
bindings/golang/src/proto_parse.rslisted every field ofGenerateStreamChunk/GenerateCompleteexplicitly, so adding any field to the generate protos broke the Go binding's compile (this is why feat(grpc): add sglang reasoning token usage #1747 had to touch it). Use..Default::default()for the fields the bindings don't surface, so new proto fields no longer require a change here.De-duplicate reasoning detection. The Go bindings reimplemented the gateway's thinking-toggle logic (
should_mark_reasoning_started+extract_thinking_from_kwargs), which could drift. Expose the gateway helpers aspuband have the bindings call them — consistent with how the bindings already reusesmg::routers::grpc::utils::process_chat_messages. The helpers stay in the gateway (request-interpretation lives there); the tokenizer crate is untouched.Verification
cargo +nightly fmt --allcleancargo check --workspace --all-targetscleancargo clippy -p smg -p smg-golang --all-targets -- -D warningscleancargo test -p smg --lib— 1092 passed, 0 failedSummary by CodeRabbit