#23062: Fix #22985: Record session meta from native slash commands
channel: telegram
size: XS
Problem: Telegram slash command handlers called finalizeInboundContext but never called recordSessionMetaFromInbound, so channel metadata was never persisted to the session store.
Why it matters: Without channel metadata, session-aware features like /elevated mode and exec approval gates always fail with channel: (unknown) and allowedByConfig: false, making them completely non-functional via slash commands.
What changed: Added recordSessionMetaFromInbound call after finalizeInboundContext in bot-native-commands.ts, mirroring the pattern used in channels/session.ts and line/bot-message-context.ts.
What did NOT change: No behavior changes to regular message handling, no config changes, no other files modified.
Change Type
Bug fix
Scope
Gateway / orchestration
Auth / tokens
Linked Issue/PR
Closes #22985
User-visible / Behavior Changes
/elevated mode and exec approval gates now function correctly when invoked via Telegram slash commands.
Security Impact
New permissions/capabilities? No
Secrets/tokens handling changed? No
New/changed network calls? No
Command/tool execution surface changed? No — this restores intended behavior, not new capability
Data access scope changed? No
Repro + Verification
Environment
OS: macOS
Runtime/container: Docker (openclaw:local)
Model/provider: Anthropic Claude / Ollama
Integration/channel: Telegram
Steps
Configure /elevated with tools.elevated.allowFrom.telegram
Send /elevated full via Telegram
Observe channel: (unknown) and allowedByConfig: false
Expected
/elevated activates successfully
Actual (before fix)
channel: (unknown), allowedByConfig: false — elevated mode never activates
Evidence
Verified via openclaw sandbox explain --session telegram:slash:<id> before and after patch
Before: channel: (unknown), allowedByConfig: false
After: /elevated full responds with "Elevated mode set to full (auto-approve)"
Human Verification
Verified /elevated full works via Telegram after patch
Verified regular message handling unaffected
Did not verify Discord/Slack slash command handlers (same pattern likely applies)
Compatibility / Migration
Backward compatible? Yes
Config/env changes? No
Migration needed? No
Failure Recovery
Revert by removing the recordSessionMetaFromInbound call added at line 597
No config to restore
Bad symptom: session store errors in gateway logs
Risks and Mitigations
Risk: recordSessionMetaFromInbound fails silently and logs errors
Mitigation: Uses .catch(() => {}) pattern — failure is non-fatal, consistent with other handlers
Most Similar PRs
#13507: fix(session): keep daily resets from metadata updates
by marijnvdwerf · 2026-02-10
69.6%
#13580: fix(telegram): skip updateLastRoute when dmScope isolates DM sessions
by lailoo · 2026-02-10
69.5%
#7537: fix(sessions): reset token counts on /new for channel sessions
by SoniAssist · 2026-02-02
68.3%
#21271: fix(commands): pass channel/capabilities/shell/os to runtime in com...
by evansantos · 2026-02-19
68.2%
#17527: fix(gateway): allow WebChat to attach to main session regardless of...
by Glucksberg · 2026-02-15
68.2%
#17132: fix: filter out invalid session entries with empty sessionFile
by Limitless2023 · 2026-02-15
68.1%
#22887: Preserve daily reset timestamps for inbound session metadata updates
by graysurf · 2026-02-21
67.8%
#19435: fix(slack): properly handle group DM (MPIM) events
by Utkarshbhimte · 2026-02-17
67.6%
#16061: fix(sessions): tolerate invalid sessionFile metadata
by haoyifan · 2026-02-14
67.3%
#23312: fix(gateway): strip inbound metadata in chat history sanitization
by SidQin-cyber · 2026-02-22
66.8%