From deb5678d374a8d0053f361e3633677b53927ee81 Mon Sep 17 00:00:00 2001 From: Sam Catlow Date: Wed, 29 Jul 2026 03:24:01 +1000 Subject: [PATCH] remove task approval from Telegram command menu/help MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Hide /approve from Telegram's command menu, help text, and discoverability. Telegraph users can no longer learn about task approvals through the bot. /approve remains executable in the gateway router for email and webhook channels; non-Telegram workflow callers are unaffected. Daemon polling of forged waiting_human tasks and the Requeue(→implement) handoff are untouched. --- internal/channels/telegram/commands.go | 1 - internal/channels/telegram/telegram_test.go | 9 ++++++++- internal/gateway/gateway.go | 3 +++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/internal/channels/telegram/commands.go b/internal/channels/telegram/commands.go index 6c8fe0389..d00da474c 100644 --- a/internal/channels/telegram/commands.go +++ b/internal/channels/telegram/commands.go @@ -25,7 +25,6 @@ var gatewayCommandSpecs = []commandSpec{ {Command: "provider", Description: "Choose the provider used for chat", Usage: "/provider"}, {Command: "model", Description: "Show the model selector or switch directly", Usage: "/model [provider/model]"}, {Command: "spawn", Description: "Create a tracked task", Usage: "/spawn [identity=name] [repo=owner/name] [workflow=name] "}, - {Command: "approve", Description: "Approve and requeue a waiting task", Usage: "/approve [identity=name] <task-id>"}, {Command: "cancel", Description: "Cancel a queued or waiting task", Usage: "/cancel [identity=name] <task-id>"}, {Command: "restart", Description: "Reload Archie and its configuration", Usage: "/restart"}, {Command: "help", Description: "See what Archie can do", Usage: "/help"}, diff --git a/internal/channels/telegram/telegram_test.go b/internal/channels/telegram/telegram_test.go index 8aa019f5e..f9630f7cd 100644 --- a/internal/channels/telegram/telegram_test.go +++ b/internal/channels/telegram/telegram_test.go @@ -156,6 +156,13 @@ func TestVersionReportsBothComponents(t *testing.T) { } } +// telegramHiddenCommands lists gateway-local commands that are intentionally +// not advertised in Telegram's menu or help, because they are reserved or +// dangerous and should not be discoverable by casual chat users. Commands in +// this set may still be executable if typed explicitly — they just shouldn't +// appear on Telegram's discoverability surfaces. +var telegramHiddenCommands = map[string]bool{"approve": true} + func TestPublishedCommandsMatchExecutableCommandSurface(t *testing.T) { executable := make(map[string]bool) for _, command := range gateway.LocalCommands() { @@ -171,7 +178,7 @@ func TestPublishedCommandsMatchExecutableCommandSurface(t *testing.T) { } for command := range executable { - if !published[command] { + if !published[command] && !telegramHiddenCommands[command] { t.Errorf("executable /%s command is missing from the menu and help", command) } } diff --git a/internal/gateway/gateway.go b/internal/gateway/gateway.go index 08015ea9a..25cdb7d3b 100644 --- a/internal/gateway/gateway.go +++ b/internal/gateway/gateway.go @@ -172,6 +172,9 @@ func (r *Router) Route(ctx context.Context, msg Message) (string, error) { rest := restAfter(text, cmd, r.gatewayName) return r.handleSpawn(ctx, rest) case "/approve": + // Reserved for dangerous-command approval (archie-core-alm.6). + // Telegram hides it from its menu/help; other gateways keep it + // wired until the new design is wired up. return r.handleApprove(ctx, restAfter(text, cmd, r.gatewayName)) case "/cancel": return r.handleCancel(ctx, restAfter(text, cmd, r.gatewayName))