Repository navigation
fix(grpc): use e.message() instead of Display for tonic::Status in user-facing errors - #654
Conversation
…ing error messages Signed-off-by: Chang Su <chang.s.su@oracle.com>
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 addresses an issue where gRPC backend errors were exposing raw Highlights
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
|
📝 WalkthroughWalkthroughError message formatting is standardized across gRPC error handling paths to explicitly call Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Code Review
This pull request addresses an issue where raw tonic::Status debug output was being included in user-facing gRPC error messages. The changes correctly replace the use of the Display implementation for tonic::Status with e.message() across multiple files, ensuring that only the clean error message is presented to the user. The modifications in response_collection.rs, request_execution.rs, harmony/streaming.rs, and regular/streaming.rs are consistent and effectively resolve the problem described. The code is clean and the fix is well-implemented.
e.message() instead of Display for tonic::Status in user-facing errors
… in user-facing errors (#654) Signed-off-by: Chang Su <chang.s.su@oracle.com>
Description
Problem
Relates to #650.
gRPC backend errors include raw
tonic::Statusdebug output in user-facing error messages. For example, a TRT-LLM validation error returns:{"message": "Failed to start generation: status: 'Client specified an invalid argument', self: \"Greedy decoding...\", metadata: {\"content-type\": \"application/grpc\"}"}This is because
format!("Failed to start generation: {e}")usestonic::Status'sDisplayimpl, which dumps the full debug representation includingstatus:,self:, andmetadata:.Solution
Replace
{e}withe.message()in all error paths whereeis atonic::Status. This produces clean messages like:{"message": "Failed to start generation: Greedy decoding in the LLM API does not allow multiple returns..."}Changes
request_execution.rs— 7 call sites (generate, embed, dual dispatch, sequential PD)response_collection.rs— 1 call site (stream collection)regular/streaming.rs— 3 call sites (stream and prefill errors)harmony/streaming.rs— 4 call sites (stream, prefill, decode errors)Test Plan
cargo check -p smgpassesChecklist
cargo +nightly fmtpassescargo clippy --all-targets --all-features -- -D warningspassesSummary by CodeRabbit