Repository navigation
Conversation
Naive indexOf('---') stripping truncated Markdown horizontal rules,
while MAX_TOKENS or frontmatter-only responses bypassed retry checks
and overwrote SKILL.md with incomplete or body-less output.
Parse leading YAML frontmatter via package:yaml (including camelCase
keys and block scalars), strip 3+/4-backtick outer fences, reject
non-STOP finishReason and empty cleaned bodies inside retry loops,
and add close() to release internally owned HTTP clients.
Refs: flutter#267 (Gemini 4 generator follow-up)
Tested: dart format, dart analyze --fatal-infos --fatal-warnings, dart test (125 passed)
Contributor
There was a problem hiding this comment.
Code Review
This pull request improves the Gemini service by adding robust HTTP client lifecycle management, refining the content cleaning logic to better handle YAML frontmatter and markdown fences, and enhancing response validation. I have reviewed the changes and provided feedback on improving null safety in the response extraction logic and ensuring broader exception handling during YAML parsing.
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.
Naive
indexOf('---')stripping inGeminiService.cleanContenttruncated Markdown horizontal rules, whileMAX_TOKENSor frontmatter-only responses bypassed retry checks and overwroteSKILL.mdwith incomplete or body-less output.Parse leading YAML frontmatter via
package:yaml(including camelCase keys and block scalars), strip 3+/4-backtick outer code fences, reject non-STOPfinishReasonand empty cleaned bodies inside retry loops, and addclose()to release internally owned HTTP clients.Refs: #267 (Gemini 4 generator follow-up, part 2 of 3)
Tested:
dart format,dart analyze --fatal-infos --fatal-warnings,dart test(125 passed)