Skip to content

daily recap: filter failed cards and cap prompt size (#285)#306

Open
praxstack wants to merge 2 commits into
JerryZLiu:mainfrom
praxstack:fix/285-recap-token-budget
Open

daily recap: filter failed cards and cap prompt size (#285)#306
praxstack wants to merge 2 commits into
JerryZLiu:mainfrom
praxstack:fix/285-recap-token-budget

Conversation

@praxstack

@praxstack praxstack commented Jul 7, 2026

Copy link
Copy Markdown

Helps with #285 (complements #304, which fixes the regeneration side). The Daily Recap prompt concatenated every card for the day, so a day flooded with duplicate "Processing failed" cards blew past the model context (5.88M tokens against a 262K window). This filters "Processing failed" cards out of the activity log and adds a 60K-character ceiling; when it bites, oldest cards are kept and the tail collapses into "... and N more activities omitted". Normal days are unaffected since the cap only triggers on pathological card counts.

Tested with the new DailyRecapCardsTextTests plus the existing suite:

Test case 'DailyRecapCardsTextTests.testExcludesProcessingFailedCardsFromPrompt()' passed
Test case 'DailyRecapCardsTextTests.testTruncatesDeterministicallyWhenOverCharacterBudget()' passed
Test case 'ProvidersSettingsViewModelTests.testProviderSetupCompletionRefreshesLocalModelSettingsFromDefaults()' passed
Test case 'TimeParsingTests.testInvalidTimes()' passed
Test case 'TimeParsingTests.testValidTimes()' passed
Test case 'WeeklyDashboardBuilderTests.testSankeyCoalescesRealOtherAppWithOverflowBucket()' passed
Test case 'WeeklyDashboardBuilderTests.testWeeklyDashboardSnapshotIsSendableForBackgroundLoading()' passed
Test case 'WeeklyDashboardBuilderTests.testWeeklyDistributionExcludesIdleFromDonutTotal()' passed
** TEST SUCCEEDED **

Follow-up hardening pass (2026-07-08)

Ran an internal hardening pass (test coverage + code review) — no additional issues found. Re-verified at head b62a94a: build succeeds and the full DayflowTests suite passes 8/8 (including both new tests, testExcludesProcessingFailedCardsFromPrompt and testTruncatesDeterministicallyWhenOverCharacterBudget); logic re-traced against #285 (failed-card filter matches the exact "Processing failed" literal produced by LLMService, and the 60k-char cap accounts for the newline join cost per entry).


Follow-up hardening pass (2026-07-08)

Added 4 edge-case tests (no production code change): empty-list path, summary-rendering branch (distinct summary shown, summary==title dropped without duplication), filter+truncation composition (failed cards removed before budget measurement so they never inflate the omitted count), and an all-cards-fit boundary check on the omission notice. Full suite: 6/6 pass.

@praxstack praxstack force-pushed the fix/285-recap-token-budget branch from 27aa193 to b62a94a Compare July 7, 2026 03:55
Follow-up hardening pass. Adds 4 tests for uncovered branches:
- empty card list -> "no activities" message
- summary rendering: distinct summary included, summary==title dropped (no dup)
- filter + truncation compose: "Processing failed" cards removed before the
  budget is measured, so they never consume budget or inflate the omitted count
- boundary: no "omitted" notice when all cards fit (off-by-one guard)

All 6 tests pass (2 original + 4 new); no production code changed.
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