Update background jobs - #94
Conversation
Greptile OverviewGreptile SummaryThis PR simplifies background task notifications by removing the Key Changes
ImpactThis is a behavioral change that affects all background tasks. Previously, users could opt-in to notifications; now notifications are always sent. This improves user experience by ensuring they're always informed when background tasks complete, but may result in more notifications for users who previously had this disabled. Confidence Score: 5/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant User
participant Agent
participant BackgroundTool as background_task tool
participant Manager as BackgroundTaskManager
participant ParentSession as Parent Session
participant BackgroundSession as Background Session
User->>Agent: Request background task
Agent->>BackgroundTool: Call background_task(agent, prompt, description)
BackgroundTool->>Manager: launch(opts)
Manager->>Manager: Create task (status: pending)
Manager-->>BackgroundTool: Return task with task_id
BackgroundTool-->>Agent: Task launched (task_id)
Agent-->>User: Background task started
Note over Manager: Fire-and-forget execution
Manager->>Manager: enqueueStart(task)
Manager->>Manager: processQueue()
Manager->>Manager: startTask(task) [async]
Manager->>BackgroundSession: Create session
BackgroundSession-->>Manager: session_id
Manager->>Manager: Update task (status: running)
Manager->>BackgroundSession: Send prompt
Note over BackgroundSession: Agent processes task
BackgroundSession->>Manager: session.status event (idle)
Manager->>Manager: handleSessionStatus()
Manager->>BackgroundSession: Fetch messages
BackgroundSession-->>Manager: Return assistant messages
Manager->>Manager: extractAndCompleteTask()
Manager->>Manager: completeTask(task, 'completed', result)
Manager->>ParentSession: sendCompletionNotification()
Note over Manager,ParentSession: Always sends notification (no config needed)
ParentSession-->>User: [Background task "description" completed]
|
Summary
Changes