Skip to content

fix(schedules): persist scheduled messages to agent_messages table#259

Merged
jlia0 merged 1 commit intomainfrom
jlia0/fix-schedule-messages
Mar 24, 2026
Merged

fix(schedules): persist scheduled messages to agent_messages table#259
jlia0 merged 1 commit intomainfrom
jlia0/fix-schedule-messages

Conversation

@jlia0
Copy link
Collaborator

@jlia0 jlia0 commented Mar 24, 2026

Description

Fix scheduled messages not appearing in the agent_messages table. The fireSchedule() function only called enqueueMessage() (which writes to the messages queue table) but never called insertAgentMessage() to persist the user-side message. This mirrors the behavior of the API message route so scheduled messages are visible alongside regular messages.

Changes

  • Import insertAgentMessage from ./queues in schedules.ts
  • Call insertAgentMessage() with role: 'user' after a successful enqueueMessage() in fireSchedule(), matching the pattern used in the API route (packages/server/src/routes/messages.ts)

Testing

  • Verified the insertAgentMessage call signature matches the function definition in queues.ts

Checklist

  • PR title follows conventional commit format (type(scope): description)
  • I have tested these changes locally
  • My changes don't introduce new warnings or errors
  • I have updated documentation if needed

Scheduled messages only called enqueueMessage() which writes to the
messages queue, but never called insertAgentMessage() to persist the
user-side message. This mirrors the API route behavior so scheduled
messages appear in agent_messages like regular messages do.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@jlia0 jlia0 merged commit 05c722b into main Mar 24, 2026
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