Skip to content

fix: resolve potential UnboundLocalError and improve handler robustness#66

Merged
RichardAtCT merged 2 commits intoRichardAtCT:mainfrom
RinZ27:fix/handler-robustness
Feb 23, 2026
Merged

fix: resolve potential UnboundLocalError and improve handler robustness#66
RichardAtCT merged 2 commits intoRichardAtCT:mainfrom
RinZ27:fix/handler-robustness

Conversation

@RinZ27
Copy link
Copy Markdown
Contributor

@RinZ27 RinZ27 commented Feb 20, 2026

Description

Richard's observation in Issue #63 regarding fragile bindings is addressed here. I initialized prompt at the function start to ensure it's always defined, preventing crashes during failed document processing.

Structured logging replaces the previous except: pass blocks to make error tracking more transparent. Every handler now reports its failures to the project logger instead of dropping them.

Errors are now passed through escape_html before being sent to Telegram. I noticed that unescaped characters in raw exception strings were occasionally causing HTML parse errors, which this fix resolves.

Related Issue

Fixes #63

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update

Testing

Manual verification confirmed that uninitialized variables are no longer a risk and errors render correctly in Telegram.

Checklist

  • Code follows project style guidelines
  • Self-review completed
  • No breaking changes introduced
  • Type hints included for new variables

@RinZ27 RinZ27 force-pushed the fix/handler-robustness branch from dc300b9 to 24186e8 Compare February 20, 2026 13:36
@RinZ27 RinZ27 force-pushed the fix/handler-robustness branch from 24186e8 to 5079273 Compare February 20, 2026 13:40
@RichardAtCT RichardAtCT merged commit cc439b0 into RichardAtCT:main Feb 23, 2026
1 check passed
@RinZ27 RinZ27 deleted the fix/handler-robustness branch February 23, 2026 08:14
altdev0x pushed a commit to altdev0x/claude-code-telegram that referenced this pull request Feb 23, 2026
…d bash checks; add skills to internal subdirs

Upstream PRs merged: RichardAtCT#62 (replace ToolMonitor with can_use_tool), RichardAtCT#94 (session
resume fallback), RichardAtCT#69 (bash chained command boundary), RichardAtCT#66 (handler robustness),
RichardAtCT#83 (session ownership enforcement).

Local change: add "skills" to _CLAUDE_INTERNAL_SUBDIRS so Claude Code can access
symlinked skills under ~/.claude/skills/.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix: potential UnboundLocalError in handle_document handler

2 participants