Skip to content

fix(telegram): avoid repeating native choices in message text - #140108

Merged
obviyus merged 1 commit into
mainfrom
codex/telegram-native-fallback
Sep 6, 2026
Merged

obviyus merged 1 commit into
mainfrom
codex/telegram-native-fallback

Conversation

@obviyus

@obviyus obviyus commented Sep 6, 2026 •

Copy link
Copy Markdown
Collaborator

Related: #136257.

What Problem This Solves

Telegram could show the same choices in both message text and native controls. Control-only replies also repeated the choice list.

Why This Change Was Made

The presentation owner uses the text remaining after native controls are selected. Plain delivery keeps the authored fallback, and native label limits no longer shorten unavailable text-only choices.

User Impact

Choices appear once while independent prose, tables, prompts, unavailable choices, and command targets remain intact.

Evidence

A real Gateway with controlled channel responses reproduced duplication before the fix and showed one prompt with controls afterward. Native command callbacks cleared the keyboard and produced one result. All 171 focused presentation and delivery tests passed. Live Telegram proof was blocked by the required group-membership check.

Consumers: Telegram native presentation uses the remaining text; plain delivery preserves the authored fallback.

@obviyus obviyus self-assigned this Sep 6, 2026
@clawsweeper

clawsweeper Bot commented Sep 6, 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.

@openclaw-barnacle openclaw-barnacle Bot added channel: telegram Channel integration: telegram size: M maintainer Maintainer-authored PR labels Sep 6, 2026
@obviyus
obviyus marked this pull request as ready for review September 6, 2026 12:52
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. proof: telegram-e2e This PR needs Telegram Test Server proof with the repository E2E skill. 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 Sep 6, 2026
@clawsweeper

clawsweeper Bot commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 6, 2026, 8:58 AM ET / 12:58 UTC.

ClawSweeper review

What this changes

Telegram replies replace duplicated fallback choices with native buttons while retaining complete labels for choices that cannot become buttons.

Merge readiness

✅ Ready for maintainer review

Keep open: the fix remains useful on current main, and the reviewed patch has no blocking correctness findings. The maintainer-protected PR is not a cleanup candidate.

Priority: P2
Reviewed head: af877cbd4a40bc148fd1988e504d770d1d22b2c1

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused owner-level repair with meaningful regression coverage and no blocking source findings; runtime results are contributor-reported.
Proof confidence 🌊 off-meta tidepool Not applicable: The supplied MEMBER status exempts this presentation-only repair from the external-contributor gate. The body reports after-fix Gateway boundary coverage of the changed adapter with mock Telegram endpoints; live Telegram appearance remains unobserved, and transport or callback authorization is not changed.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The supplied MEMBER status exempts this presentation-only repair from the external-contributor gate. The body reports after-fix Gateway boundary coverage of the changed adapter with mock Telegram endpoints; live Telegram appearance remains unobserved, and transport or callback authorization is not changed.
Evidence reviewed 8 items Pinned introduction: The complete host-provided merge-base-to-head patch contains only the Telegram presentation owner and two associated test files. Local diff inspection agrees; unrelated endpoint drift was excluded.
Owner-level repair: Native selection precedes label clipping. Marked fallback text is replaced only when native controls were selected; unmarked prose, unavailable controls, explicit-button precedence, and the control-only message anchor retain their existing paths.
Existing presentation contract: The shared reply type defines presentationTextMode as exact fallback content rather than additional prose. Presentation documentation requires unavailable controls to degrade visibly and preserves distinctions between commands, URLs, and opaque callbacks.
Findings None None.
Security None None.

How this fits together

Telegram’s presentation adapter converts shared reply content into message text and inline keyboards. Both outbound sends and agent replies use this adapter before Telegram delivery.

flowchart TD
  A[Shared reply content] --> B[Telegram presentation adapter]
  B --> C{Control can render natively?}
  C -->|Yes| D[Label-limited inline buttons]
  C -->|No| E[Complete fallback text]
  B --> E
  D --> F[Telegram message delivery]
  E --> F
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +6, Tests +132. Total +138 across 3 files.

View PR surface stats
Area Files Added Removed Net
Source 1 17 11 +6
Tests 2 160 28 +132
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 177 39 +138

Review metrics

None.

Technical review

Best possible solution:

Keep native-choice deduplication in Telegram’s shared presentation owner, with complete textual degradation for unavailable controls.

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

Yes, from source: a plain-account reply containing native controls and marked authored fallback retains the choice list on current main. The added cases exercise that exact input, but this review did not execute them.

Is this the best way to solve the issue?

Yes. The patch reuses the existing partitioning and limit adapter at the common Telegram rendering boundary without adding another rendering path or changing action targets.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 427abe8b786d.

