-
Notifications
You must be signed in to change notification settings - Fork 274
Open
Description
Problem
When a scheduled job fires and sends its output to a chat, the user cannot continue the conversation from that context. Replying to the scheduled message starts a completely new Claude session, losing all context.
Expected behavior
After a scheduled job delivers its message, the user should be able to reply and continue the conversation naturally — just like any other bot interaction.
Root cause
AgentHandler.handle_scheduled() calls ClaudeIntegration.run_command() without a session_id, creating a fresh isolated session. The resulting session ID is never stored, so it's impossible for subsequent user messages to resume from it.
Current flow:
ScheduledEvent → AgentHandler.handle_scheduled()
→ ClaudeIntegration.run_command(prompt, working_dir) # no session_id
→ new Claude session created
→ response sent to chat via NotificationService
→ session_id discarded ← problem here
Proposed solution
- After
run_command()completes, capture the returnedsession_id - Store it in
SessionManagerfor the target user (resolved fromtarget_chat_ids+created_by) - The user's next message will auto-resume from the scheduled job's context via the existing session resumption logic
Edge cases to consider
- Multiple
target_chat_ids: each target user needs their own session state saved - User mid-conversation: if the user had an active session, the scheduled job would overwrite it — may need a strategy (e.g., only update if user is idle, or notify the user)
created_bymapping: thecreated_byfield inscheduled_jobscan help resolve the originating user for session assignment
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels