openhuman
openhuman copied to clipboard
[Bug][Telegram] Connected/link-success state shown but messaging throws cancellation errors
Summary
Telegram shows as connected / linked successfully, but sending messages immediately throws repeated errors (e.g. “Sorry, I encountered an error: Cancelled by newer request”).
Problem
Connection/auth appears successful, but runtime messaging fails right after linking. This creates a false-success state and broken UX.
Steps to reproduce
- Open Telegram bot and run
/start. - Complete login/link flow (“Telegram account linked successfully. You can return to the app.”).
- Send a normal message (e.g. “hello”).
- Observe repeated error replies.
Expected
After successful link, bot should process and respond to messages normally.
Actual
Bot reports errors/cancellations after connection, despite showing linked status.
Tasks
- [ ] Reproduce and capture logs for link flow + first post-link messages.
- [ ] Audit request cancellation logic (
Cancelled by newer request) for Telegram channel. - [ ] Fix race conditions between:
- link/auth completion
- session initialization
- first incoming message handling
- [ ] Ensure “connected” status is only shown when messaging path is actually ready.
- [ ] Add retry/debounce handling to avoid duplicate cancellation cascades.
- [ ] Improve error messaging (actionable recovery steps instead of generic failure).
- [ ] Add regression test:
- connect Telegram -> send first message -> receive successful response.
Acceptance criteria
- [ ] Linked/connected state reliably implies message path is operational.
- [ ] First and subsequent Telegram messages process without cancellation errors.
- [ ] No repeated “Cancelled by newer request” spam for normal user input.
- [ ] Regression test passes in CI/local harness.
@Al629176 test this and close this i feel this is done