Skip to content

fix(telegram): truthful delivery confirmation — save and notify on injection failure#242

Open
brianjones-v4n wants to merge 1 commit into
JKHeadley:mainfrom
brianjones-v4n:fix/telegram-injection-failure-handling
Open

fix(telegram): truthful delivery confirmation — save and notify on injection failure#242
brianjones-v4n wants to merge 1 commit into
JKHeadley:mainfrom
brianjones-v4n:fix/telegram-injection-failure-handling

Conversation

@brianjones-v4n
Copy link
Copy Markdown
Contributor

Summary

The Telegram→session route currently sends `✓ Delivered` unconditionally after calling `SessionManager.injectTelegramMessage`. When injection fails (returns `false`), the user gets a misleading success confirmation while their message is silently dropped.

This:

  • Checks the return value of `injectTelegramMessage`
  • On failure: saves the failed message text under `/state/failed-messages/failed--.txt` (not `/tmp` — keeps failed messages out of world-readable temp space)
  • On failure: sends a user-visible warning instead of the success confirmation
  • On success: behavior unchanged (`✓ Delivered` confirmation if polling)

Matches the secure-state-dir pattern established in PR #32.

Test plan

  • Test asserts the failure branch checks `injected === false`
  • Test asserts the failed-message path includes `state` and `failed-messages` (not `/tmp`)
  • Test asserts the user-facing warning string is sent via `telegram.sendToTopic`
  • Test asserts success path still sends `✓ Delivered`
  • `npx tsc --noEmit` — no new errors

🤖 Generated with Claude Code

…jection failure

Today the Telegram→session route sends "✓ Delivered" unconditionally
after calling SessionManager.injectTelegramMessage. When injection
fails (returns false), the user gets a misleading confirmation while
their message is silently dropped.

This:
- checks the return value of injectTelegramMessage
- on failure, saves the failed message text under
  <stateDir>/state/failed-messages/ (not /tmp — keeps failed messages
  out of world-readable temp space)
- on failure, sends a user-visible warning instead of the success
  confirmation, telling the user the message did not reach the session
  and has been saved

Matches the secure-state-dir pattern established in PR JKHeadley#32.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@vercel
Copy link
Copy Markdown

vercel Bot commented May 16, 2026

@brianjones-v4n is attempting to deploy a commit to the sagemind Team on Vercel.

A member of the Team first needs to authorize it.

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