Skip to content

feat(qa): drive forwarded text+photo bursts in Telegram userbot scenarios - #162906

Merged
steipete merged 2 commits into
mainfrom
steipete/heuristic-tesla-8b1bee
Oct 1, 2026
Merged

steipete merged 2 commits into
mainfrom
steipete/heuristic-tesla-8b1bee

Conversation

@steipete

@steipete steipete commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Related: #162787

What Problem This Solves

The Telegram Test Server userbot harness could not drive a forwarded burst, so the forward-lane behavior #162787 targets (a forwarded text and attachment split into two turns) had no live proof path.

User Impact

No user-visible product change. Maintainers can now reproduce forwarded text+photo bursts against a real Telegram Test Server bot and see whether the Gateway answers them as one turn or two. The proxy log also shows Gateway getFile/download latency and how many updates each getUpdates response delivered.

Why This Change Was Made

  • New scenario action forwardBurst (DM-only; the runner rejects it without --dm before leasing a credential). The SUT bot posts a text and a photo into the DM through the Test Bot API. The QA user then forwards both back with one TDLib forwardMessages call (TDLib 1.8.67 schema). The action row records the forwarded and source message ids. A forward without forward_info fails the action, because the forward lane would not engage.
  • The source messages are bot-authored on purpose. A first live run forwarded the QA user's own Saved Messages posts: Telegram stripped the forward origin (forward_info: null on both forwards), and the Gateway treated them as plain messages.
  • CI planner fix (found while landing this PR): bbb074a made aggressive PR selection add every changed *.test.* path directly. This PR's node:test files under .agents/skills/telegram-e2e-userbot/scripts/ were then handed to Vitest, which exited 1 with "No test files found" and failed checks-node-changed. Aggressive mode now applies the same isRoutableChangedTarget predicate default mode already used. The skill's node:test suite keeps its Vitest owner, test/scripts/telegram-e2e-userbot-skill.test.ts, which runs node --test over the skill directory.
  • The local Test Bot API proxy timing log gains doneAt on every row, log-only file download rows (no paths), and count-only rows for non-empty getUpdates responses. The Gateway itself logs no getFile/download timing. Controls still match Bot API methods only.

Evidence

Live Telegram Test Server runs (--source-gateway --dm, mock provider). The burst fires at t≈25–30 s; each row is one run:

