Skip to content

fix(telegram): preserve sent replies when required pins fail - #129342

Merged
steipete merged 1 commit into
mainfrom
codex/qa-telegram-required-pin-delivery-20260825
Aug 25, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/qa-telegram-required-pin-delivery-20260825

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

Telegram reports success when an explicitly required message pin fails. Naively propagating the pin failure also loses the already-sent message identity and causes slash-command fallback handlers to send a second visible reply.

Why This Change Was Made

The Telegram delivery owner swallowed all pin errors and omitted its existing accepted-message-ID collector when sending ordinary text, even though media and text fallback siblings already preserve those IDs. Required pin errors now propagate, and the original successful text delivery is recorded before the post-send pin fails.

User Impact

Required pin failures are visible as accurate partial delivery, including the original accepted Telegram message identifier; duplicate fallback replies are prevented. Optional pins remain best-effort and preserve existing successful-send behavior.

Evidence

  • The actual production Telegram delivery owner incorrectly succeeded before repair and correctly reports partial delivery afterward, with exactly one send and one pin attempt.
  • node scripts/run-vitest.mjs extensions/telegram/src/bot/delivery.test.ts extensions/telegram/src/bot-native-command-dispatch.delivery.test.ts passed all 132 owner and slash-command sibling tests.
  • The isolated worktree's missing local undici importer required a temporary test-runner alias to the already-installed parent dependency; the alias was restored immediately after proof and is not included in this change.
  • Focused type-aware lint, formatting, maximum-lines ratchet, and fresh independent structured review passed.
  • Production delta: +4 lines, justified by required-operation failure propagation and authoritative accepted-message identity.

@clawsweeper

clawsweeper Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@openclaw-barnacle openclaw-barnacle Bot added channel: telegram Channel integration: telegram size: XS maintainer Maintainer-authored PR labels Aug 25, 2026
@steipete
steipete marked this pull request as ready for review August 25, 2026 13:17
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. 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 Aug 25, 2026
@clawsweeper

clawsweeper Bot commented Aug 25, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 25, 2026, 9:53 AM ET / 13:53 UTC.

ClawSweeper review

What this changes

The PR propagates required Telegram pin failures while preserving the identifier of a text reply that was successfully sent first.

Merge readiness

⚠️ Ready for maintainer review - 4 items remain

Keep open for protected maintainer review: current main still swallows required-pin failures and loses text-delivery identity, while this focused patch restores the partial-delivery signal that prevents duplicate fallback replies.

Priority: P2
Reviewed head: 20d8b89c7aac9e0c0d344c4515a7a53d7e0a306f
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The patch is a focused owner-boundary repair with credible regression coverage and no concrete correctness finding.
Proof confidence 🌊 off-meta tidepool Not applicable: This member-authored PR is exempt from the external-contributor proof gate; it provides focused owner-path regression evidence but no live Telegram recording.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This member-authored PR is exempt from the external-contributor proof gate; it provides focused owner-path regression evidence but no live Telegram recording.
Evidence reviewed 7 items Current-main defect: Current main logs every pin failure, including required pins, and its text path omits the accepted-message collector; a later catch can therefore only report partial delivery for paths that populated that collector.
Owner-boundary repair: The PR rethrows only required pin failures and passes the existing collector into text delivery before the post-send pin operation.
Caller preserves the visible reply: Native command dispatch recognizes partial delivery, marks the reply delivered, and only sends its fallback when no delivery occurred.
Findings None None.
Security None None.

Live Verification

Command: node scripts/run-vitest.mjs extensions/telegram/src/bot/delivery.test.ts extensions/telegram/src/bot-native-command-dispatch.delivery.test.ts

