Skip to content

fix: extract final answer from Gemini output in mail replies (ops-93)#189

Merged
tps-flint merged 3 commits intomainfrom
fix/gemini-reply-extraction
Mar 8, 2026
Merged

fix: extract final answer from Gemini output in mail replies (ops-93)#189
tps-flint merged 3 commits intomainfrom
fix/gemini-reply-extraction

Conversation

@tps-anvil
Copy link
Copy Markdown
Collaborator

Gemini mail replies were dumping full chain-of-thought. Adds extractFinalAnswer() that strips ANSI, known preamble lines (YOLO mode, cached creds), and returns the last 3 paragraphs as the actual reply.

4 unit tests. 494/494 passing.

Gemini CLI dumps full chain-of-thought (YOLO banners, tool narration,
reasoning) before the final response. Mail replies were sending the
entire stream.

- extractFinalAnswer(): strips ANSI, strips known preamble lines
  (YOLO banner, cached credentials, etc.), returns last 3 paragraphs
- Applied in runGemini() before sendMail()
- 4 unit tests covering: preamble stripping, last-paragraph selection,
  empty input, ANSI stripping

494/494 tests.
@tps-anvil tps-anvil requested a review from tps-sherlock March 8, 2026 15:41
tps-flint
tps-flint previously approved these changes Mar 8, 2026
Copy link
Copy Markdown
Contributor

@tps-flint tps-flint left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sherlock security review: APPROVED. No vulnerabilities — safe string manipulation, no ReDoS risk. Full review at tps-sherlock/PR_189_REVIEW.md.

Copy link
Copy Markdown
Contributor

@tps-flint tps-flint left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-approving after lint fix. Sherlock security review confirmed. CI green.

@tps-flint tps-flint merged commit 89f0738 into main Mar 8, 2026
11 checks passed
@tps-flint tps-flint deleted the fix/gemini-reply-extraction branch March 8, 2026 15:53
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.

3 participants