Skip to content

Add read_email_thread: read a specific email thread - #9

Merged
ssethia2 merged 1 commit into
mainfrom
ss/read-email-thread
Jun 16, 2026
Merged

Add read_email_thread: read a specific email thread#9
ssethia2 merged 1 commit into
mainfrom
ss/read-email-thread

Conversation

@ssethia2

Copy link
Copy Markdown
Owner

Problem (from the logs): the agent told the user "I can't access your Gmail" for "what's the project X email thread about?" — while the proactivity engine was reading Gmail fine at that very moment. Not an access failure: there was simply no tool to read a specific thread (only read_and_summarize_emails, a broad inbox digest that also deletes junk, and draft_email_reply). With no fit, the model overstated and claimed no access.

Fix: a read-only read_email_thread(search_query) — the same Gmail search draft_email_reply already uses to locate a thread, but it returns the contents (From/Subject/Date + body; plain-text preferred, HTML tag-stripped; last few messages of the thread). IMAP/app-password mode returns the matched snippet. Uses the existing scoped get_gmail_serviceno new send/delete surface.

Also a prompt line steering specific-thread questions to this tool and explicitly forbidding "I can't access your Gmail."

4 new tests (returns contents / not-found-doesn't-claim-no-access / no-service / body extraction); 196 pass.

🤖 Generated with Claude Code

…'t access Gmail")

Logs showed the agent telling the user "I can't access your Gmail" for "what's the X
email thread about?" — while the engine was reading Gmail fine. Root cause: no tool to
read a SPECIFIC thread (only read_and_summarize_emails, a broad digest, and
draft_email_reply). The agent had no fit and wrongly claimed no access.

Adds read-only read_email_thread(search_query): same Gmail search draft_email_reply
uses, but returns the thread's text (From/Subject/Date + body, plain preferred, HTML
stripped); IMAP fallback returns the matched snippet. Uses the existing scoped
get_gmail_service — no new send/delete surface. Prompt now steers specific-thread
questions here and forbids claiming no email access. 4 tests; 196 pass.

Assisted-by: Claude Code (Opus 4.8)
@ssethia2
ssethia2 merged commit 4420817 into main Jun 16, 2026
1 check passed
@ssethia2
ssethia2 deleted the ss/read-email-thread branch June 16, 2026 01:26
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.

1 participant