Checkout Agent-turn provider requests Forward updates delivered getFile + download
main before #162787 2 (text-only, then photo-only) separate getUpdates responses, 208 ms apart 571 + 175 ms
main + #162787 2 separate, 669 ms apart 215 + 322 ms
main + #162787 2 separate, 256 ms apart 198 + 333 ms
current main (includes #162787) 2 separate, 791 ms apart 229 + 338 ms

Download latency is well above the 80 ms forward window, as #162787 assumed. But Telegram also delivers the two forwarded updates in separate getUpdates responses, 200–800 ms apart. The window has already closed before the photo update reaches the Gateway, so forwarded bursts still split on the live path. Follow-up work tracks that gap; this PR only adds the harness that measures it.

Harness tests (CI runs the skill's node:test files once, through the Vitest owner test/scripts/telegram-e2e-userbot-skill.test.ts; wall times measured locally):

  • user-driver.test.py: 37 passed (~0.04 s)
  • user-record.test.py: 13 passed (~0.05 s)
  • scenario.test.mjs, telegram-test-api-proxy.test.mjs, run-mock-sut-user-e2e.test.mjs, telegram-test-scenario.test.mjs: 65 passed (~5 s)
  • telegram-run-composition.test.mjs is load-sensitive on the unchanged harness as well (a different case fails per run at host load ~40). A/B runs against the base harness showed the same failures, so they are not attributable to this change.

CI planner fix: the new aggressive-selection regression in test/scripts/ci-changed-node-test-plan.selection.test.ts fails without the fix (it selects .agents/skills/example/scripts/driver.test.mjs) and passes with it (~0.7 s). All 37 tests across the three ci-changed-node-test-plan selection/integration/dependency-input files pass.

Autoreview (Codex): scoped-clean at P0–P2 for the harness diff; the planner fix is reviewed separately.

…rios

Add a forwardBurst scenario action to the Telegram Test Server userbot
harness. The SUT bot posts a text and a photo into the QA user's DM
through the direct Test Bot API, the recorder correlates both source
messages from its own TDLib ingestion, and the QA user forwards both back
with one TDLib forwardMessages call (TDLib 1.8.67 schema). The action row
records the forwarded and source message ids; a receipt without
forward_info fails the action because the SUT forward lane would not
engage. The runner rejects forwardBurst without --dm before leasing.

The source is bot-authored because a live run showed Telegram strips the
forward origin when a user forwards their own Saved Messages posts: both
forwards arrived with forward_info null and the Gateway handled them as
plain messages.

The local Test Bot API proxy timing log gains doneAt on every row,
log-only file-download rows without paths, and count-only rows for
nonempty getUpdates responses, so a run can show getFile/download latency
and whether burst members reached the Gateway in one long-poll response.
The Gateway itself logs no getFile/download timing.

Live proof (Test Server, --source-gateway --dm, mock provider): on
current main the burst produced two agent-turn provider requests
(text-only, then photo-only) and two replies; getFile+download measured
571+175 ms. Telegram delivered the two forwards in separate getUpdates
responses 208 ms apart.

Tests: user-driver 37, user-record 13, scenario/proxy/runner/scenario-run
65 passing. telegram-run-composition is load-sensitive on the unchanged
harness too (different cases fail per run at load ~40 on the host).
@clawsweeper

clawsweeper Bot commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@steipete
steipete marked this pull request as ready for review October 1, 2026 18:13
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Oct 1, 2026
@clawsweeper

clawsweeper Bot commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed October 1, 2026, 3:20 PM ET / 19:20 UTC (Revision 2).

ClawSweeper review

What this changes

The PR adds forwarded text-and-photo scenarios to the Telegram QA userbot, records transport timing and update counts, and fixes CI routing for the skill’s tests.

Merge readiness

✅ Ready for maintainer review

This remains useful, distinct QA work: current main lacks the forwarded-burst scenario, and the live evidence demonstrates the harness while identifying a separate product batching gap. No blocking introduced defect was found.

Priority: P2
Reviewed head: 5e44cd0242337f59839c00be4ae6788b59088121

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) Useful, focused QA work with concrete live observations, targeted regression coverage, and no blocking finding.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (live_output): The captured live Telegram Test Server runs exercise the new driver and recorder through a real bot DM into the source Gateway, using a mock provider. They demonstrate forwarded updates, agent-turn requests, and proxy timing measurements; the remaining two-turn product result is an observed finding, not failure of the harness enhancement. No stored-data contract changes require upgrade proof.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The captured live Telegram Test Server runs exercise the new driver and recorder through a real bot DM into the source Gateway, using a mock provider. They demonstrate forwarded updates, agent-turn requests, and proxy timing measurements; the remaining two-turn product result is an observed finding, not failure of the harness enhancement. No stored-data contract changes require upgrade proof.
Evidence reviewed 11 items Pinned introduced changes and review continuity: Reviewed the merge-base-to-head changes. Comparing the previous reviewed head with this head confirms the subsequent commit changes only CI selection and its regression coverage; the prior review retained no findings or rank-up moves. The supplied test merge is stale and was not used to infer removal of main behavior.
Forwarding owner and receipt validation: The driver posts bot-authored source messages to the QA user, forwards their observer-side message IDs in one TDLib call, settles send confirmations, and rejects incomplete receipts or missing forward origin. The recorder filters source events to the selected chat and SUT.
Captured live behavior evidence: The supplied PR body, captured under sourceRevision 3b7a8668485f4b565970af753189ef898d2e572a023fed0dfc2e793f0fe3f71f, records four real Telegram Test Server runs using --source-gateway --dm and a mock provider. Each produced two agent-turn requests; forwarded updates arrived separately, 208–791 ms apart, with measured getFile and download latency. This proves the new harness measures the real forwarding path, without claiming it fixes product coalescing.
Findings None None.
Security None None.

How this fits together

The Telegram QA harness drives a leased test user and bot through Telegram’s Test Server into an isolated OpenClaw Gateway. Its recorder and API proxy produce evidence about messages, agent turns, and transport timing.

flowchart TD
  A[QA scenario] --> B[Validate direct chat]
  B --> C[Bot posts source text and photo]
  C --> D[Test user forwards both messages]
  D --> E[Telegram Test Server]
  E --> F[Gateway and mock provider]
  E --> G[Message and transport evidence]
  F --> G
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Tests +223, Docs +4, Other +414. Total +641 across 14 files.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 5 233 10 +223
Docs 1 8 4 +4
Config 0 0 0 0
Generated 0 0 0 0
Other 8 436 22 +414
Total 14 677 36 +641

Review metrics

Metric Value Why it matters
Scenario capability 1 new action, restricted to direct chats The action extends maintainer QA without changing Telegram product defaults.
Implementation versus coverage growth Production/tooling +160 LOC; tests +477 LOC The tooling growth supports real forwarding and transport measurements; coverage targets validation, receipts, privacy, and CI routing.

Technical review

Best possible solution:

Keep forwarding and timing measurement in the existing QA harness, and use its evidence to guide the separate Telegram batching repair.

Do we have a high-confidence way to reproduce the issue?

Not applicable to the harness enhancement itself; the captured live runs provide a concrete forwarding scenario and measurements of the separate product batching failure.

Is this the best way to solve the issue?

Yes. Extending the existing userbot and proxy owners provides the missing real-transport measurement path, and reusing the CI routing predicate avoids competing selection rules.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 32dc6c861d3e.

Labels

Label changes:

No label changes.

Label justifications:

  • P2: This bounded QA improvement enables investigation of a real Telegram workflow defect without changing production delivery behavior.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The captured live Telegram Test Server runs exercise the new driver and recorder through a real bot DM into the source Gateway, using a mock provider. They demonstrate forwarded updates, agent-turn requests, and proxy timing measurements; the remaining two-turn product result is an observed finding, not failure of the harness enhancement. No stored-data contract changes require upgrade proof.
  • proof: sufficient: Contributor real behavior proof is sufficient. The captured live Telegram Test Server runs exercise the new driver and recorder through a real bot DM into the source Gateway, using a mock provider. They demonstrate forwarded updates, agent-turn requests, and proxy timing measurements; the remaining two-turn product result is an observed finding, not failure of the harness enhancement. No stored-data contract changes require upgrade proof.

Evidence

What I checked:

  • Pinned introduced changes and review continuity: Reviewed the merge-base-to-head changes. Comparing the previous reviewed head with this head confirms the subsequent commit changes only CI selection and its regression coverage; the prior review retained no findings or rank-up moves. The supplied test merge is stale and was not used to infer removal of main behavior. (5e44cd024233)
  • Forwarding owner and receipt validation: The driver posts bot-authored source messages to the QA user, forwards their observer-side message IDs in one TDLib call, settles send confirmations, and rejects incomplete receipts or missing forward origin. The recorder filters source events to the selected chat and SUT. (.agents/skills/telegram-e2e-userbot/scripts/user-driver.py:842, 5e44cd024233)
  • Captured live behavior evidence: The supplied PR body, captured under sourceRevision 3b7a8668485f4b565970af753189ef898d2e572a023fed0dfc2e793f0fe3f71f, records four real Telegram Test Server runs using --source-gateway --dm and a mock provider. Each produced two agent-turn requests; forwarded updates arrived separately, 208–791 ms apart, with measured getFile and download latency. This proves the new harness measures the real forwarding path, without claiming it fixes product coalescing. (5e44cd024233)
  • Still necessary on main and latest release: The fetched main contains no forwardBurst, post_forward_sources, or forward_messages implementation in the skill. The latest release’s scenario action registry also lacks forwardBurst. (.agents/skills/telegram-e2e-userbot/scripts/scenario.mjs:6, 32dc6c861d3e)
  • Latest-release source check: The v2026.9.7 action registry supports send and click but has no forwarded-burst action. (.agents/skills/telegram-e2e-userbot/scripts/scenario.mjs:6, c074824a27c9)
  • CI selection preserves the existing test owner: Aggressive selection now uses the same routability predicate as default selection. The existing policy watch selects the Telegram skill’s Vitest owner for the touched implementation files; that owner runs the Node and Python suites. The supplied evidence reports a baseline-failing planner regression and 37 passing planner tests. (scripts/lib/ci-changed-node-test-plan.mts:520, 5e44cd024233)

Likely related people:

  • joshavant: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (1 earlier review cycle)
  • reviewed 2026-10-01T18:26:20.947Z sha 5c0baa8 :: needs maintainer review before merge. :: none

bbb074a made aggressive PR Node selection add every changed path
matching isTestFileTarget as a direct target. A PR that changed
node:test files under .agents/skills/telegram-e2e-userbot/scripts/ then
handed them to the Vitest unit config, which exited 1 with "No test
files found" and failed checks-node-changed and openclaw/ci-gate.

Aggressive mode now applies the same isRoutableChangedTarget predicate
that default mode already uses for direct changed-test selection. Across
all 18,695 tracked test files, this drops only non-Vitest files from
direct selection: 16 skill node:test files (still run once by their
Vitest owner test/scripts/telegram-e2e-userbot-skill.test.ts), 4 CodeQL
fixtures, and 140 credentialed .live.test.ts files that default mode
already excluded.

The regression test fails without the fix (it selects the skill file)
and passes with it; all 37 ci-changed-node-test-plan
selection/integration/dependency-input tests pass.
@openclaw-barnacle openclaw-barnacle Bot added the scripts Repository scripts label Oct 1, 2026
@steipete
steipete merged commit a6ee7e1 into main Oct 1, 2026
125 checks passed
@steipete
steipete deleted the steipete/heuristic-tesla-8b1bee branch October 1, 2026 20:37
@steipete

steipete commented Oct 1, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

vincentkoc added a commit that referenced this pull request Oct 1, 2026
* origin/main:
  fix(gateway): report approved-but-narrowed scope upgrades truthfully (#162951)
  fix: allow session-scoped shared publication reads (#162984)
  refactor(sessions): share session creation orchestration (#161336)
  perf(gateway): show the first chat sooner after a Gateway start (#162936)
  refactor(scripts): share npm verification command execution (#162978)
  fix(browser): clear MCP runtime cache after profile tests (#162982)
  fix(test): checkout fixture tests fail healthy runs on loaded macOS hosts (#162888)
  ci: bound PR extension lint to direct owners and smoke packages
  fix(ci): await native declaration discovery teardown
  feat(qa): drive forwarded text+photo bursts in Telegram userbot scenarios (#162906)
  build(macos): pin the app runtime to OpenClaw Bun 17c9ecf9eb (#162570)
  fix(test): frozen admission test fails with spawn ETXTBSY when a sibling test forks during the native parser copy (#162969)
  fix(ci): give direct published-driver callers the CI cell envelope (#162837)
  test(gateway): remove low-value tests (batch d136) (#162921)
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 2, 2026
…rios (openclaw#162906)

* feat(qa): drive forwarded text+photo bursts in Telegram userbot scenarios

Add a forwardBurst scenario action to the Telegram Test Server userbot
harness. The SUT bot posts a text and a photo into the QA user's DM
through the direct Test Bot API, the recorder correlates both source
messages from its own TDLib ingestion, and the QA user forwards both back
with one TDLib forwardMessages call (TDLib 1.8.67 schema). The action row
records the forwarded and source message ids; a receipt without
forward_info fails the action because the SUT forward lane would not
engage. The runner rejects forwardBurst without --dm before leasing.

The source is bot-authored because a live run showed Telegram strips the
forward origin when a user forwards their own Saved Messages posts: both
forwards arrived with forward_info null and the Gateway handled them as
plain messages.

The local Test Bot API proxy timing log gains doneAt on every row,
log-only file-download rows without paths, and count-only rows for
nonempty getUpdates responses, so a run can show getFile/download latency
and whether burst members reached the Gateway in one long-poll response.
The Gateway itself logs no getFile/download timing.

Live proof (Test Server, --source-gateway --dm, mock provider): on
current main the burst produced two agent-turn provider requests
(text-only, then photo-only) and two replies; getFile+download measured
571+175 ms. Telegram delivered the two forwards in separate getUpdates
responses 208 ms apart.

Tests: user-driver 37, user-record 13, scenario/proxy/runner/scenario-run
65 passing. telegram-run-composition is load-sensitive on the unchanged
harness too (different cases fail per run at load ~40 on the host).

* fix(ci): PR checks fail when a change touches skill node:test files

15e7fc0 made aggressive PR Node selection add every changed path
matching isTestFileTarget as a direct target. A PR that changed
node:test files under .agents/skills/telegram-e2e-userbot/scripts/ then
handed them to the Vitest unit config, which exited 1 with "No test
files found" and failed checks-node-changed and openclaw/ci-gate.

Aggressive mode now applies the same isRoutableChangedTarget predicate
that default mode already uses for direct changed-test selection. Across
all 18,695 tracked test files, this drops only non-Vitest files from
direct selection: 16 skill node:test files (still run once by their
Vitest owner test/scripts/telegram-e2e-userbot-skill.test.ts), 4 CodeQL
fixtures, and 140 credentialed .live.test.ts files that default mode
already excluded.

The regression test fails without the fix (it selects the skill file)
and passes with it; all 37 ci-changed-node-test-plan
selection/integration/dependency-input tests pass.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. scripts Repository scripts size: L status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant