Repository navigation
Conversation
…etch - Apply include/exclude keywords (subject, then body only when needed) before the max_messages cap, stopping once the page is filled and bounding the scan (datamachine_email_keyword_scan_limit, default 500). - Resolve timeframe_limit through the shared datamachine_timeframe_limit filter so 72_hours works; unknown values log a warning. - Comma-separated from_filter/subject_filter run one IMAP search per combination (c-client rejects OR) and merge UIDs newest first. - Declare search, exclude_keywords and array search_criteria in the ability schema. Closes #3609
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.
Closes #3609
Why
The email fetch handler exposed the shared fetch settings (
search,exclude_keywords,timeframe_limit) but ignored or misread them, so email flows looked filtered when they weren't. This came up while setting up a Festival Wire flow that should pick up festival lineup press releases from an inbox getting about 54 messages a day.What changed
FetchEmailAbilityapplies the sharedHasApplyKeywordSearch/HasApplyKeywordExclusiontraits. It checks the subject first and reads the body only when the subject doesn't decide it. Body reads useFT_PEEKand never download attachments. It walks UIDs newest first and stops onceoffset + max_messagesmatches are found. The scan is bounded (datamachine_email_keyword_scan_limit, default 500) and logs a warning when the bound is hit.has_morereports whether unscanned candidates remain.timeframe_limitresolves throughdatamachine_timeframe_limit, so72_hours(offered in the UI, used by every Reddit wire flow) now adds aSINCEinstead of silently meaning "all time". Unknown values log a warning.from_filter/subject_filterexpand to one criteria string per combination, because c-clientimap_search()rejectsOR(verified on production:Unknown search criterion: OR). The ability merges and dedupes the UIDs, newest first. A single value still produces a single string, as before. IMAP quoted strings are now escaped.search_criteriaaccepts a string or an array of strings, andsearchandexclude_keywordsare declared, so CLI and MCP callers can use them too.Verification
The
homeboy review test data-machinegate currently runs zero tests on cleanmain(PHPUNIT_ZERO_TESTS cause=recipe_run_no_executions/WP Codebox canonical PHPUnit discovery failed, tracked in Extra-Chill/homeboy#15333). Two Homeboy cooks for this issue failed on that infrastructure, not on the code. At the operator's direction, I finished the change outside Homeboy and verified it directly:tests/email-fetch-filters-smoke.php: 21 checks against an in-memory IMAP fixture. It covers include/exclude on subject and body, no fetches without keywords, body reads only when needed and always with peek, early stop and offset paging, the scan limit and its warning, OR merge/dedupe/order,72_hours/all_time/ unknown timeframe, the multi-value criteria expansion, and quote escaping. All pass.email-registration-contract-smoke.phpandemail-mailbox-runtime-smoke.phppass.named-mailbox-security-contract-smoke.phpfails identically on cleanmain, which is unrelated and filed as tests: named-mailbox-security-contract-smoke fails on main (authRefProperty count 3, expects >= 10) #3610.phpcswith the Homeboy WordPress ruleset: the changed source files are clean. The smoke file follows the existing multi-namespace smoke-test pattern.php -lpasses on all changed files.search: lineup,exclude_keywords: WordCampand a 7-day window. It returned High Water (both emails), Big Ears, WinterWonderGrass, Piedmont Stomp, Rooster Walk and Brandi Carlile's Girls Just Wanna Weekend, and it dropped WordCamp.Note for flow config: exclude keywords also check the email body, so keep them narrow. In the live check, excluding
filmalso dropped Big Ears, whose press release mentions film.The Homeboy run evidence is recorded in cook runs
agent-task-b13bd486…andagent-task-ec9dba4a…. The final commit replaces both cook candidates.AI disclosure: written by Extra Chill Bot (Claude, via OpenCode), building on two Homeboy cook attempts (opencode / gpt-6-luna). Chris reviews and merges.