Skip to content

TELEGRAM_VERBOSE silently ignores '1' — accept common truthy values (consistency papercut) #683

Description

@griffinwork40

Summary

TELEGRAM_VERBOSE is parsed with a strict equality check against the literal string 'true':

src/telegram.ts:212

verbose: env.TELEGRAM_VERBOSE === 'true',

So TELEGRAM_VERBOSE=1 (also yes / on / TRUE) silently no-ops — the bot starts with verbose logging OFF and gives no indication the value was ignored.

Why it's a papercut

  • It's declared type: 'boolean' in the env registry (src/config/env.ts:704-709), but only one specific lowercase string is honored.
  • Every other VERBOSE-style flag in the codebase accepts '1', not 'true' — e.g. AFK_SKILL_STREAM_VERBOSE === '1' (src/cli/slash/builtin-skills.ts:94, src/cli/slash/_lib/create-skill-renderer.ts:56, src/cli/slash/plugin-skills/dispatch.ts:158). Muscle memory (FOO_VERBOSE=1) fails specifically here.
  • feat(telegram): per-target chat selection for send_telegram + scheduled tasks #681 added a clarifying note to the registry description ("The code checks the literal string 'true'"), which documents the sharp edge but does not remove it.

Suggested one-line fix

Accept the common truthy set, matching the declared boolean type:

verbose: ['1', 'true', 'yes', 'on'].includes((env.TELEGRAM_VERBOSE ?? '').trim().toLowerCase()),

Then simplify the env.ts:705 description. (Alternatively, if strictness is intentional, keep as-is — but then the boolean type annotation is misleading.)

Repro

  1. TELEGRAM_VERBOSE=1 afk telegram start
  2. Observe: no per-message logging; startup does not warn that the value was ignored.

Context: found while debugging Telegram group message delivery — verbose was needed to surface a silently-dropped (migrated-supergroup) chat id, and setting =1 first appeared to "do nothing."

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions