Skip to content

feat(telegram): approval expiry UX, daily budget in /stats, friendly run errors - #229

Merged
jkyberneees merged 3 commits into
mainfrom
feat/telegram-ux-ergonomics
Sep 10, 2026
Merged

feat(telegram): approval expiry UX, daily budget in /stats, friendly run errors#229
jkyberneees merged 3 commits into
mainfrom
feat/telegram-ux-ergonomics

Conversation

@jkyberneees

Copy link
Copy Markdown
Contributor

Summary

Telegram UX/ergonomics improvements from a multi-persona review (product design, power user, reliability), hardened through two rounds of independent adversarial judge review:

  • Approval expiry UX: prompts now state their deadline ("expires in 2m0s"); on timeout the message is edited to ⏰ Expired with inline buttons stripped — no more stale keyboards inviting dead taps. Footer length is budgeted into the 4096-char truncation math; a failed expiry edit is logged.
  • /stats daily budget: shows Daily tokens: 4,200 / 10,000 (42%) against daily_token_budget (or unlimited), including honest >100% over-budget display.
  • Friendly run errors: rate limits explain attempts + retry hint + point to /stats; timeouts state the session is intact and completed work is saved (no overclaiming); generic errors keep the raw message.

Review process

  • 3 expert personas reviewed Telegram support; top-3 recommendations implemented
  • Independent adversarial judge round 1: REQUEST_CHANGES (MarkdownV2 escaping blocker + dishonest timeout copy) — fixed in 37393e1
  • Judge round 2: APPROVE, 5 minors — all closed in 0edc3b4 (keyboard-removal pinning, wrapped-deadline test, formatThousands edge cases, over-budget test, edit-error logging)

Test plan

  • internal/telegram: full suite green with -race -count=1
  • cmd/odek telegram-related tests green with -race -count=1
  • go build ./..., go vet, golangci-lint: clean
  • New tests: approver expiry (deadline text, Expired edit strips keyboard), friendlyRunError (rate-limit/timeout/wrapped/generic), formatThousands edge cases, /stats budget + over-budget

Docs

  • docs/TELEGRAM.md: approval-expiry behavior + updated /stats description

…run errors

UX/ergonomics improvements from a 3-persona review (product design,
power user, reliability):

- Approval prompts now state their deadline and are visibly marked
  Expired with buttons removed on timeout, so stale inline keyboards
  can't be tapped after the wait window closes. The footer length is
  budgeted into the 4096-char truncation math.
- /stats surfaces daily token usage against daily_token_budget
  (used/limit with percentage; 'unlimited' when no cap).
- Agent-run failures map to actionable chat messages: rate limits
  explain attempts, retry hint and point to /stats; timeouts state
  nothing was executed and the session is intact. Generic errors
  keep the raw message.

Docs: TELEGRAM.md approval-expiry and /stats sections updated.
…timeout copy

Independent adversarial review findings applied:

- Remove trailing periods from new MarkdownV2 strings in the approver
  (unescaped '.' outside entities risks Telegram parse rejection);
  the Expired edit and the expiry footer now match the escaping
  discipline used elsewhere in the codebase.
- Fix latent inconsistency: buildApprovalText now appends the footer
  variable instead of a duplicate Fprintf literal (keeps the 4096
  budget accounting honest if the footer ever changes).
- Timeout/rate-limit error copy no longer claims 'nothing was
  executed' — these errors wrap the whole run, so earlier tools may
  have executed. Now states the session is intact and completed work
  is saved. Test assertion updated to match the honest wording.
…ases, edit-error logging

- Expiry test now pins that the expired edit strips the inline
  keyboard (reply_markup with empty inline_keyboard), not just the
  Expired text.
- New tests: wrapped context.DeadlineExceeded maps to the timeout
  message (providers wrap deadlines in transport errors);
  formatThousands unit cases (0, boundaries, millions, negative);
  /stats shows honest >100% when usage exceeds the daily budget.
- approver: log a failed Expired edit instead of discarding the
  error, so stuck keyboards are diagnosable.
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
odek 0edc3b4 Commit Preview URL

Branch Preview URL
Sep 10 2026, 09:58 AM

@jkyberneees
jkyberneees merged commit a18f4be into main Sep 10, 2026
10 checks passed
@jkyberneees
jkyberneees deleted the feat/telegram-ux-ergonomics branch September 10, 2026 10:02
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