Skip to content

feat: add Support Engineer (auto error detection and repair)#195

Open
Paritoshdagar wants to merge 1 commit intoRichardAtCT:mainfrom
Paritoshdagar:feat/support-engineer
Open

feat: add Support Engineer (auto error detection and repair)#195
Paritoshdagar wants to merge 1 commit intoRichardAtCT:mainfrom
Paritoshdagar:feat/support-engineer

Conversation

@Paritoshdagar
Copy link
Copy Markdown

Summary

Adds a SupportEngineer class that runs as an APScheduler cron job (every minute) inside the existing bot process. Scans bot.db for errors, matches against known patterns, applies fixes, and escalates unknowns to the owner via Telegram.

Test plan

  • Support Engineer started on bot startup (support_engineer.enabled in logs)
  • Health check runs every minute (* * * * *)
  • Errors found in messages table → escalated to owner Telegram (13 escalations in first run)
  • Fixes applied → logged in support_fixes table

🤖 Generated with Claude Code

- New module src/scheduler/support_engineer.py:
  - Runs as APScheduler cron job (* * * * *) every minute
  - Scans messages table for errors (messages.error IS NOT NULL)
  - Matches against KNOWN_ERRORS patterns
  - Applies fixes: hindsight bank recreation, bot.db reclone, homedir perms
  - Logs fix attempts to support_fixes table
  - Escalates unknown errors to owner via Telegram (chat_id from APPROVED_USERS)
  - Uses existing telegram.Bot instance via set_bot_and_owner()
- main.py: wires SupportEngineer into lifecycle after scheduler
- config/features.py: adds support_engineer_enabled property
- config/settings.py: adds enable_support_engineer field (env: ENABLE_SUPPORT_ENGINEER)

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Paritoshdagar added a commit to Paritoshdagar/claude-tenant-platform that referenced this pull request Apr 25, 2026
…s) (#10)

Support Engineer runs as a cron job (* * * * *) inside the existing
claude-code-telegram bot process. Every minute it:
  - Scans messages table for errors (messages.error IS NOT NULL)
  - Matches against KNOWN_ERRORS patterns
  - Applies fixes: hindsight bank recreation, bot.db reclone, homedir perms
  - Logs fix attempts to support_fixes table
  - Escalates unknown errors to owner via Telegram (chat_id from APPROVED_USERS)

Implementation:
  - src/scheduler/support_engineer.py (new module in bot codebase)
  - main.py: wires SupportEngineer into lifecycle (ENABLE_SUPPORT_ENGINEER=true)
  - config/features.py: adds support_engineer_enabled property
  - config/settings.py: adds enable_support_engineer field

Bot repo: https://github.com/Paritoshdagar/claude-code-telegram
PR: RichardAtCT/claude-code-telegram#195

feat(phase4): add tenant_activate.py and tenant_deactivate.py

tenant_activate.py:
  - Reads tenant from bot.db, installs per-tenant systemd service
  - Creates /etc/systemd/system/claude-tenant@<username>.service
  - Runs systemctl daemon-reload + start

Note: Per-tenant Claude Code sessions require Claude Code installed
system-wide or per-user (currently installed under /root/.local/).
Service installs but will fail until Claude is made system-accessible.

tenant_deactivate.py:
  - systemctl stop + disable + removes unit file

Co-authored-by: Claude Opus 4.7 <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.

1 participant