Repository navigation
fix(telegram): preserve exact inline callback action values - #127735
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 21, 2026, 9:20 PM ET / August 22, 2026, 01:20 UTC. ClawSweeper reviewWhat this changesThe PR preserves trailing whitespace in signed opaque plugin callbacks and managed Telegram select values while leaving the existing normalization of other callback types intact. Regression provenancePossible regression — suspected (reviewed change). No predecessor PR is attributed. Merge readinessKeep open for normal maintainer landing review: the patch correctly repairs a current Telegram callback-routing defect, while exact-head CI is still running and the PR carries the protected Priority: P2 Review scores
Verification
Live VerificationCommand: Result: PASS (completed) Assertions:
How this fits togetherTelegram inline buttons deliver callback strings to the Telegram plugin router, which recognizes native controls, plugin-owned opaque actions, and managed select controls before sending a reply or updating the keyboard. This change chooses the original callback bytes for formats whose payload values are exact. flowchart LR
A[Telegram inline button] --> B[Callback router]
B --> C[Native and approval controls]
B --> D[Opaque plugin action]
B --> E[Managed select action]
D --> F[Plugin handler]
E --> G[Keyboard update or synthetic message]
C --> H[Control outcome]
Before merge
Agent review detailsSecurityNone. PR surfaceSource -3, Tests +17. Total +14 across 3 files. View PR surface stats
Review metrics
Mantis proof suggestionA Telegram Desktop recording can directly show that the whitespace-bearing multi-select button toggles and remains usable. A maintainer can ask Mantis to capture proof by posting this exact PR comment: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Land the narrow parser-boundary repair after exact-head CI is green, and attach a redacted real Telegram callback demonstration if an authorized test bot becomes available. Do we have a high-confidence way to reproduce the issue? Yes—source inspection gives a high-confidence path: build a signed opaque callback or managed select callback with a trailing-space value; current main trims that suffix before checksum validation or keyboard-value comparison. Is this the best way to solve the issue? Yes—the change repairs normalization at the Telegram parser boundary and preserves existing normalized handling for native commands, approvals, questions, and ordinary callback text. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 8b5a02cbf6bb. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Merged via squash.
|
## What Problem This Solves Auto-triggered Mantis proof runs (label/`clawsweeper_label` and other non-comment request sources) end with no PR comment at all. The durable evidence publisher runs with `--create-missing false` and only edits an existing marker comment, but the inline status comment carrying that marker was only created when `request_source == 'issue_comment'`. Label-triggered runs therefore published nothing and logged the misleading "Skipped stale Mantis QA evidence comment because its status is no longer active" — observed on PR #127735. This is the silent-failure class: a Mantis run completes and the PR shows no visible outcome. ## Why This Change Was Made - `.github/workflows/mantis-telegram-desktop-proof.yml`: the status ack comment (👀 + active-job link + run-scoped marker) is now created for every request source that resolves to a PR (`pr_number != ''`), not only `issue_comment`. The 👀 *reaction* stays `issue_comment`-only (it lives in `mantis-resolve-request.yml`, untouched — there is no triggering comment to react to on label runs). - The start-failure fallback comment and the existing-artifact republish path now use the same run-scoped marker `<!-- mantis-telegram-desktop-proof:${GITHUB_RUN_ID}-${GITHUB_RUN_ATTEMPT} -->` as the status comment and the main publisher, so every publisher edits the single run-owned comment (ack → progress → final proof; no comment spam). The republish path gets an explicit `--create-missing false` to match. The design invariant that makes `false` safe: the fallback status-comment step is not `continue-on-error`, so a run in which no marker comment could be created fails `resolve_request` and never reaches publish. - `scripts/mantis/publish-pr-evidence.mjs`: the two skip cases now log honestly — "no existing comment found" vs "could not update existing comment" — instead of one misleading stale-status message. ## User Impact Operators triggering Mantis via labels (ClawSweeper flows) now get the same single evolving PR comment as comment-triggered runs: an immediate 👀 ack with the running job link, edited in place into the final proof evidence. No more runs that finish invisibly. ## Evidence - Focused suite: `node scripts/run-vitest.mjs test/scripts/mantis-telegram-desktop-proof-workflow.test.ts` — 28/28, including new assertions that the status/failure comment gates use `pr_number != ''` (and not `request_source`) and that both publishers pass the run-scoped marker with `--create-missing false`. - `node scripts/check-changed.mjs -- <touched files>` green; `git diff --check` clean. - Marker alignment verified across all five sites in the workflow (status comment, prior-attempt cleanup regex, fallback comment, failure report, both publisher invocations): all use `mantis-telegram-desktop-proof:${GITHUB_RUN_ID}-${GITHUB_RUN_ATTEMPT}`. - Live-run proof of the label-triggered path requires a merged workflow (GitHub runs the workflow from the default branch for these triggers), so the first post-merge label-triggered Mantis run is the live verification; stated here as the known evidence gap. Production LOC delta: −4 (workflow/tooling); tests +13.
…127787) ## What Problem This Solves Auto-triggered Mantis proof runs (label/`clawsweeper_label` and other non-comment request sources) end with no PR comment at all. The durable evidence publisher runs with `--create-missing false` and only edits an existing marker comment, but the inline status comment carrying that marker was only created when `request_source == 'issue_comment'`. Label-triggered runs therefore published nothing and logged the misleading "Skipped stale Mantis QA evidence comment because its status is no longer active" — observed on PR openclaw#127735. This is the silent-failure class: a Mantis run completes and the PR shows no visible outcome. ## Why This Change Was Made - `.github/workflows/mantis-telegram-desktop-proof.yml`: the status ack comment (👀 + active-job link + run-scoped marker) is now created for every request source that resolves to a PR (`pr_number != ''`), not only `issue_comment`. The 👀 *reaction* stays `issue_comment`-only (it lives in `mantis-resolve-request.yml`, untouched — there is no triggering comment to react to on label runs). - The start-failure fallback comment and the existing-artifact republish path now use the same run-scoped marker `<!-- mantis-telegram-desktop-proof:${GITHUB_RUN_ID}-${GITHUB_RUN_ATTEMPT} -->` as the status comment and the main publisher, so every publisher edits the single run-owned comment (ack → progress → final proof; no comment spam). The republish path gets an explicit `--create-missing false` to match. The design invariant that makes `false` safe: the fallback status-comment step is not `continue-on-error`, so a run in which no marker comment could be created fails `resolve_request` and never reaches publish. - `scripts/mantis/publish-pr-evidence.mjs`: the two skip cases now log honestly — "no existing comment found" vs "could not update existing comment" — instead of one misleading stale-status message. ## User Impact Operators triggering Mantis via labels (ClawSweeper flows) now get the same single evolving PR comment as comment-triggered runs: an immediate 👀 ack with the running job link, edited in place into the final proof evidence. No more runs that finish invisibly. ## Evidence - Focused suite: `node scripts/run-vitest.mjs test/scripts/mantis-telegram-desktop-proof-workflow.test.ts` — 28/28, including new assertions that the status/failure comment gates use `pr_number != ''` (and not `request_source`) and that both publishers pass the run-scoped marker with `--create-missing false`. - `node scripts/check-changed.mjs -- <touched files>` green; `git diff --check` clean. - Marker alignment verified across all five sites in the workflow (status comment, prior-attempt cleanup regex, fallback comment, failure report, both publisher invocations): all use `mantis-telegram-desktop-proof:${GITHUB_RUN_ID}-${GITHUB_RUN_ATTEMPT}`. - Live-run proof of the label-triggered path requires a merged workflow (GitHub runs the workflow from the default branch for these triggers), so the first post-merge label-triggered Mantis run is the live verification; stated here as the known evidence gap. Production LOC delta: −4 (workflow/tooling); tests +13.
What Problem This Solves
Fixes an issue where users pressing Telegram inline buttons could see a valid plugin action silently disappear or a multi-select option fail to toggle when its callback value ended in meaningful whitespace.
Why This Change Was Made
Telegram callback routing normalized the entire callback before decoding, which invalidated the checksum of opaque callback envelopes and made managed multi-select values differ from the exact callback bytes stored on their buttons. Decode those two Telegram-owned values from the original callback while keeping existing normalized approval, question, native-command, model, authorization, and shared plugin-payload behavior unchanged. The owner cleanup removes three production lines overall.
User Impact
Telegram plugin buttons whose signed callback values contain trailing whitespace now reach their registered handlers, and Telegram multi-select buttons with trailing-whitespace values visibly toggle as expected. Existing plugin payload normalization and single-select message normalization are unchanged.
Evidence
node scripts/run-vitest.mjs extensions/telegram/src/bot.create-telegram-bot.test.ts extensions/telegram/src/bot.test.ts extensions/telegram/src/approval-callback-data.test.ts extensions/telegram/src/question-callback-data.test.ts extensions/telegram/src/button-types.test.ts extensions/telegram/src/native-command-callback-data.test.ts --maxWorkers 1git diff --checkall pass; independent security/source review and authenticated Codex review are clean.