From 5fb9c0c937ca0d09411e4d0eb13242bab1f25435 Mon Sep 17 00:00:00 2001 From: Ayaan Zaidi Date: Mon, 18 May 2026 18:30:07 +0530 Subject: [PATCH] fix(mantis): crop telegram proof chat pane --- .../telegram-crabbox-e2e-proof/SKILL.md | 8 +++---- scripts/e2e/telegram-user-crabbox-proof.ts | 23 ++++++++++++------- ...is-telegram-desktop-proof-workflow.test.ts | 14 +++++++++++ 3 files changed, 33 insertions(+), 12 deletions(-) diff --git a/.agents/skills/telegram-crabbox-e2e-proof/SKILL.md b/.agents/skills/telegram-crabbox-e2e-proof/SKILL.md index 940e775e883..b7e6ef188cd 100644 --- a/.agents/skills/telegram-crabbox-e2e-proof/SKILL.md +++ b/.agents/skills/telegram-crabbox-e2e-proof/SKILL.md @@ -65,8 +65,8 @@ proof_cmd="${OPENCLAW_TELEGRAM_USER_PROOF_CMD:-openclaw-telegram-user-crabbox-pr This uses Telegram Desktop directly with `tg://privatepost`, not `xdg-open`. It also resizes Telegram to `650x1000` at the tested desktop position so -Telegram switches to single-chat mode with no left chat list or right info -pane. Do not press Escape after this; Escape can close the selected chat. +the crop can isolate the chat pane even if Telegram keeps a split/sidebar +layout. Do not press Escape after this; Escape can close the selected chat. Bottom behavior matters: @@ -74,8 +74,8 @@ Bottom behavior matters: later messages appear live in the recording - deep-linking to an older message does not auto-scroll to new arrivals; link again to the newest/final marker instead of clicking the down-arrow -- `650px` is the largest tested clean width; `660px` switches Telegram back to - split/sidebar layout +- the cropped GIF intentionally uses the chat pane, not the whole desktop or + whole Telegram window Send as the real Telegram user: diff --git a/scripts/e2e/telegram-user-crabbox-proof.ts b/scripts/e2e/telegram-user-crabbox-proof.ts index 70c409520b4..f7928e5b970 100644 --- a/scripts/e2e/telegram-user-crabbox-proof.ts +++ b/scripts/e2e/telegram-user-crabbox-proof.ts @@ -135,13 +135,19 @@ const DEFAULT_USER_DRIVER = "scripts/e2e/telegram-user-driver.py"; const DEFAULT_OUTPUT_ROOT = ".artifacts/qa-e2e/telegram-user-crabbox"; const REMOTE_ROOT = "/tmp/openclaw-telegram-user-crabbox"; const CREDENTIAL_SCRIPT = fileURLToPath(new URL("./telegram-user-credential.ts", import.meta.url)); -const TELEGRAM_PROOF_VIEW = { - cropWidth: 520, +const TELEGRAM_PROOF_WINDOW = { height: 1000, width: 650, x: 635, y: 40, }; +const TELEGRAM_PROOF_CROP = { + cropWidth: 430, + height: TELEGRAM_PROOF_WINDOW.height, + width: 430, + x: TELEGRAM_PROOF_WINDOW.x + 220, + y: TELEGRAM_PROOF_WINDOW.y, +}; function usageText() { return [ @@ -165,7 +171,7 @@ function usageText() { " --output-dir Artifact directory under the repo.", " --message-id Telegram message id for proof-view deep link.", " --preview-crop telegram-window Create a side-by-side friendly Telegram-window GIF.", - " --preview-crop-width Cropped preview GIF width. Default: 520.", + " --preview-crop-width Cropped preview GIF width. Default: 430.", " --preview-fps Motion GIF frames per second. Default: 24.", " --preview-width Motion GIF width. Default: 1920.", " --pr Pull request number for publish.", @@ -237,7 +243,7 @@ function parseArgs(argv: string[]): Options { mockResponseText: "OPENCLAW_E2E_OK", mockPort: 19_882, outputDir: path.join(DEFAULT_OUTPUT_ROOT, stamp), - previewCropWidth: TELEGRAM_PROOF_VIEW.cropWidth, + previewCropWidth: TELEGRAM_PROOF_CROP.cropWidth, previewFps: 24, previewWidth: 1920, provider: process.env.OPENCLAW_TELEGRAM_USER_CRABBOX_PROVIDER?.trim() || "aws", @@ -939,12 +945,12 @@ async function createMotionPreview(params: { function previewCrop(opts: Options) { return opts.previewCrop === "telegram-window" - ? { ...TELEGRAM_PROOF_VIEW, cropWidth: opts.previewCropWidth } + ? { ...TELEGRAM_PROOF_CROP, cropWidth: opts.previewCropWidth } : undefined; } async function createCroppedMotionPreview(params: { - crop: typeof TELEGRAM_PROOF_VIEW; + crop: typeof TELEGRAM_PROOF_CROP; croppedGifPath: string; croppedVideoPath: string; opts: Options; @@ -1811,7 +1817,7 @@ if [ -z "$win" ]; then exit 1 fi wmctrl -ir "$win" -b remove,maximized_vert,maximized_horz,fullscreen -wmctrl -ir "$win" -e 0,${TELEGRAM_PROOF_VIEW.x},${TELEGRAM_PROOF_VIEW.y},${TELEGRAM_PROOF_VIEW.width},${TELEGRAM_PROOF_VIEW.height} +wmctrl -ir "$win" -e 0,${TELEGRAM_PROOF_WINDOW.x},${TELEGRAM_PROOF_WINDOW.y},${TELEGRAM_PROOF_WINDOW.width},${TELEGRAM_PROOF_WINDOW.height} telegram="$root/Telegram/Telegram" test -x "$telegram" set +e @@ -1839,7 +1845,8 @@ async function viewSession(root: string, opts: Options, outputDir: string) { ); fs.writeFileSync(logPath, `${result.stdout}${result.stderr}`); return { - geometry: TELEGRAM_PROOF_VIEW, + crop: TELEGRAM_PROOF_CROP, + geometry: TELEGRAM_PROOF_WINDOW, link, log: path.relative(root, logPath), status: "pass", diff --git a/test/scripts/mantis-telegram-desktop-proof-workflow.test.ts b/test/scripts/mantis-telegram-desktop-proof-workflow.test.ts index 974acb6aa94..dae38829c6b 100644 --- a/test/scripts/mantis-telegram-desktop-proof-workflow.test.ts +++ b/test/scripts/mantis-telegram-desktop-proof-workflow.test.ts @@ -334,6 +334,20 @@ describe("Mantis Telegram Desktop proof workflow", () => { ); }); + it("crops the Telegram Desktop chat pane for PR proof GIFs", () => { + const proofScript = readFileSync(PROOF_SCRIPT, "utf8"); + const skill = readFileSync(TELEGRAM_PROOF_SKILL, "utf8"); + + expect(proofScript).toContain("const TELEGRAM_PROOF_WINDOW ="); + expect(proofScript).toContain("const TELEGRAM_PROOF_CROP ="); + expect(proofScript).toContain("x: TELEGRAM_PROOF_WINDOW.x + 220"); + expect(proofScript).toContain("width: 430"); + expect(proofScript).toContain("geometry: TELEGRAM_PROOF_WINDOW"); + expect(proofScript).toContain("crop: TELEGRAM_PROOF_CROP"); + expect(skill).toContain("crop can isolate the chat pane"); + expect(skill).not.toContain("650px` is the largest tested clean width"); + }); + it("does not pass the full workflow environment into the local Telegram SUT", () => { const proofScript = readFileSync(PROOF_SCRIPT, "utf8"); expect(proofScript).toContain("function childProcessBaseEnv()");