feat(core): add robustness tests, logging, and metrics for CodeAssistServer SSE parsing#21013
feat(core): add robustness tests, logging, and metrics for CodeAssistServer SSE parsing#21013
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 enhances the reliability and stability of the Highlights
Changelog
Activity
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
|
|
Size Change: +1.74 kB (+0.01%) Total Size: 26 MB
ℹ️ View Unchanged
|
There was a problem hiding this comment.
Code Review
This pull request introduces valuable fuzz tests for the CodeAssistServer using fast-check, significantly improving the robustness of SSE parsing and error handling. The tests are well-structured and cover a good range of edge cases. I have one suggestion to make one of the new tests more resilient to different types of parsing errors.
e805349 to
d4caca4
Compare
Add manual fuzzing and robustness tests to server.test.ts to verify the parsing of fragmented SSE streams, random error objects, and credit balance processing in streaming responses.
every time an invalid chunk is logged, the corresponding metric is also incremented.
d4caca4 to
83ecd25
Compare
There was a problem hiding this comment.
Code Review
This pull request enhances the robustness of the CodeAssistServer's Server-Sent Events (SSE) parsing by adding error handling for invalid JSON chunks, introducing new logging and metrics, and adding robustness tests. A critical security vulnerability was identified where logging malformed SSE chunks can lead to PII or secret leakage, as JSON.parse error messages might contain sensitive input data and are sent to telemetry. Additionally, a high-severity issue was found where a failure in the telemetry pipeline could still crash the stream, undermining the goal of increased robustness.
ebed6e9 to
34118c9
Compare
…ain sensitive data.
34118c9 to
3867350
Compare
…Server SSE parsing (google-gemini#21013) Co-authored-by: Yuna Seol <[email protected]>
…Server SSE parsing (google-gemini#21013) Co-authored-by: Yuna Seol <[email protected]>
…Server SSE parsing (google-gemini#21013) Co-authored-by: Yuna Seol <[email protected]>
…Server SSE parsing (google-gemini#21013) Co-authored-by: Yuna Seol <[email protected]>
…Server SSE parsing (google-gemini#21013) Co-authored-by: Yuna Seol <[email protected]>
…Server SSE parsing (google-gemini#21013) Co-authored-by: Yuna Seol <[email protected]>
Summary
This PR introduces manual fuzzing and robustness tests to the
CodeAssistServerto ensure resilient handling of SSE parsing and error responses. It also adds logging and metrics for invalid SSE chunks.Details
server.test.tsto cover:InvalidChunkEventlogging on SSE parse failure inCodeAssistServer.Related Issues
Fixes #20191
Partially fixes #20189
How to Validate
Run the newly added tests:
Pre-Merge Checklist