Your bot works on your laptop. BotProof proves it works in Telegram.
End-to-end tests for Telegram bots: plain-English flows, run by Kane CLI by TestMu AI in real Telegram Web, fixed by your coding agent until they pass.
| Kane run | Result |
|---|---|
group_close_admin before |
❌ FAIL at step 3: anonymous group owner's /close refused |
| Claude Code patch | one condition in demo-bot/src/bot.ts, redeployed to Vercel |
group_close_admin after |
✅ PASS on the first retry |
Replay both runs, no Telegram login: evidence packs · full fix log · the bug explained
Demo video · Demo bot · For judges · Install
Status (23 Nov 2026): 18 of 22 flows pass live in real Telegram Web (✅ below), Kane caught 1 real bug in the demo bot, and the fix loop fixed it end to end (Kane fail → Claude Code patch → redeploy → Kane pass). Run logs for every live run are in
botproof/runs/; what was verified and how is in docs/FINDINGS.md.
Taken by Kane in Telegram Web during the runs on 22 Nov (cropped to the chat pane; the test account's chat list is left out).
The bug: the anonymous owner's /close is refused |
After the fix, Kane confirms the order closes |
|---|---|
![]() |
![]() |
| Inline menu, edited in place | Group order with who tapped | Channel post with vote buttons |
|---|---|---|
![]() |
![]() |
![]() |
Telegram bots are tested by hand: open Telegram, send /start, tap a button, scroll, repeat after every change.
Unit tests mock the Bot API, so they never see what a user sees: a button that does nothing, a message that fails to
render, a keyboard that never goes away, a Mini App that opens blank.
Telegram is a third-party login we can't hand over, so every passing flow ships with a recorded run instead: its Kane evidence pack (release), its run log and the demo video (no login needed).
| Do this | You'll see |
|---|---|
1. No login needed: download a pack from the evidence-packs release, then npx @testmuai/kane-cli evidence serve <pack>.evidence |
Kane's run step by step: screenshots of Telegram Web, what it tapped, what it checked |
2. Read one flow, e.g. menu_pagination_test.md |
The whole test is plain English |
| 3. Read a real fix-loop log | Kane fails a flow → Claude patches the bot → Kane re-runs → pass |
4. Open the demo bot in Telegram and send /start, then /menu |
The bot under test, live |
| 5. Run it yourself with your own test Telegram account: Install and run | botproof run start menu_pagination group_order prints PASS/FAIL per flow with an evidence link |
BotProof is a thin layer around Kane; Kane is the only thing that touches Telegram. What it uses, all verified against Kane CLI 0.10.7 (FINDINGS):
| Kane feature | How BotProof uses it |
|---|---|
testmd run + plain-English _test.md flows |
one flow per user journey; local_context frontmatter gives Kane Telegram-specific tips (telegram-context.md) |
--cdp-endpoint |
BotProof starts Chrome on the test account's profile and attaches Kane to it, so Kane works in a logged-in Telegram Web |
--variables-file, --timeout |
bot, group and channel names come from botproof.config.json; long Telegram steps get time |
--agent NDJSON stream |
test_md_step_start/end, run_end (credits), test_md_done → live progress, per-flow time and credits |
| Exit codes 0 / 1 / 2 / 3 | pass / bot failure / setup error / cancelled: only exit 1 can reach the fix loop |
| Evidence packs (failure record, screenshots, triage) | the failing step, Kane's remark, screenshot and Kane's own triage go into the agent's brief; triage blaming automation or Telegram stops the loop without patching |
| Recorded replays | an unchanged flow replays from Kane's cache: item_details passed in 63 s for 0 credits |
evidence serve, evidence merge |
anyone replays a run without logging in (packs); botproof run --merge joins a suite's packs into one |
Every row is a _test.md flow Kane runs in Telegram Web against the demo bot. ✅ = passed live (run logs in botproof/runs/).
| Area | What is checked | Flow |
|---|---|---|
| Commands & deep links | /start welcome renders with a main menu of buttons (menu, checkout, help, cancel, add to group); /help lists commands; t.me/<bot>?start=promo applies the promo |
start ✅ · main_menu ✅ · help ✅ · deeplink ✅ |
| Inline keyboards | next/prev edits the same message; item opens details in place; URL button target; callback alert | menu_pagination ✅ · item_details ✅ |
| Reply keyboards | custom keyboard appears, sends "2", one-time keyboard is gone afterwards | reply_keyboard |
| Conversations | name → phone, re-asks on bad input, confirm; /cancel mid-way |
conversation ✅ · conversation_cancel ✅† |
| Message rendering | bold, code and link render; no raw <b>, **, \ or "message is empty" |
formatting ✅ |
| Media | order photo arrives with the right caption and order number | conversation ✅ |
| Mini App | opens inside Telegram, form + Telegram main button work, data reaches the bot | miniapp_checkout ✅ |
| Menu button | opens the Mini App; paying from it reaches the bot | menu_button ✅ |
| Groups | /menu@bot; group order edited with who tapped; admin /close; privacy mode (plain ignored, mention/reply answered); removed and re-added |
group_menu ✅† · group_order ✅ · group_close_admin ✅ · group_privacy ✅¹ · group_membership |
| Channels | posts "today's special"; 👍/👎 votes edit the post; bot edits and deletes its post; comments in the discussion group reach the bot | channel_special_vote ✅ · channel_edit_delete ✅ · channel_comments |
| Stretch | inline mode; stale buttons after cancel | inline_mode ✅ · stale_button |
¹ group_privacy passed on privacy mode (plain message ignored) and mentions; its optional Reply step was skipped, so
replying to the bot is not yet verified live.
† Passed live on 22 Nov (FINDINGS), but the batch was killed for memory before it wrote a run log, so there is no published pack yet; re-run pending.
Not built: tests that need a second Telegram account (new-member welcome, non-admin /close refusal, "only A can tap A's
buttons"). They are possible with a second Chrome profile but were left out to keep the single-account flows reliable.
botproof fix
│
▼
Kane runs the flows in Telegram Web ──── all pass ──► done (log written)
│ a flow fails
▼
brief for the agent: flow file · failing step · Kane's remark ·
evidence pack · failure screenshot · bot sources
│
▼
Claude Code patches the bot ──► edits outside the allowlist are blocked (PreToolUse hook)
│ and reverted (git snapshot check)
▼
bot restarted / redeployed ──► Kane re-runs only the failed flows
│
└── still failing after 3 attempts ──► stop, escalate to a human with the full log
- Editable paths come from
fix.editableinbotproof/botproof.config.json(default:demo-bot/src/**,demo-bot/api/**,demo-bot/public/**). Flow files,botproof/,cli/and.claude/are always protected. - Every attempt is logged to
botproof/runs/<id>/LOG.md: what failed, Kane's remark, the agent's explanation, the diff, the re-run. - Two ways to drive it:
botproof fixruns the agent itself (claude -p …); inside Claude Code,/botproof-fixuses the skill andbotproof fix --step, one attempt per call.
A real run (full log, 22 Nov): Kane found that the bot refuses
/close from an anonymous group admin. Claude Code patched one condition, BotProof redeployed to Vercel, Kane passed.
| Step | What happened |
|---|---|
| Kane run | group_close_admin failed at step 3 "Close as the group owner": "the bot replied that only group admins can close the order" (374 s, 71.6 credits) |
| Brief → agent | flow, Kane's remark, failure record and screenshot handed to Claude Code |
| Patch (attempt 1) | demo-bot/src/bot.ts only; no edits outside the allowlist |
| Redeploy | vercel deploy --prod (only demo-bot/ uploaded) |
| Kane re-run | passed (185 s, 20.4 credits) → loop ends, exit 0 |
bot.chatType(["group", "supergroup"]).command("close", async (ctx) => {
- if (!(await isAdmin(ctx, ctx.chat.id, ctx.from.id))) {
+ // An anonymous admin posts as the group itself: from is @GroupAnonymousBot, sender_chat is the group.
+ const anonymousAdmin = ctx.msg.sender_chat?.id === ctx.chat.id;
+ if (!anonymousAdmin && !(await isAdmin(ctx, ctx.chat.id, ctx.from.id))) {The loop also refuses to patch when the bot isn't at fault: in an earlier attempt a Telegram Web tip covered the screen, Kane's triage blamed the automation, and BotProof stopped without asking the agent (see FINDINGS).
See docs/caught.md. Only bugs Kane actually caught while building the demo bot are listed.
- Anonymous group admins couldn't close a group order: the bot answered "Only group admins" to the group's own owner.
Caught by
group_close_admin, fixed by the loop in80593e8.
Built and tested on 22–23 Nov against a test page driven the way Kane drives Chrome; not yet used on a live Telegram run (see Roadmap).
Kane itself has no video output, but BotProof owns the Chrome that Kane drives, so it can film it:
node cli/dist/index.js run menu_pagination --record # films the Telegram Web page while Kane works
node cli/dist/index.js video # → botproof/recordings/<time>-<flow>/video.mp4Each video is a title card, Kane's live footage of real Telegram Web (every moment the screen changes plays at real speed; the long pauses while
Kane thinks are cut to under a second), a caption naming the
step Kane is on, a cursor that glides to every spot Kane really clicked (Kane drives Chrome with input events and never
shows a cursor, so BotProof logs each click during --record and draws it), and a PASS/FAIL card with Kane's remark: something to attach to a pull request or show a client.
It uses Chrome's own screencast (CDP Page.startScreencast) and ffmpeg (ffmpeg-static is an optional dependency).
demo-bot/ is Brew Bot, a coffee-order bot (grammY) built to exercise every area above:
paginated inline menu, callback alerts, quantity reply keyboard, a /start main menu of buttons, a validated order conversation, an HTML-formatted
summary and photo, a checkout Mini App (public/checkout.html) with Telegram's main button, a menu button, group
orders with admin-only /close, and a channel "today's special" with votes and comment replies.
It runs on Vercel: https://brewbot-botproof.vercel.app (webhook /api/webhook, Mini App /checkout.html).
Bot: @botproofbot (shown as "Brew Bot"). Test group: t.me/testingbotproofgroup. Test channel: t.me/testingbotproof.
Download them from the evidence-packs release. 24 passing runs, plus 42fbcfdb, the failing run where
Kane caught the anonymous-admin /close bug (the passing re-run after the fix is 28a588a6). Replay one with
kane-cli evidence serve <file>.evidence; the execution IDs match the run logs in botproof/runs/.
Cleaned before upload, and each still passes kane-cli evidence validate: screenshots are cropped to the chat pane (the
test account's chat list is left out), log lines quoting that chat list are redacted, one long-expired login QR code is
blurred, and every pack was checked for cookies, localStorage, auth keys, tokens, Chrome profile files and the bot token.
Because of the cropping they are not byte-identical to the packs Kane wrote.
Needs Node 20+, Google Chrome, a TestMu AI account, and a dedicated test Telegram account (never your personal one).
npm install -g @testmuai/kane-cli && kane-cli loginnpx botproof init # in your bot's repo: checks Chrome + Kane, logs the test account into Telegram Web, writes config, a sample flow and the Claude Code edit guardnpx botproof run startnpx botproof fix start # fail → Claude Code patches the bot → Kane re-runs, max 3 attemptsThen write your own flows in botproof/flows/ and set fix.editable in botproof/botproof.config.json to your bot's
source folders. npx botproof --help lists every command.
To run the demo bot's 22 flows instead, clone this repo:
git clone https://github.com/ahmardchain/Botproof && cd Botproof && npm installnpx botproof run start menu_pagination item_details group_order # flows that pass liveCI (.github/workflows/ci.yml) runs on every push: the CLI's unit tests on Node 20 and 22,
installs the packed CLI into an empty project and runs botproof init there, and type-checks and tests the demo bot.
Live Kane runs are not in CI: they need a logged-in Telegram test account, which a hosted runner doesn't have.
Tagging v* publishes the CLI to npm (publish.yml).
- Live Telegram footage in the demo video.
run --record+botproof video(real-speed footage, pauses cut, cursor from Kane's real clicks) is built; next is recording the passing flows with it and cutting those clips into the narrated demo. The current demo video uses Kane's screenshots and phone photos of the chat. - The remaining flows:
reply_keyboard,stale_buttonandchannel_commentseach failed twice on Kane-side issues while the bot behaved correctly (FINDINGS);group_membershipwas stopped for low memory mid-run. Also the optional Reply step ingroup_privacy. - Second test account for multi-user group tests (new-member welcome, non-admins refused, only A can tap A's buttons).
- Parallel runs: one Chrome profile per worker, so a suite doesn't run one flow at a time.
- Live runs in CI: a self-hosted runner with the test account's Chrome profile, so Kane runs the passing flows on every push.
| What we hit | Workaround |
|---|---|
| When Kane launched Chrome itself, it sometimes used a blank temp profile or emptied the logged-in one | BotProof owns Chrome: it copies the master profile (~/.botproof/chrome-profile, never committed) for each flow, starts Chrome on the copy and attaches Kane with --cdp-endpoint |
testmd run has no --chrome-profile flag (only kane-cli run does) |
same: CDP attach instead of a profile flag |
kane-cli testrun gives each worker a fresh profile, so no Telegram session |
flows run one after another with testmd run; packs are joined with evidence merge (FINDINGS) |
| Telegram Web tips covered the screen; "Updating…" after a profile copy made Kane click into nothing | local_context tells Kane to close tips; BotProof waits until Telegram Web is connected before starting Kane, and fails fast (0 credits) on the login screen |
| Kane's triage sometimes blamed itself even when the bot had visibly answered wrongly | the fix loop overrides triage when the failure record shows a bot reply, and uses the last failure record, not the first |
| Kane could not operate Telegram's right-click → Reply menu in two runs | that step is optional in group_privacy; the verdict rests on privacy mode and mentions |
| Web K collapses a reply keyboard behind a keyboard icon in the message bar; in two runs Kane did not expand it | reply_keyboard step reworded to expand it; still not passing, so reply keyboards are not verified live (the bot does send the keyboard) |
inline_mode failed while inline mode was off for the bot (getMe.supports_inline_queries: false); code cannot switch it on |
switch it on once in @BotFather with /setinline (and a placeholder); after that inline_mode passed live |
| Kane has no video output and draws no cursor | run --record films Kane's Chrome over CDP and logs its clicks; botproof video draws the cursor |
Other limits: Telegram Web K only (not the official apps); needs a dedicated test Telegram account; multi-account group tests are not built; 18 of the 22 flows have passed live so far, the other 4 are written but not yet green (Roadmap).
cli/ the botproof CLI (TypeScript): init, run (--record), fix, why, video, hook
botproof/flows/ 22 plain-English Kane flows (*_test.md)
botproof/botproof.config.json variables, editable allowlist, agent command
demo-bot/ Brew Bot + Mini App, deployed on Vercel
.claude/ Claude Code skill, /botproof-fix command, edit-guard hook
docs/ FINDINGS (spike), caught bugs, demo script, posts, submission
Built for the KaneCLI Online Hackathon by TestMu AI.




