Skip to content

The agent that grows with you

fix(desktop): name the connected Telegram bot after QR setup

Hermes Agent32b4acf4c876
diff --git a/apps/desktop/src/app/messaging/index.test.tsx b/apps/desktop/src/app/messaging/index.test.tsx
index 756b113245b..d1511dac959 100644
--- a/apps/desktop/src/app/messaging/index.test.tsx
+++ b/apps/desktop/src/app/messaging/index.test.tsx
@@ -26,6 +26,7 @@ const watchGatewayRestartOutcome = vi.fn()
const startTelegramOnboarding = vi.fn()
const getTelegramOnboardingStatus = vi.fn()
const applyTelegramOnboarding = vi.fn()
+const notify = vi.fn()
vi.mock('@/hermes', () => ({
approvePairing: (platformId: string, requestId: string, profile?: null | string) =>
@@ -64,7 +65,7 @@ vi.mock('@/lib/external-link', () => ({
}))
vi.mock('@/store/notifications', () => ({
- notify: vi.fn(),
+ notify: (notification: unknown) => notify(notification),
notifyError: vi.fn()
}))
@@ -324,6 +325,7 @@ describe('MessagingView Telegram quick setup', () => {
status: 'ready'
})
applyTelegramOnboarding.mockResolvedValue({
+ bot_username: 'hermes_bot',
needs_restart: false,
ok: true,
platform: 'telegram',
@@ -348,6 +350,15 @@ describe('MessagingView Telegram quick setup', () => {
await waitFor(() => expect(applyTelegramOnboarding).toHaveBeenCalledWith('pair-1', ['8792111505'], 'worker'))
await waitFor(() => expect(watchGatewayRestartOutcome).toHaveBeenCalled())
+ expect(notify).toHaveBeenCalledWith({
+ kind: 'success',
+ message: 'Connected: @hermes_bot · Telegram saved; gateway restarting…',
+ title: 'Telegram setup saved'
+ })
+ // The pairing UI is gone, but the card still names the bot that was just connected.
+ expect(screen.queryByRole('button', { name: /Save and restart/ })).toBeNull()
+ expect(screen.getByText('Connected')).toBeTruthy()
+ expect(screen.getByText('@hermes_bot')).toBeTruthy()
} finally {
$settingsScopeOverride.set(null)
}
diff --git a/apps/desktop/src/app/messaging/index.tsx b/apps/desktop/src/app/messaging/index.tsx
index 60a863f9028..c08d629ea40 100644
--- a/apps/desktop/src/app/messaging/index.tsx
+++ b/apps/desktop/src/app/messaging/index.tsx
@@ -413,7 +413,13 @@ export function MessagingView({ setStatusbarItemGroup: _setStatusbarItemGroup, .
await refreshPlatforms(true)
if (result.restart_started) {
- notify({ kind: 'success', title: m.setupSaved('Telegram'), message: m.telegramQr.savedRestarting })
+ const connectedBot = result.bot_username ? `${m.states.connected}: @${result.bot_username}` : null
+
+ notify({
+ kind: 'success',
+ title: m.setupSaved('Telegram'),
+ message: [connectedBot, m.telegramQr.savedRestarting].filter(Boolean).join(' · ')
+ })
setRestartNeeded(false)
const ok = await watchGatewayRestartOutcome()
diff --git a/apps/desktop/src/app/messaging/telegram-qr-setup.tsx b/apps/desktop/src/app/messaging/telegram-qr-setup.tsx
index f426a5db12f..5947673099a 100644
--- a/apps/desktop/src/app/messaging/telegram-qr-setup.tsx
+++ b/apps/desktop/src/app/messaging/telegram-qr-setup.tsx
@@ -72,6 +72,8 @@ export function TelegramQrSetup({ onApplied, platform, scopeProfile }: TelegramQ
const [qrDataUrl, setQrDataUrl] = useState('')
const [phase, setPhase] = useState<Phase>('idle')
const [botUsername, setBotUsername] = useState<null | string>(null)
+ // The bot a successful apply just saved; outlives reset() so the card still says which bot is connected.
+ const [connectedBot, setConnectedBot] = useState<null | string>(null)
const [allowedIds, setAllowedIds] = useState<string[]>([])
const [detectedOwnerId, setDetectedOwnerId] = useState<null | string>(null)
const [newAllowedId, setNewAllowedId] = useState('')
@@ -177,6 +179,7 @@ export function TelegramQrSetup({ onApplied, platform, scopeProfile }: TelegramQ
setPhase('starting')
setError('')
setBotUsername(null)
+ setConnectedBot(null)
setAllowedIds([])
setDetectedOwnerId(null)
setNewAllowedId('')
@@ -236,6 +239,7 @@ export function TelegramQrSetup({ onApplied, platform, scopeProfile }: TelegramQ
try {
const result = await applyTelegramOnboarding(setup.pairing_id, allowedIds, scopeProfile)
reset()
+ setConnectedBot(result.bot_username || botUsername)
onApplied(result)
} catch (applyError) {
setPhase('ready')
@@ -268,7 +272,14 @@ export function TelegramQrSetup({ onApplied, platform, scopeProfile }: TelegramQ
)}
</div>
- {platform.configured && phase === 'idle' && (
+ {phase === 'idle' && connectedBot && (
+ <div className="mt-2 flex flex-wrap items-center gap-2">
+ <Badge variant="success">{t.messaging.states.connected}</Badge>
+ <span className="font-mono text-xs text-muted-foreground">@{connectedBot}</span>
+ </div>
+ )}
+
+ {platform.configured && phase === 'idle' && !connectedBot && (
<p className="mt-2 text-[length:var(--conversation-caption-font-size)] leading-(--conversation-caption-line-height) text-muted-foreground">
{q.replaceWarning}
</p>