
























@@ -0,0 +1,196 @@
1+---
2+name: telegram-crabbox-e2e-proof
3+description: Use when reviewing, reproducing, or proving OpenClaw Telegram behavior with a real Telegram user on Crabbox, including PR review workflows that need an agent-controlled Telegram Desktop recording, TDLib user-driver commands, Convex-leased credentials, WebVNC observation, and motion-trimmed artifacts.
4+---
5+6+# Telegram Crabbox E2E Proof
7+8+Use this for Telegram PR review or bug reproduction when bot-to-bot proof is
9+not enough. The goal is to let the agent keep a real Telegram user session open
10+until it is satisfied, then attach visual proof.
11+12+Do not use personal accounts. Do not add credentials to the repo, prompt, or
13+artifact bundle. The runner leases the shared burner account from Convex.
14+15+## Start
16+17+Run from the OpenClaw repo and branch under test:
18+19+```bash
20+pnpm qa:telegram-user:crabbox -- start \
21+ --tdlib-url http://artifacts.openclaw.ai/tdlib-v1.8.0-linux-x64.tgz \
22+ --output-dir .artifacts/qa-e2e/telegram-user-crabbox/pr-review
23+```
24+25+This starts one held session:
26+27+- leases the exclusive `telegram-user` Convex credential
28+- restores TDLib and Telegram Desktop with the same user account
29+- starts a mock OpenClaw Telegram SUT from the current checkout
30+- selects the configured Telegram chat in the visible Linux desktop
31+- starts a 24fps desktop recording
32+- writes `.artifacts/qa-e2e/telegram-user-crabbox/pr-review/session.json`
33+34+Keep the session alive while investigating. It is valid for the agent to test
35+for minutes, run several commands, use WebVNC, inspect transcripts, and only
36+finish once the behavior is understood.
37+38+For deterministic visual repros, put the exact mock-model reply in a file and
39+pass it to `start`:
40+41+```bash
42+pnpm qa:telegram-user:crabbox -- start \
43+ --tdlib-url http://artifacts.openclaw.ai/tdlib-v1.8.0-linux-x64.tgz \
44+ --mock-response-file .artifacts/qa-e2e/telegram-user-crabbox/reply.txt \
45+ --output-dir .artifacts/qa-e2e/telegram-user-crabbox/pr-review
46+```
47+48+The runner defaults to `--class standard`, `--record-fps 24`,
49+`--preview-fps 24`, and `--preview-width 1920`. Keep those defaults unless the
50+proof needs something else.
51+52+## While Testing
53+54+For visual proof, first send or identify a bottom marker message, then open the
55+group/topic directly by message id:
56+57+```bash
58+pnpm qa:telegram-user:crabbox -- view \
59+ --session .artifacts/qa-e2e/telegram-user-crabbox/pr-review/session.json \
60+ --message-id <message-id>
61+```
62+63+This uses Telegram Desktop directly with `tg://privatepost`, not `xdg-open`.
64+It also resizes Telegram to `650x1000` at the tested desktop position so
65+Telegram switches to single-chat mode with no left chat list or right info
66+pane. Do not press Escape after this; Escape can close the selected chat.
67+68+Bottom behavior matters:
69+70+- deep-linking to the newest message keeps Telegram pinned to the bottom, so
71+ later messages appear live in the recording
72+- deep-linking to an older message does not auto-scroll to new arrivals; link
73+ again to the newest/final marker instead of clicking the down-arrow
74+- `650px` is the largest tested clean width; `660px` switches Telegram back to
75+ split/sidebar layout
76+77+Send as the real Telegram user:
78+79+```bash
80+pnpm qa:telegram-user:crabbox -- send \
81+ --session .artifacts/qa-e2e/telegram-user-crabbox/pr-review/session.json \
82+ --text /status
83+```
84+85+For slash commands, omit the bot username; the runner targets the SUT bot.
86+87+Run arbitrary commands on the Crabbox:
88+89+```bash
90+pnpm qa:telegram-user:crabbox -- run \
91+ --session .artifacts/qa-e2e/telegram-user-crabbox/pr-review/session.json \
92+ -- bash -lc 'source /tmp/openclaw-telegram-user-crabbox/env.sh && python3 /tmp/openclaw-telegram-user-crabbox/user-driver.py transcript --limit 20 --json'
93+```
94+95+Useful remote user-driver commands:
96+97+```bash
98+source /tmp/openclaw-telegram-user-crabbox/env.sh
99+python3 /tmp/openclaw-telegram-user-crabbox/user-driver.py status --json
100+python3 /tmp/openclaw-telegram-user-crabbox/user-driver.py chats --json
101+python3 /tmp/openclaw-telegram-user-crabbox/user-driver.py transcript --limit 20 --json
102+python3 /tmp/openclaw-telegram-user-crabbox/user-driver.py send --text '/status@{sut}'
103+python3 /tmp/openclaw-telegram-user-crabbox/user-driver.py probe --text '@{sut} Reply exactly: USER-E2E-{run}' --expect USER-E2E-
104+```
105+106+Capture the current desktop without ending the session:
107+108+```bash
109+pnpm qa:telegram-user:crabbox -- screenshot \
110+ --session .artifacts/qa-e2e/telegram-user-crabbox/pr-review/session.json
111+```
112+113+Check lease state and get the WebVNC command:
114+115+```bash
116+pnpm qa:telegram-user:crabbox -- status \
117+ --session .artifacts/qa-e2e/telegram-user-crabbox/pr-review/session.json
118+```
119+120+## Finish
121+122+Always finish or explicitly keep the box:
123+124+```bash
125+pnpm qa:telegram-user:crabbox -- finish \
126+ --session .artifacts/qa-e2e/telegram-user-crabbox/pr-review/session.json \
127+ --preview-crop telegram-window
128+```
129+130+`finish` stops recording, creates motion-trimmed MP4/GIF artifacts, captures a
131+final screenshot and logs, releases the Convex credential, stops the local SUT,
132+and stops the Crabbox lease. `--preview-crop telegram-window` also creates a
133+fixed-geometry GIF from the tested Telegram proof window for clean side-by-side
134+PR tables; the full desktop video/GIF remains in the artifact directory. Pass
135+`--keep-box` only when a human needs to continue VNC debugging after the
136+credential is released.
137+138+After any failure or interruption, verify cleanup:
139+140+```bash
141+crabbox list --provider aws
142+```
143+144+If a session file exists and the credential may still be leased, run `finish`
145+with that session file before retrying.
146+147+## Attach Proof
148+149+Attach only the useful visual artifact to the PR unless logs are needed. The
150+runner is GIF-only by default:
151+152+```bash
153+pnpm qa:telegram-user:crabbox -- publish \
154+ --session .artifacts/qa-e2e/telegram-user-crabbox/pr-review/session.json \
155+ --pr <pr-number> \
156+ --summary 'Telegram real-user Crabbox session motion GIF'
157+```
158+159+This copies only the useful GIF into a temporary publish bundle and comments
160+that GIF. If `finish --preview-crop telegram-window` produced a cropped GIF,
161+publish uses that; otherwise it uses `telegram-user-crabbox-session-motion.gif`.
162+Use `--full-artifacts` only when the PR needs logs or JSON output. Never publish
163+credential payloads, local env files, TDLib databases, Telegram Desktop
164+profiles, or raw session archives.
165+166+For before/after proof, run one session on `main` and one on the PR head, then
167+publish only the intended GIFs from a clean bundle:
168+169+```bash
170+mkdir -p .artifacts/qa-e2e/telegram-user-crabbox/pr-123/comparison
171+cp <main-output>/telegram-user-crabbox-session-motion-telegram-window.gif \
172+ .artifacts/qa-e2e/telegram-user-crabbox/pr-123/comparison/main-before.gif
173+cp <pr-output>/telegram-user-crabbox-session-motion-telegram-window.gif \
174+ .artifacts/qa-e2e/telegram-user-crabbox/pr-123/comparison/pr-after.gif
175+crabbox artifacts publish \
176+ --repo openclaw/openclaw \
177+ --pr 123 \
178+ --dir .artifacts/qa-e2e/telegram-user-crabbox/pr-123/comparison \
179+ --summary 'Telegram before/after proof' \
180+ --no-comment
181+```
182+183+Then post a concise markdown table with those two URLs. Do not publish working
184+directories that contain screenshots, raw videos, logs, session JSON, or crop
185+experiments unless those artifacts are explicitly needed.
186+187+## Quick Smoke
188+189+For a fast one-shot check, use:
190+191+```bash
192+pnpm qa:telegram-user:crabbox -- --text /status
193+```
194+195+This is a start/send/finish shortcut. Prefer the held session for PR review,
196+issue reproduction, or any task where the agent may need several attempts.
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。