Labels

Label changes:

  • add P2: This repairs duplicated Telegram choices and truncated fallback labels with a limited presentation-layer blast radius.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The supplied MEMBER status exempts this presentation-only repair from the external-contributor gate. The body reports after-fix Gateway boundary coverage of the changed adapter with mock Telegram endpoints; live Telegram appearance remains unobserved, and transport or callback authorization is not changed.
  • add proof: telegram-e2e: This PR needs Telegram Test Server proof with the repository E2E skill. Telegram Test Server can demonstrate the changed visible choice list, message anchor, and retained unavailable labels.

Label justifications:

  • P2: This repairs duplicated Telegram choices and truncated fallback labels with a limited presentation-layer blast radius.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The supplied MEMBER status exempts this presentation-only repair from the external-contributor gate. The body reports after-fix Gateway boundary coverage of the changed adapter with mock Telegram endpoints; live Telegram appearance remains unobserved, and transport or callback authorization is not changed.
  • proof: telegram-e2e: This PR needs Telegram Test Server proof with the repository E2E skill. Telegram Test Server can demonstrate the changed visible choice list, message anchor, and retained unavailable labels.

Evidence

What I checked:

  • Pinned introduction: The complete host-provided merge-base-to-head patch contains only the Telegram presentation owner and two associated test files. Local diff inspection agrees; unrelated endpoint drift was excluded. (extensions/telegram/src/interactive-fallback.ts:241, af877cbd4a40)
  • Owner-level repair: Native selection precedes label clipping. Marked fallback text is replaced only when native controls were selected; unmarked prose, unavailable controls, explicit-button precedence, and the control-only message anchor retain their existing paths. (extensions/telegram/src/interactive-fallback.ts:269, af877cbd4a40)
  • Existing presentation contract: The shared reply type defines presentationTextMode as exact fallback content rather than additional prose. Presentation documentation requires unavailable controls to degrade visibly and preserves distinctions between commands, URLs, and opaque callbacks. (src/shared/reply-payload.types.ts:49, af877cbd4a40)
  • Current main and release still need the repair: Comparison with fetched main shows the same focused production delta. Inspection of the supplied v2026.9.2 release commit also shows the old early label clipping and fallback selection. Neither inspected revision already contains this repair. (extensions/telegram/src/interactive-fallback.ts:262, 3928bad9badf)
  • Regression coverage: Read both complete changed test files. Added cases check plain/rich marked fallback replacement, control-only delivery, partial button/select rendering, and full unavailable labels after core adaptation. No tests were executed; the read-only diff whitespace check passed. (extensions/telegram/src/outbound-adapter.presentation.test.ts:155, af877cbd4a40)
  • Captured behavior evidence: The complete supplied PR body, under sourceRevision 32465af10b1862eb2dd64678db24b6d79890f0c0a7244a02dce6fae29d464e3d, reports baseline-versus-candidate isolated Gateway runs with a mock Telegram API/provider, retained prompts and unavailable labels, and one callback acknowledgment. It explicitly reports no live Telegram send. No raw trace or media link is included in that captured body. (af877cbd4a40)

Likely related people:

  • Ayaan Zaidi: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Peter Steinberger: 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.

@obviyus
obviyus merged commit b4c9407 into main Sep 6, 2026
176 checks passed
@obviyus
obviyus deleted the codex/telegram-native-fallback branch September 6, 2026 13:03
@obviyus

obviyus commented Sep 6, 2026

Copy link
Copy Markdown
Collaborator Author

Merged as b4c9407.

Proof: 171 focused tests pass. The exact-head required CI gate is green, and the final independent review is clean at platinum. All seven observable acceptance clauses pass through the approved isolated, built Gateway with a mock Telegram API and provider.

  • Bug: Native choices repeated their marked text fallback, while unavailable choices could lose label text.
  • Fix: The shared Telegram presentation owner removes redundant native-choice text and clips only labels selected for native controls.
Before After
Native choices appeared in message text and controls. Native controls replace their redundant text; control-only replies retain the existing anchor.
Unavailable controls could have clipped fallback labels. Unavailable controls retain complete labels. Independent prose, plain fallback, tables and exact command/link targets remain intact.

Live Telegram client behavior was not observed: the leased Test Server setup failed group membership. The explicitly approved mock-Gateway route supplies boundary proof, not a live Telegram send claim.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 7, 2026
…aw#140108)

Use the remaining presentation text when Telegram renders native controls, and apply existing label limits only to native labels so unavailable choices retain their full text.

Preserve independent prose, plain fallback, table content and typed command/link targets. Verified with focused regressions and isolated Gateway delivery proof.

