openclaw - ✅(Solved) Fix Bug: resolveTelegramReasoningLevel ignores agents.list[].reasoningDefault, always returns "off" [1 pull requests, 1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#77227Fetched 2026-05-05 05:50:59
View on GitHub
Comments
1
Participants
2
Timeline
2
Reactions
2
Author
Timeline (top)
commented ×1cross-referenced ×1

The resolveTelegramReasoningLevel function in the Telegram channel resolver does not fall back to agents.list[].reasoningDefault. When a session store entry has no reasoningLevel set, it always returns "off", ignoring the agent-level config.

Root Cause

The resolveTelegramReasoningLevel function in the Telegram channel resolver does not fall back to agents.list[].reasoningDefault. When a session store entry has no reasoningLevel set, it always returns "off", ignoring the agent-level config.

Fix Action

Workaround

Manually patch dist/bot-*.js to add the fallback logic before return "off". The patch needs to be re-applied after every upgrade.

PR fix notes

PR #77236: fix(telegram): honor agents.list[].reasoningDefault and agents.defaults.reasoningDefault

Description (problem / solution / changelog)

Problem

resolveTelegramReasoningLevel in extensions/telegram/src/bot-message-dispatch.ts reads only the session-stored reasoningLevel and falls straight to "off" when no stored value exists. It does not consult either:

  • cfg.agents.list[].reasoningDefault (per-agent default)
  • cfg.agents.defaults.reasoningDefault (global default)

This contradicts the documented resolution order that the shared get-reply-directives.ts resolver already follows: session override → per-agent default → global default → off.

User-visible effect: setting agents.list[].reasoningDefault = "stream" has no effect in Telegram for fresh sessions. Reasoning previews and block streaming stay off until the user manually issues a /reasoning command, then it survives until the session is reset.

Fix

After the session-store lookup, fall back to per-agent reasoningDefault, then to agents.defaults.reasoningDefault, then to "off". The shape mirrors the configuredReasoningDefault resolution at src/auto-reply/reply/get-reply-directives.ts:435.

Tests

Added four cases to bot-message-dispatch.test.ts:

  • Falls back to per-agent reasoningDefault: "on" when session has no stored level
  • Falls back to global agents.defaults.reasoningDefault: "stream" when no per-agent default is set
  • Per-agent reasoningDefault wins over global agents.defaults.reasoningDefault
  • Session-stored reasoningLevel still wins over both configured defaults

Note on authorization parity

The Codex review on the issue flagged that the fix should mirror shared authorization semantics (canUseReasoningState gating of configured defaults). I intentionally kept this change narrow — the existing function reads session-stored values without authorization gating either, so the fix preserves the function's existing trust model. Full authorization parity with get-reply-directives.ts would require plumbing CommandAuthorized (or richer auth context) through resolveTelegramReasoningLevel and is a broader change. Happy to fold that in if maintainers prefer.

Fixes #77227.

Changed files

  • CHANGELOG.md (modified, +1/-0)
  • extensions/telegram/src/bot-message-dispatch.test.ts (modified, +240/-0)
  • extensions/telegram/src/bot-message-dispatch.ts (modified, +39/-14)

Code Example

function resolveTelegramReasoningLevel(params) {
    const { cfg, sessionKey, agentId, telegramDeps } = params;
    if (!sessionKey) return "off";
    try {
        const storePath = telegramDeps.resolveStorePath(cfg.session?.store, { agentId });
        const level = resolveSessionStoreEntry({
            store: (telegramDeps.loadSessionStore ?? loadSessionStore)(storePath, { skipCache: true }),
            sessionKey
        }).existing?.reasoningLevel;
        if (level === "on" || level === "stream") return level;
    } catch {}
    return "off";
}

---

// fallback to agent's reasoningDefault config
try {
    const _agents = cfg.agents?.list;
    if (Array.isArray(_agents)) {
        const _entry = _agents.find(e => e.id === agentId);
        if (_entry?.reasoningDefault === "on" || _entry?.reasoningDefault === "stream") return _entry.reasoningDefault;
    }
} catch {}
RAW_BUFFERClick to expand / collapse

Bug Report

Summary

The resolveTelegramReasoningLevel function in the Telegram channel resolver does not fall back to agents.list[].reasoningDefault. When a session store entry has no reasoningLevel set, it always returns "off", ignoring the agent-level config.

Current Behavior

function resolveTelegramReasoningLevel(params) {
    const { cfg, sessionKey, agentId, telegramDeps } = params;
    if (!sessionKey) return "off";
    try {
        const storePath = telegramDeps.resolveStorePath(cfg.session?.store, { agentId });
        const level = resolveSessionStoreEntry({
            store: (telegramDeps.loadSessionStore ?? loadSessionStore)(storePath, { skipCache: true }),
            sessionKey
        }).existing?.reasoningLevel;
        if (level === "on" || level === "stream") return level;
    } catch {}
    return "off";
}

When the session store has no reasoningLevel for the session key, the function falls straight to return "off", ignoring agents.list[].reasoningDefault.

Expected Behavior

The function should fall back to agents.list[].reasoningDefault (if set) before returning "off".

Suggested fix — add before return "off":

// fallback to agent's reasoningDefault config
try {
    const _agents = cfg.agents?.list;
    if (Array.isArray(_agents)) {
        const _entry = _agents.find(e => e.id === agentId);
        if (_entry?.reasoningDefault === "on" || _entry?.reasoningDefault === "stream") return _entry.reasoningDefault;
    }
} catch {}

Reproduction

  1. Set agents.list[].reasoningDefault to "stream" in config
  2. Start a new Telegram session (no prior /reasoning command)
  3. Send a message — reasoning is "off" instead of "stream"

Environment

  • OpenClaw version: 2026.5.3
  • Channel: Telegram
  • Config: agents.list[].reasoningDefault = "stream"

Workaround

Manually patch dist/bot-*.js to add the fallback logic before return "off". The patch needs to be re-applied after every upgrade.

Related Issues

  • #13607 — global default for reasoning visibility
  • #64236 — per-model reasoningDefault
  • #64830 — Web UI not respecting reasoningDefault (fixed, but Telegram resolver was not addressed)

extent analysis

TL;DR

Add a fallback to agents.list[].reasoningDefault before returning "off" in the resolveTelegramReasoningLevel function to ensure the function respects the agent-level config when no reasoningLevel is set in the session store.

Guidance

  • Verify that agents.list[].reasoningDefault is correctly set in the config to the desired default reasoning level, such as "stream".
  • Implement the suggested fix by adding the fallback logic before return "off" in the resolveTelegramReasoningLevel function, as provided in the issue description.
  • Test the function with a new Telegram session and no prior /reasoning command to ensure it now correctly defaults to the agent's reasoningDefault config.
  • Consider applying the manual patch to dist/bot-*.js as a temporary workaround until a formal fix is released.

Example

The suggested fix provided in the issue can be directly applied:

// fallback to agent's reasoningDefault config
try {
    const _agents = cfg.agents?.list;
    if (Array.isArray(_agents)) {
        const _entry = _agents.find(e => e.id === agentId);
        if (_entry?.reasoningDefault === "on" || _entry?.reasoningDefault === "stream") return _entry.reasoningDefault;
    }
} catch {}

Notes

This fix assumes that agents.list[].reasoningDefault is correctly configured and that the agentId matches an entry in agents.list. The manual patch workaround requires re-application after every upgrade, highlighting the need for an official fix.

Recommendation

Apply the workaround by adding the fallback logic to the resolveTelegramReasoningLevel function, as this directly addresses the issue and ensures the function behaves as expected until a formal fix is available.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

openclaw - ✅(Solved) Fix Bug: resolveTelegramReasoningLevel ignores agents.list[].reasoningDefault, always returns "off" [1 pull requests, 1 comments, 2 participants]