fix(telegram): send answers complete instead of streaming; working message no longer lingers

This commit is contained in:
EugeneTes
2026-09-25 16:08:34 +00:00
parent bb8c3f43aa
commit b85b61677e
8 changed files with 203 additions and 68 deletions

View File

@@ -30,7 +30,7 @@ Environment variables, or the `Telegram` section of `appsettings.json` (`Telegra
| `TELEGRAM_ALLOWED_USER_IDS` / `Telegram:AllowedUserIds` | — | Required, comma separated. The bot refuses to start without it |
| `Telegram:WorkspaceRoot` | `~/.volcanic/telegram-workspaces` | Chat `<id>` works in `<root>/<id>` |
| `Telegram:Model` | `claude-code/claude-opus-5-5` | Any `provider/model` the Claude Code provider serves |
| `Telegram:EditInterval` | `00:00:01.5` | Minimum time between edits of a streaming reply |
| `Telegram:EditInterval` | `00:00:01.5` | Minimum time between edits of the "Working..." status message |
| `Telegram:ReconnectInitialDelay` / `ReconnectMaxDelay` | `1 s` / `60 s` | Backoff after lost connection |
Sessions are stored as usual under `~/.volcanic/agent/sessions/telegram-<chatId>/`; after a restart each chat resumes
@@ -48,7 +48,8 @@ Write normally. While the agent works, a status message stays at the bottom of t
```
It lists the last five tool calls (`▶` running, `✓` done, `✗` failed) and is deleted when the run finishes.
The reply streams into its own message above it (split into several past Telegram's 4096 character limit).
Answers are not streamed: each one is sent complete when the model finishes it (split into several messages past
Telegram's 4096 character limit).
A message sent while the agent works steers the current run. Photos (with or without a caption) are passed to the model.
| Command | |
@@ -80,5 +81,5 @@ Polling uses Telegram.Bot's built-in loop with a hardened error handler:
- if the loop itself ever ends while the host runs, it is restarted from the last offset;
- a `401` (revoked or wrong token) is the one error it does not retry: the host logs it and exits with code 1.
Replies that fail to send (Telegram unreachable mid-run) are logged; the render loop keeps going and later edits
catch the message up.
A reply that fails to send (Telegram unreachable mid-run) is retried after 1 s and 3 s, then logged as lost; the
render loop keeps going either way.