Repository navigation
fix(channels): B18 fixes — Telegram setup UX (ent#1189) - #4498
Conversation
…prise#1189) Fixes found while testing B18. - Channel config dialog closes when the KeepAlive-cached agent page is deactivated, so a link inside it (e.g. to Settings) no longer leaves the teleported dialog and its body scroll lock on the next page. - Telegram webhook warning explains why a public HTTPS address is needed and links to Settings > General. - Verify checks the webhook, not only getMe: it registers a missing webhook when a Public URL is set, reports "operational" only when registered, and returns Telegram's rejection reason, shown in the warning. The result sits inline next to the button and the binding refreshes in place. - Client roster: fixed widths on the Access and Actions columns so an in-flight button or state change does not re-balance the table. Co-Authored-By: Claude Opus 5.5 <[email protected]>
AndriiPasternak31
left a comment
There was a problem hiding this comment.
Requesting changes: CI is red on a regression this PR introduces, and Verify can still report "operational" when Telegram cannot deliver.
1. Verify reads the raw Public URL row (brings back #3881). This is the red regression diff check.
src/backend/routers/telegram.py:314 calls settings_service.get_setting("public_chat_url", ""). Every webhook registrar must go through get_public_chat_url_setting(), which strips a trailing dot from the host; test_3881_public_url_trailing_dot::test_no_webhook_registrar_reads_the_raw_row is the one new failure under HEAD. On an install that still has a dotted row from before #3881, Verify registers https://host.example.com., set_webhook stores it, and every later Verify says operational. Nothing is ever delivered, because the certificate is for the name without the dot. Line 250 in the same file already uses the right getter. The new test (test_ent1189_telegram_verify_webhook.py:40) stubs settings_service with only get_setting, so it needs updating too.
2. "Operational" is still based on a database column, not on Telegram's state.
_ensure_webhook (telegram.py:311) returns "registered" as soon as binding.webhook_url is set. On dev that column is written only by a successful set_webhook and is never cleared: not by a failed re-registration, not when the Public URL changes, and not when it is deleted. Examples: the Public URL changes from A to B and the backfill for B fails (routers/settings/generic.py:707); the Public URL is deleted; or setWebhook accepts the URL but delivery fails, e.g. on a certificate mismatch. Verify says operational in all three, and the panel warning (TelegramChannelPanel.vue:71) is gated on the same column, so it stays hidden too. Cheapest partial fix: require the stored URL to start with the current normalised Public URL. Proper fix: getWebhookInfo, comparing url and last_error_message.
3. The token-hygiene change has no test, and the log line next to it contradicts it.
set_webhook's new reason strings, including the "type name only" branch at telegram_webhook.py:272, are never exercised: all four new tests mock set_webhook, so reverting line 272 to str(e) keeps them green. Two lines up, telegram_webhook.py:269 still logs {e} with exc_info=True. If httpx text can carry the token URL, as the new comment says, that log line is the leak. masked_traceback(e, bot_token) would fix it.
Smaller items
TelegramChannelPanel.vue:322/391:verifyResultis cleared only inverifyBot, so after disconnecting and connecting a different bot, the old red result and its reason show next to the new bot.TelegramChannelPanel.vue:73: the warning links to Settings → General, which is admin-only, so a non-admin agent owner lands on MCP Keys. It also says "Set it under Settings…" when a Public URL is set but registration failed.docs/memory/feature-flows/telegram-integration.md:93,371still describes Verify asgetMeonly. It now registers webhooks and returns new fields.
Looks right: the onDeactivated → emit('close') fix for the KeepAlive dialog, design-system tokens, and no bot token in the new response fields.
…tyai/trinity-enterprise#1189) - Verify reads the Public URL through get_public_chat_url_setting(), so a row with a trailing host dot is registered without it (#3881). - Verify calls getWebhookInfo. It re-registers when Telegram holds no webhook or one for another URL, and reports not operational when a delivery error is outstanding with updates pending. - GET binding returns webhook_url only under the current Public URL and adds public_url_set; the PUT response carries public_url_set too. - setWebhook, getWebhookInfo and deleteWebhook errors are logged through masked_traceback; the bot token stays out of logs and reason strings. - Panel: the warning follows the Verify result, non-admins are told to ask an admin, the set-the-URL advice shows only when no Public URL is set, and the Verify result is cleared on connect and disconnect. - Tests exercise set_webhook and get_webhook_info reason strings and the token-free log; feature flow updated. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Smaller: Fixed in 71ee28b. |
AndriiPasternak31
left a comment
There was a problem hiding this comment.
Approving 71ee28b63. All three blocking points and the smaller ones are fixed:
- Verify uses
get_public_chat_url_setting(). getWebhookInfodrives the result.- Token logging goes through
masked_traceback. Reverting each masking line fails a test.
CI is green, including regression diff.
Low notes, none blocking. Fine as follow-ups or ignored:
- Stale URL after re-configure. The binding upsert (
db/telegram_channels.py:82-90) rotateswebhook_secretbut keeps the oldwebhook_url, and the PUT response passes that column through (telegram.py:283). After a re-configure where registration fails, or there's no Public URL, the response shows the old URL until Verify runs. The panel always disconnects first, so only a direct API call hits this. - Telegram may not echo the URL byte for byte.
normalize_public_urldoesn't lowercase the scheme or host. If Telegram echoes a normalised URL for a mixed-case host, every Verify re-registers and thelast_error_messagecheck is never reached. Unverified, and hosts are almost always lowercase. - Untested masking. The
deleteWebhookmasking (telegram_webhook.py:311) has no test. - Summary row lags the panel. After a Verify that finds a delivery error, the panel warns but the summary row in
SharingPanel.vuedoesn't, because it still reads the stored column.
…s-settings dev was 175 commits ahead. Seven conflicts: - SharingPanel.vue stays deleted. The one change dev made to it since the last merge, fixed widths on the roster's Access and Actions columns (#4498), is ported to agent-settings/channels/ClientRoster.vue. - Six user-docs paragraphs that dev edited and this branch reworded: dev's new text is kept, with this branch's "Settings › Channels" wording. Co-Authored-By: Claude Fable 5.2 <[email protected]>
Fixes found while testing B18 of abilityai/trinity-enterprise#1189 (connect a Telegram bot to an agent, approve a client).
Changes
Channel config dialog stays open after navigating away (
ChannelConfigDialog.vue)AgentDetailis KeepAlive-cached, so following a link inside the dialog (e.g. to Settings) deactivated the page without unmounting it, and the teleported dialog plus its body scroll lock stayed on the next page. The dialog now closes ononDeactivated. Applies to every channel row (Slack, Telegram, WhatsApp, Voice).Webhook warning had too little context (
TelegramChannelPanel.vue)The warning now says why Telegram needs a public HTTPS address, links to
Settings → General → Public URL(?tab=general), and says the bot registers automatically once the URL is saved.Verify said "operational" while the webhook was unregistered (
routers/telegram.py,telegram_webhook.py,TelegramChannelPanel.vue)Verify only called
getMe. It now also checks the webhook:setWebhookrejection, e.g. a Public URL that resolves to a reserved/private IP). The reason shows in the warning.register_webhookkeeps itsboolcontract; the newset_webhookreturns the failure reason. Transport errors return the exception type only, since httpx error text can carry the request URL, which embeds the bot token.The Verify result now sits inline next to the button (no layout jump, no 3s auto-dismiss), and the binding refreshes in place so the warning clears once registered.
Client roster row jumped when Approve showed its spinner (
SharingPanel.vue)BaseButtongrows while loading (design-system spec), which re-balanced the auto-layout table. The Access and Actions columns now have fixed widths sized for their widest state (Approve in flight + Block).Tests
tests/unit/test_ent1189_telegram_verify_webhook.py: 4 tests, all fail against the previous Verify and pass now.test_ent600_telegram_group_context.py: 63 pass.activityWave.mount.spec.js,portalAgentsAtCentre.spec.js); both fail identically onorigin/devwithout this change.Refs abilityai/trinity-enterprise#1189
🤖 Generated with Claude Code