#11273: fix(telegram): prevent status command crash during thinking
channel: telegram
stale
Cluster:
Telegram Command Fixes
## Summary
- Prevent `/status` from crashing while model thinking state is active.
- Ensure session/config access remains safe during status rendering.
- AI-Assisted: Yes (built with Claude/OpenCode)
## Testing
- Verified branch diff against `upstream/main` is non-zero.
- Verified branch head SHA matches expected prepared commit.
<!-- greptile_comment -->
<h2>Greptile Overview</h2>
<h3>Greptile Summary</h3>
This PR makes three small changes:
- Replaces `console.warn` with the project logger (`logWarn`) during session fork initialization (`src/auto-reply/reply/session.ts`).
- Adjusts the default `staleMs` used by the session-store file lock to be a function of `timeoutMs`/`pollIntervalMs` (`src/config/sessions/store.ts`).
- Wraps Telegram native slash command dispatch in a `try/catch` so `/status` (and other commands) won’t crash the handler during transient session-state errors, and sends a user-facing retry message on failure (`src/telegram/bot-native-commands.ts`).
These changes are intended to keep status rendering resilient while the model is thinking and to make session/config access safer under concurrency, but the new lock-staleness heuristic needs adjustment to avoid overlapping writers.
<h3>Confidence Score: 3/5</h3>
- This PR is mergeable after fixing the session-store lock staleness regression
- Most changes are localized and improve resiliency/logging, but the updated `staleMs` default can cause active locks to be evicted when callers use small `timeoutMs` values, enabling overlapping writers to the session store.
- src/config/sessions/store.ts
<!-- greptile_other_comments_section -->
<sub>(3/5) Reply to the agent's comments like "Can you suggest a fix for this @greptileai?" or ask follow-up questions!</sub>
<!-- /greptile_comment -->
Most Similar PRs
#3186: fix(telegram): sanitize update offset + lock polling
by daxiong888 · 2026-01-28
82.5%
#8166: fix(telegram): lifecycle fixes for duplicate messages and auto-reco...
by cheenu1092-oss · 2026-02-03
81.4%
#13881: fix: Address Greptile feedback - test isolation and channel resolution
by trevorgordon981 · 2026-02-11
80.0%
#6463: fix(telegram): improve timeout handling and prevent channel exits
by ai-fanatic · 2026-02-01
79.6%
#10998: fix(agents): pass session thinking/reasoning levels to session_stat...
by wony2 · 2026-02-07
78.9%
#9012: fix(memory): resilient flush for large sessions [AI-assisted]
by cheenu1092-oss · 2026-02-04
78.9%
#20050: fix: Telegram polling regression and thinking blocks corruption (AI...
by Vaibhavee89 · 2026-02-18
78.1%
#9085: fix: improve stability for terminated responses and telegram retries
by vladdick88 · 2026-02-04
78.1%
#6457: fix(telegram): register commands for group scope + preserve topic t...
by dae-sun · 2026-02-01
77.5%
#4664: fix: per-session metadata files to eliminate lock contention
by tsukhani · 2026-01-30
77.2%