Module: DailyFocus
- Defined in:
- app/services/daily_focus.rb,
app/services/daily_focus/prompt.rb,
app/services/daily_focus/run_policy.rb,
app/services/daily_focus/chat_runner.rb,
app/services/daily_focus/data_gatherer.rb,
app/services/daily_focus/review_counts.rb,
app/services/daily_focus/timezone_hints.rb,
app/services/daily_focus/work_day_indicator.rb,
app/services/daily_focus/conversation_sharing.rb,
app/services/daily_focus/user_context_builder.rb,
app/services/daily_focus/review_work_day_preloader.rb
Overview
Namespace configuration for Daily Focus automation (Sunny + CRM review).
Defined Under Namespace
Modules: ConversationSharing, Prompt, TimezoneHints Classes: ChatRunner, DataGatherer, ReviewCounts, ReviewWorkDayPreloader, RunPolicy, UserContextBuilder, WorkDayIndicator
Constant Summary collapse
- TOOL_SERVICE_KEYS =
Service keys passed to Assistant::ChatToolBuilder for tool-based generation.
%w[sales_management app_db support_cases content].freeze
- CHAT_MODEL_KEY =
Model key for Assistant::ChatService (batch + unified path).
'gemini-flash'- ORPHAN_AFTER =
A briefing left in
processinglonger than this with no live worker is
treated as orphaned (its worker died — deploy/OOM/hard-kill — before
advancing the status toready/failed). Generous headroom over the
slowest healthy generation (~7 min) so a merely-slow run is never reaped. 15.minutes
Class Method Summary collapse
-
.briefing_live?(conversation) ⇒ Boolean
True when a worker is actively generating this briefing.
Class Method Details
.briefing_live?(conversation) ⇒ Boolean
True when a worker is actively generating this briefing. The daily-focus
path runs synchronously through Assistant::ChatService, which — unlike
AssistantChatWorker — does NOT heartbeat the column lock, so a long run's
lock can expire (LOCK_STALE_AFTER = 5 min) while it's still alive. The
PlanOrchestrator rewrites the execution_plan metadata as each step lands,
so a healthy run keeps bumping updated_at; we treat recent activity as
"live" to avoid reclaiming/reaping a slow-but-running briefing.
27 28 29 30 |
# File 'app/services/daily_focus.rb', line 27 def self.briefing_live?(conversation) conversation.processing? || (conversation.updated_at.present? && conversation.updated_at > ORPHAN_AFTER.ago) end |