Every aggregation run sends all existing aggregates to the LLM — prompt grows without bound #74
Labels
No labels
Compat/Breaking
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Security
Kind/Testing
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Status
Abandoned
Status
Blocked
Status
Need More Info
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Reference
marvin8/yunjin#74
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Each hourly aggregation run sends the user's entire set of aggregate summaries into the LLM prompt as EXISTING TOPICS. As of 7 Oct 2026 that is ~900 entries, and it grows with every aggregate created.
Consequences:
This was item 4 of the #71 plan of attack, deliberately split out: the cap design depends on what shape the candidate-topic universe has after #71's main work (consolidation window, total assignment, stable identity, TTL release) lands, and an early cap risks duplicate aggregates for older stories.
Findings (from the #71 investigation, 2026-10-07 prod DB)
Approach sketch (deferred until after #71's items 1, 2, 3, 5)
Cap EXISTING TOPICS to a candidate set — e.g. aggregates updated within the last N days plus the most recently created slice — instead of everything. Intended to land after #71's main work, because:
Plan of attack (design approved 2026-10-11, cap = 100)
Findings from exploration (post-#71)
candidates(aggregates holding at least one input article) — bounded by construction.get_all_aggregatesalready returns most-recently-updated first, so the cap is a slice in the service layer — no db-layer change (cap selection is business logic).Approach
_max_prompt_topics()helper readingYUNJIN_MAX_PROMPT_TOPICSvia the existing_env_intconvention (unset/empty/non-numeric/below-1 → default 100).aggregate()'s incremental path: sliceuser_aggregatesto the cap before_aggregate_prompt_payloads` — the most recently updated aggregates are kept, which is exactly the ordering the DB query already provides._llm_requestcaptures the prompt; assert over-cap users get only the K most recently updated topics; helper default/validation cases.YUNJIN_MAX_PROMPT_TOPICSrow in the LLM aggregation table ofdocs/config.md.Sequence
feat/issue-74-cap-existing-topicsfrommain:sparkles: Cap incremental EXISTING TOPICS to the most recently updated(test + implementation):memo: Document YUNJIN_MAX_PROMPT_TOPICS(docs/config.md)nox, push, PR intomain, ci-watchClosed by PR #80 (merged as
6b5d1cc): incremental EXISTING TOPICS now capped to the 100 most recently updated aggregates (YUNJIN_MAX_PROMPT_TOPICS); consolidation passes unaffected. Prompt cost drops ~5-8x vs post-TTL steady state.