feat(telegram): live editable task tracker (Variant B+) #21

Merged
admin merged 1 commits from feat/telegram-live-tracker into main 2026-06-04 11:46:21 +03:00
Owner

Replace the ~15 separate Telegram messages per task with ONE live tracker message edited in place (editMessageText) per stage. Separate notifying messages only for: approve-gate, deploy-fail, agent-fail, error.

Format

  • Per-stage: ✅ Development 11м · 8.4M↓/45.8k↑ · $7.29 · opus-4-8 (in = input+cache_read+cache_creation; out separate; short model).
  • ⏸️ Ревью БРД · твоё время (human gate time = approve_requested→architecture).
  • Totals 💰 in↓/out↑ · $; finish ⏱️ Всего/агенты/твоё + 🔗 PR · 📦 deployed.

Impl

  • db.py: idempotent ALTERs (tracker_message_id, title, brd_review_*, agent_runs.model) + helpers.
  • usage.py: short_model_name + model parse/persist.
  • notifications.py: render_task_tracker (stateless), update_task_tracker (send→store→edit, fallback to new msg, silent), edit_telegram.
  • stage_engine.py: stamp brd_review_ended on analysis→architecture.
  • webhooks/plane.py: persist title.
  • tests/test_telegram_tracker.py.

No longer sent as separate messages: agent start, agent finish, stage transition, QG-pending, QG-passed.

pytest: 259 passed, 9 failed (same off-limits HMAC/401 set; baseline on this host 244+9).

NOT touched: usage_comment/Plane comments, PLANE_STATES, launcher.py deployer guard, HMAC/queue/cost calc.

Replace the ~15 separate Telegram messages per task with ONE live tracker message edited in place (editMessageText) per stage. Separate notifying messages only for: approve-gate, deploy-fail, agent-fail, error. ## Format - Per-stage: `✅ Development 11м · 8.4M↓/45.8k↑ · $7.29 · opus-4-8` (in = input+cache_read+cache_creation; out separate; short model). - `⏸️ Ревью БРД · твоё время` (human gate time = approve_requested→architecture). - Totals `💰 in↓/out↑ · $`; finish `⏱️ Всего/агенты/твоё` + `🔗 PR · 📦 deployed`. ## Impl - db.py: idempotent ALTERs (tracker_message_id, title, brd_review_*, agent_runs.model) + helpers. - usage.py: short_model_name + model parse/persist. - notifications.py: render_task_tracker (stateless), update_task_tracker (send→store→edit, fallback to new msg, silent), edit_telegram. - stage_engine.py: stamp brd_review_ended on analysis→architecture. - webhooks/plane.py: persist title. - tests/test_telegram_tracker.py. No longer sent as separate messages: agent start, agent finish, stage transition, QG-pending, QG-passed. pytest: 259 passed, 9 failed (same off-limits HMAC/401 set; baseline on this host 244+9). NOT touched: usage_comment/Plane comments, PLANE_STATES, launcher.py deployer guard, HMAC/queue/cost calc.
admin added 1 commit 2026-06-04 11:43:09 +03:00
Replace the ~15 separate Telegram messages per task (agent start/finish, stage
transition, QG-pending, tech noise) with ONE live tracker message edited in
place (editMessageText) on every stage transition. Only attention-worthy events
are still sent as SEPARATE, notifying messages: approve-gate, deploy-fail,
agent-fail, task error.

- db.py: idempotent ALTERs — tasks.tracker_message_id, tasks.title,
  tasks.brd_review_started_at/ended_at, agent_runs.model. Helpers for
  tracker message_id + BRD-review clock.
- usage.py: short_model_name() (strip provider/claude- prefix); parse model
  from result-JSON modelUsage; record_usage persists model.
- notifications.py: render_task_tracker(task_id) (stateless render from
  agent_runs), update_task_tracker (sendMessage->store id->editMessageText with
  fallback to a new message, silent), edit_telegram(). Per-stage line
  in↓/out↑·cost·model, ⏸️ Ревью БРД (human time), 💰 totals, finish block
  (⏱️ wall/agents/yours, 🔗 PR · 📦). notify_* are now tracker-only/log-only
  except the four alerts.
- stage_engine.py: stamp brd_review_ended on analysis->architecture advance.
- webhooks/plane.py: persist task title on creation.
- tests/test_telegram_tracker.py: render, short_model_name, send/edit/fallback,
  separate-vs-silent alert behavior.
admin merged commit 3e5c74ce4f into main 2026-06-04 11:46:21 +03:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: admin/orchestrator#21