feat: extract roomId from email text before checking headers#100
Merged
sweetmantech merged 8 commits intotestfrom Jan 8, 2026
Merged
Conversation
Primary check now looks for Recoup chat link in email body text: https://chat.recoupable.com/chat/{uuid} Falls back to references header lookup if not found in text. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
- Extract roomId from email text before checking headers - Convert stored UI parts (step-start, dynamic-tool, reasoning) to simple text-based ModelMessages for AI SDK compatibility - Fixes AI_InvalidPromptError when replying to email threads 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Rename extractText to extractTextFromParts - Move to lib/emails/inbound/extractTextFromParts.ts - Add SRP/DRY/KISS principles to CLAUDE.md 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add comprehensive tests for extractRoomIdFromText covering valid chat links, edge cases (undefined, empty string, invalid UUIDs), and wrong domains - Add tests for getEmailRoomId covering primary text extraction, fallback to references header, and various undefined scenarios - Verify priority: chat link in email text takes precedence over headers 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
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.
Summary
https://chat.recoupable.com/chat/{uuid}Problem
step-start,dynamic-tool,reasoningwithstate) that don't match theModelMessage[]schema the AI SDK expects, causingAI_InvalidPromptError.Solution
extractRoomIdFromText()helper that uses regex to find the UUID from the chat link pattern.getEmailRoomMessages()to convert UI parts to simple text-based ModelMessages, extracting only the text content from user and assistant messages.🤖 Generated with Claude Code