Skip to content

Comments

fix: deliver proactive messages via senderId fallback#79

Closed
paulscan wants to merge 1 commit intoTinyAGI:mainfrom
paulscan:paul/fix-proactive-messages
Closed

fix: deliver proactive messages via senderId fallback#79
paulscan wants to merge 1 commit intoTinyAGI:mainfrom
paulscan:paul/fix-proactive-messages

Conversation

@paulscan
Copy link
Contributor

Summary

  • Channel clients (Telegram, Discord, WhatsApp) now fall back to the senderId field
    in outgoing queue messages when there's no matching pendingMessages entry
  • Proactive messages are sent directly to the chat/user instead of as replies
  • Normal request-response flow is completely unchanged

Problem

The send-user-message skill (added in #59) writes correctly formatted messages to
queue/outgoing/, but all three channel clients delete them without delivery. The
outgoing queue handler requires a pendingMessages entry (created when an incoming
message arrives), and proactive messages by definition have none.

Fix

Each channel client's checkOutgoingQueue function now checks for senderId in the
response JSON when pendingMessages has no match. The senderId is used to resolve
the target chat directly (Telegram chat ID, Discord user ID → DM, WhatsApp chat ID).

Test plan

  • Verified on live VPS: send_message.ts send --channel telegram delivers
    successfully instead of producing a WARN log
  • Regression: normal request-response still works (reply_to_message_id preserved)
  • TypeScript build passes cleanly

Channel clients were deleting outgoing messages that had no matching
pendingMessages entry. Proactive messages (from send-user-message
skill, heartbeat, scheduled tasks) never have a pending entry since
they aren't triggered by an incoming user message.

All three clients now fall back to the senderId field in the response
JSON to resolve the target chat/user. Proactive messages are sent
without reply_to_message_id since there's no original message.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@paulscan paulscan force-pushed the paul/fix-proactive-messages branch from 7aa4186 to 0687ebd Compare February 15, 2026 13:08
jlia0 added a commit that referenced this pull request Feb 15, 2026
Channel clients had duplicated code paths for pending (request-response)
and proactive (senderId-based) message delivery. Merge into a single
flow that resolves the target from pendingMessages first, then falls
back to senderId. This removes ~40 lines of duplicated logic per client
and fixes WhatsApp missing await on reply.

Also adds --files usage example to send-user-message SKILL.md.

Supersedes #79

Co-Authored-By: Paul Scandariato <ps@scannedinc.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@jlia0
Copy link
Collaborator

jlia0 commented Feb 15, 2026

implemented in #95

@jlia0 jlia0 closed this Feb 15, 2026
jlia0 added a commit that referenced this pull request Feb 15, 2026
Channel clients had duplicated code paths for pending (request-response)
and proactive (senderId-based) message delivery. Merge into a single
flow that resolves the target from pendingMessages first, then falls
back to senderId. This removes ~40 lines of duplicated logic per client
and fixes WhatsApp missing await on reply.

Also adds --files usage example to send-user-message SKILL.md.

Supersedes #79

Co-authored-by: Paul Scandariato <ps@scannedinc.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
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.

2 participants