Skip to content

feat: telegram multi-chat broadcast + broker fixes#76

Closed
fprivitera wants to merge 1 commit intoTraderAlice:masterfrom
fprivitera:feat/telegram-broadcast-and-broker-fixes
Closed

feat: telegram multi-chat broadcast + broker fixes#76
fprivitera wants to merge 1 commit intoTraderAlice:masterfrom
fprivitera:feat/telegram-broadcast-and-broker-fixes

Conversation

@fprivitera
Copy link

Summary

  • Telegram multi-chat broadcast: register one TelegramConnector per allowed chat ID; first uses channel 'telegram', subsequent use 'telegram:<chatId>' to avoid overwriting the primary
  • Heartbeat: switched from connectorCenter.notify() to connectorCenter.broadcast() so all registered Telegram chats receive delivery
  • Config: z.coerce.number() for chatIds so string values from env/JSON are accepted without error
  • Trading brokers: fixes in AlpacaBroker, CcxtBroker, TradingGit with expanded test coverage (72 new lines in AlpacaBroker.spec)

Test Plan

  • All 877 tests pass (pnpm test)
  • Verify heartbeat delivers to multiple Telegram chats simultaneously
  • Verify chatIds accepts string values in config (e.g. from env vars)
  • Smoke-test AlpacaBroker and CcxtBroker order flows

🤖 Generated with Claude Code

- TelegramConnector: channel name now configurable (first = 'telegram', subsequent = 'telegram:<chatId>')
- TelegramPlugin: register one connector per allowed chat for broadcast delivery
- heartbeat: use connectorCenter.broadcast() to reach all Telegram chats
- config: z.coerce.number() for chatIds so string values from env/json are accepted
- AlpacaBroker/CcxtBroker/TradingGit: fixes and expanded test coverage

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@luokerenx4
Copy link
Contributor

Hey Filippo, thanks for the effort — these are real bugs and it's clear you've actually been running OpenAlice.

A few notes:

Already fixed upstream: The Decimal rehydration crash (qty.equals is not a function) and the Alpaca notional priority issue were both fixed on master the day before this PR (see d2df072 and 696a6ae). The master fix takes a more thorough approach — TradingGit.restore() now rebuilds Decimal instances directly rather than defensive type-checking at call sites. Your fork may be behind; syncing with upstream should pick these up.

Multi-chat broadcast: The Telegram group/multi-chat feature is intentionally not implemented yet. Alice is currently a single-tenant agent — adding group chat support would rapidly escalate permission management complexity (who can trigger trades? who sees portfolio data? per-chat session isolation?). It's on the radar but not something we can add in the short term.

Project policy: We don't accept external PRs for security reasons — OpenAlice executes real financial operations and we need full control over the code surface. See CONTRIBUTING.md for details. That said, bug reports and feature requests via issues are very welcome!

@luokerenx4 luokerenx4 closed this Mar 20, 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.

2 participants