Co-authored-by: Ayaan Zaidi <[email protected]>
obviyus added a commit that referenced this pull request Sep 11, 2026
…44653)

Related: #136257. Follows the shared presentation contract in #144329 and the Telegram behavior in #140108.

## What Problem This Solves

Fixes an issue where Slack replies repeat authored choice text beside native controls, or lose the authored continuation when a presentation needs a text fallback. Large select menus can also make delivery fail when their expanded accessibility summary exceeds the message limit.

## Why This Change Was Made

Slack now uses the presentation marker to choose native content or the complete literal fallback. Independent companions survive that choice. The registered channel and outbound adapter share normalization, including removal of saved fallback text after a policy rewrite clears the presentation.

Derived accessibility text is bounded while native controls remain intact. Authored text still uses the existing message splitting path. Literal fallbacks bypass incompatible preview and native streaming paths.

## User Impact

Supported controls appear once. Unsupported commands remain copyable, with their full authored continuation. Rich-text companions survive long replies, and policy changes cannot revive retired fallback text.

## Evidence

- Baseline `7f8a694ee1c862db91b056f0c950ca03b20effb1`: 13 focused regression failures, plus captured duplication and lost continuation through an isolated Gateway.
- 444 focused tests pass across nine Slack owner and sibling files, including the registered channel, outbound adapter, reply compiler, native-data fallback, sends, slash replies, preview dispatch, and preview finalization.
- Isolated mock-Gateway proof covers 27 cases: one actions block with six selects of 100 options each, rich-text companions, a continuation above 40,000 characters, policy clear/rewrite, and native-data rejection.
- Additional baseline/candidate proof drives five scenarios through the shipped Slack Socket Mode receiver, durable ingress, session admission, and real dispatch. Short and long companion replies follow an acknowledged active preview; API captures include deletion of that preview and complete final delivery.
- Formatting, focused lint, line-count and assertion-safety checks pass. Type checks and full CI are left to GitHub.
- The approved validation scope for this extraction is isolated mock-Gateway proof; a live Slack round-trip is not required and was not run. Socket Mode proof uses a local Slack service and the real Slack SDK; supplemental outbound proof drives the registered adapter and real sender through a fake client. No live Slack UI or Telegram result is claimed.

No config keys, schema, or persistence changes.

Co-authored-by: Ayaan Zaidi <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 12, 2026
…enclaw#144653)

Related: openclaw#136257. Follows the shared presentation contract in openclaw#144329 and the Telegram behavior in openclaw#140108.

## What Problem This Solves

Fixes an issue where Slack replies repeat authored choice text beside native controls, or lose the authored continuation when a presentation needs a text fallback. Large select menus can also make delivery fail when their expanded accessibility summary exceeds the message limit.

## Why This Change Was Made

Slack now uses the presentation marker to choose native content or the complete literal fallback. Independent companions survive that choice. The registered channel and outbound adapter share normalization, including removal of saved fallback text after a policy rewrite clears the presentation.

Derived accessibility text is bounded while native controls remain intact. Authored text still uses the existing message splitting path. Literal fallbacks bypass incompatible preview and native streaming paths.

## User Impact

Supported controls appear once. Unsupported commands remain copyable, with their full authored continuation. Rich-text companions survive long replies, and policy changes cannot revive retired fallback text.

## Evidence

- Baseline `c0b5fcea59ff5d2fd609802aca3b9e8a5e34021c`: 13 focused regression failures, plus captured duplication and lost continuation through an isolated Gateway.
- 444 focused tests pass across nine Slack owner and sibling files, including the registered channel, outbound adapter, reply compiler, native-data fallback, sends, slash replies, preview dispatch, and preview finalization.
- Isolated mock-Gateway proof covers 27 cases: one actions block with six selects of 100 options each, rich-text companions, a continuation above 40,000 characters, policy clear/rewrite, and native-data rejection.
- Additional baseline/candidate proof drives five scenarios through the shipped Slack Socket Mode receiver, durable ingress, session admission, and real dispatch. Short and long companion replies follow an acknowledged active preview; API captures include deletion of that preview and complete final delivery.
- Formatting, focused lint, line-count and assertion-safety checks pass. Type checks and full CI are left to GitHub.
- The approved validation scope for this extraction is isolated mock-Gateway proof; a live Slack round-trip is not required and was not run. Socket Mode proof uses a local Slack service and the real Slack SDK; supplemental outbound proof drives the registered adapter and real sender through a fake client. No live Slack UI or Telegram result is claimed.

No config keys, schema, or persistence changes.

Co-authored-by: Ayaan Zaidi <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: telegram Channel integration: telegram maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. proof: telegram-e2e This PR needs Telegram Test Server proof with the repository E2E skill. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: M 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