Result: FAIL (failed) — execution before step 1 run: live-proof package manager pnpm is unavailable after its official installer (curl -fsSL https://get.pnpm.io/install.sh | sh -): command failed without output

live-proof package manager pnpm is unavailable after its official installer (curl -fsSL https://get.pnpm.io/install.sh | sh -): command failed without output

Assertions:

  • FAIL expect_output: preserves accepted text delivery when a required pin fails

How this fits together

Telegram delivery sends a reply, optionally pins its first delivered message, and returns accepted message IDs to command dispatch. Command dispatch uses partial-delivery state to avoid sending a second fallback reply after a visible reply already exists.

flowchart LR
  A[Command reply] --> B[Telegram delivery]
  B --> C[Send text reply]
  C --> D[Record accepted message ID]
  D --> E[Required or optional pin]
  E --> F[Partial delivery result]
  F --> G[Fallback decision]
Loading

Decision needed

Question Recommendation
Should the Telegram maintainers land this protected PR once its exact-head required checks are complete? Land after exact-head checks: Accept the owner-boundary repair once the remaining required checks report green.

Why: The patch is source-proven and focused, but the maintainer label and member-authored status require an explicit human merge decision.

Before merge

  • Resolve merge risk (P1) - The patch adds four production lines; they are necessary to distinguish required from optional pin semantics and retain the authoritative accepted-message fact, with no clearer net-neutral absorption found.
  • Resolve merge risk (P1) - GitHub reports the PR as mergeable but behind and its check rollup is incomplete; merge only after protected-label review and exact-head required checks complete.
  • Complete next step (P2) - This protected, member-authored PR is a sound focused repair but requires explicit maintainer merge handling rather than automated repair or closure.
Agent review details

Security

None.

PR surface

Source +4, Tests +19. Total +23 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 4 0 +4
Tests 1 19 0 +19
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 23 0 +23

Review metrics

Metric Value Why it matters
Production versus regression-test LOC production +4, tests +19 The production growth restores required-pin error propagation and text-path accepted-ID recording; the added test covers the previously missing text-path case.

Mantis proof suggestion

A redacted Telegram Desktop run would directly show that a pin failure leaves the initial reply visible without a duplicate fallback. A maintainer can ask Mantis to capture proof by posting this exact PR comment:

@openclaw-mantis telegram desktop proof: verify that a required pin failure leaves exactly one sent reply and no fallback duplicate.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Keep the owner-boundary repair; its small production growth is justified by the required/optional pin contract, then land after protected maintainer review and exact-head CI completion.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Keep the owner-boundary repair; its small production growth is justified by the required/optional pin contract, then land after protected maintainer review and exact-head CI completion.

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

Yes—current source and the regression test define a high-confidence path: send text, make a required pin fail, and verify that the accepted message ID survives as partial delivery.

Is this the best way to solve the issue?

Yes—the delivery owner is the correct place to record the successful send before propagating the later required-pin failure; a command-dispatch guard would duplicate delivery-state policy.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 474d7855e481.

Labels

Label changes:

  • add mantis: telegram-visible-proof: Mantis should capture Telegram visible proof. A required pin failure followed by exactly one visible Telegram reply can be demonstrated in a short Telegram Desktop proof.

Label justifications:

  • P2: This repairs a bounded Telegram delivery failure that can otherwise cause a duplicate visible fallback reply.
  • 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: This member-authored PR is exempt from the external-contributor proof gate; it provides focused owner-path regression evidence but no live Telegram recording.
  • mantis: telegram-visible-proof: Mantis should capture Telegram visible proof. A required pin failure followed by exactly one visible Telegram reply can be demonstrated in a short Telegram Desktop proof.

Evidence

What I checked:

Likely related people:

  • steipete: History shows sustained work on this file, including the accepted-media partial-delivery repair and text-delivery refactor that establish the relevant sibling invariant. (role: recent delivery-area contributor; confidence: high; commits: 3b14c819e63a, 2cf725191cb9, 20d8b89c7aac; files: extensions/telegram/src/bot/delivery.replies.ts, extensions/telegram/src/bot/delivery.test.ts)
  • Ayaan Zaidi: File history identifies recurring Telegram delivery contributions, though the direct required-pin path is more strongly associated with steipete. (role: long-running adjacent contributor; confidence: medium; commits: e3bc0f326cb2; files: extensions/telegram/src/bot/delivery.replies.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Complete protected maintainer review after the exact-head required checks finish.

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-08-25T13:22:50.097Z sha 20d8b89 :: needs maintainer review before merge. :: none

@clawsweeper clawsweeper Bot added the mantis: telegram-visible-proof Mantis should capture Telegram visible proof. label Aug 25, 2026
@openclaw-mantis

openclaw-mantis Bot commented Aug 25, 2026 •

Copy link
Copy Markdown
Contributor

Mantis Telegram proof — FAIL

Summary: A real Telegram user invoked a fixture slash command whose single text reply required pinning, while the Bot API proxy failed the first pinChatMessage after sendMessage succeeded. Main reproduced the silent required-pin failure with one visible reply, one successful sendMessage, and one failed pinChatMessage. The candidate did not prevent duplicate delivery: durable ingress retried the command, producing two identical visible replies, two sendMessage calls, and two pin attempts; the second pin succeeded.

  • Scenario: Load the same fixture plugin in both exact SUTs. Its authenticated /pinproof command returns one ReplyPayload containing text 'MANTIS REQUIRED PIN REPLY' and delivery.pin={enabled:true,required:true,notify:false}. Before the real Telegram user sends /pinproof, inject one HTTP 400 failure for pinChatMessage. Observe Telegram Desktop through settlement, inspect Bot API requests, and compare visible reply counts.
  • Trigger: clawsweeper_label
  • Run: https://github.com/openclaw/openclaw/actions/runs/32858082896
  • Artifact: https://github.com/openclaw/openclaw/actions/runs/32858082896/artifacts/9567584551
  • Baseline: pass at 712a97d2ab5ca982c19b3dd95a3b8d02e8abf626 — Expectation met. Telegram showed one bot reply (message 50957). Raw facts recorded one sendMessage 200 for message 50957 and one injected pinChatMessage 400 targeting message 50957, with no second reply or pin attempt.
  • Candidate (PR merged onto main): pass at 79f546e6135e25b2416c3f4187d23b001e6b4194 — Expectation not met. Telegram showed two identical replies (messages 50953 and 50954) from one /pinproof turn. Raw facts recorded sendMessage 200 for 50953, injected pinChatMessage 400 for 50953, then a second sendMessage 200 for 50954 and pinChatMessage 200 for 50954; Telegram also displayed the second message as pinned.
  • Differential (trusted facts): Baseline silently ignored the required pin failure but did not duplicate the reply. Candidate propagated the failure, yet the real Telegram ingress treated the thrown command middleware error as retryable and replayed the already-visible command result. The resulting second send and pin directly contradict the stated exactly-once/duplicate-prevention goal, so the pull request does not fix the behavior end to end.
  • Overall: fail
Before — current main After — this PR
baseline previewGifCropped candidate previewGifCropped

Motion-trimmed clips:

Raw QA files: https://artifacts.openclaw.ai/mantis/telegram-visible/pr-129342/run-32858082896-1/index.json

@steipete
steipete merged commit 433cf95 into main Aug 25, 2026
210 checks passed
@steipete
steipete deleted the codex/qa-telegram-required-pin-delivery-20260825 branch August 25, 2026 14:20
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

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 mantis: telegram-visible-proof Mantis should capture Telegram visible proof. P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XS 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