Fix critical database schema bugs in email-agent#55
Open
verkyyi wants to merge 3 commits intoanthropics:mainfrom
Open
Fix critical database schema bugs in email-agent#55verkyyi wants to merge 3 commits intoanthropics:mainfrom
verkyyi wants to merge 3 commits intoanthropics:mainfrom
Conversation
## Critical Bug Fixes ### 1. Add missing imap_uid column - EmailSyncService requires imap_uid but email-db.ts schema was missing it - Prevents "SQLiteError: table emails has no column named imap_uid" during email sync - **Impact:** Email sync was broken for new databases ### 2. Fix schema incompatibility: email-db vs database-manager - email-db.ts creates separate `recipients` table - database-manager.ts expects `to_addresses`, `cc_addresses`, `bcc_addresses` columns in emails table - Search endpoint uses DatabaseManager → search was completely broken - Added migration to create missing columns and populate from recipients table **Error fixed:** "SQLiteError: table emails has no column named to_addresses" **Impact:** All email search functionality was broken ### 3. Fix listener ID/filename mismatch - Listener ID was `finance_email_tracker` (underscore) - Filename is `finance-email-tracker.ts` (hyphen) - UI couldn't load listener source code (ENOENT error) - **Impact:** Listener details page showed errors ## Root Cause Analysis The codebase has two competing database implementations: 1. `email-db.ts` - Uses normalized `recipients` table (newer) 2. `database-manager.ts` - Uses denormalized address columns (legacy) Different endpoints use different implementations, causing incompatibility. This PR adds address columns as a compatibility shim until codebase is refactored to use a single database abstraction. ## Testing - ✅ Email sync works without imap_uid errors - ✅ Email search returns results (tested with 40+ emails) - ✅ Listener details page loads without file errors - ✅ Migration populates address columns from existing data Fixes anthropics/claude-agent-sdk-demos#[issue-number-if-exists] Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- Auto Apply button on each job card tailors resume + generates cover letter + auto-opens the job posting URL when complete - Batch Auto Apply queue in Saved Jobs tab processes multiple jobs sequentially, skipping already-applied positions - Cover letter generation via Claude: personalized to role/company using the same web research done during resume tailoring - Enhanced tailor modal with auto-apply badge, cover letter preview/copy, and "Open Job Posting" button - Applications tab now shows auto-applied badge, cover letter download, job posting link, and a "Tailored" status option - Fixed job tracking bug where showTailorComplete used searchResults[0] instead of the job being processed Co-Authored-By: Claude Sonnet 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.
Problem
The email-agent has critical database schema bugs that break core functionality:
SQLiteError: table emails has no column named to_addressesimap_uidcolumnRoot Cause
The codebase has two incompatible database implementations:
email-db.ts- Uses normalizedrecipientstabledatabase-manager.ts- Expects denormalized address columns inemailstableSearch endpoint uses
DatabaseManagerwhile sync usesEmailDatabase→ schema mismatch.Changes
1. Add missing
imap_uidcolumn (database/email-db.ts)EmailSyncServicebut missing from schema2. Add address compatibility columns (database/migrations/add-address-columns.sql)
to_addresses,cc_addresses,bcc_addressescolumnsrecipientstable3. Fix listener ID mismatch (finance-email-tracker.ts)
finance_email_tracker→finance-email-trackerto match filenameTesting
✅ Tested with fresh database - email sync works
✅ Tested with 40+ synced emails - search returns results
✅ Tested listener UI - details page loads without errors
✅ Migration successfully populates address columns from recipients data
Impact
Before: Email search unusable, sync broken, UI errors
After: All functionality works correctly
This is a compatibility shim until the codebase is refactored to use a single database abstraction.
Related Issues
This fixes the database schema incompatibility that affects all users trying to use the email-agent demo.