Skip to content

fix: keep the Reply Drafter output to only the replies#2278

Merged
enaboapps merged 1 commit into
mainfrom
fix/reply-drafter-output-parsing-2277
May 22, 2026
Merged

fix: keep the Reply Drafter output to only the replies#2278
enaboapps merged 1 commit into
mainfrom
fix/reply-drafter-output-parsing-2277

Conversation

@enaboapps

Copy link
Copy Markdown
Collaborator

Summary

Small on-device models (Gemini Nano / Gemma 3n) leak preamble ("Sure, here are some replies:") and trailing commentary despite the prompt. parseSuggestions() split on lines and turned that prose into tappable, pasteable "replies". The prompt alone can't guarantee clean output on a small model, so the contract is now enforced in the parser.

  • The prompt asks the model to wrap the replies in <replies> / </replies> tags.
  • parseSuggestions() keeps only the text between those tags and discards everything outside. It falls back to the whole output when the tags are absent — so the screen is never left empty — and strips wrapping quotes.
  • 4 new unit tests cover region extraction, the no-tag fallback, a missing close tag, and quote stripping.

Test plan

  • ./gradlew compileDebugKotlin testDebugUnitTest — compiles; 11 ReplyDrafterPrompt tests pass.
  • On-device: confirm the Reply Drafter shows only clean replies, with no leaked preamble lines.

Closes #2277

Small on-device models leak preamble and trailing commentary despite the
prompt, which parseSuggestions then turned into tappable, pasteable "replies".

- Prompt asks the model to wrap the replies in <replies> tags.
- parseSuggestions keeps only the text between the tags and discards
  everything outside; falls back to the whole output when the tags are
  absent so the screen is never empty, and strips wrapping quotes.
- Add unit tests for region extraction, no-tag fallback, a missing close
  tag, and quote stripping.
@enaboapps enaboapps added this to the v2.25.0-beta.8 milestone May 22, 2026
@enaboapps enaboapps merged commit c49a048 into main May 22, 2026
@enaboapps enaboapps deleted the fix/reply-drafter-output-parsing-2277 branch May 22, 2026 16:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Guarantee the Reply Drafter output is only the replies

2 participants