Skip to content

fix(telegram): keep long model names selectable - #114472

Merged
steipete merged 1 commit into
mainfrom
codex/sweep-telegram-callbacks-20260727
Aug 26, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/sweep-telegram-callbacks-20260727

Conversation

@steipete

@steipete steipete commented Jul 27, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Telegram silently removed model buttons whose callback data exceeded the Telegram 64-byte transport limit.

Repair

Encode oversized provider/model callbacks using bounded opaque identifiers and resolve them only against the current authorized provider catalog through the current callback router. Existing standard and compact callbacks remain supported.

Verification

Original missing-button regressions reproduced; 173 tests passed, including a real local Telegram Bot API server and grammY update/callback flow. Independent review passed. Authenticated Telegram Desktop proof is running separately.

@openclaw-barnacle openclaw-barnacle Bot added channel: telegram Channel integration: telegram size: S maintainer Maintainer-authored PR labels Jul 27, 2026
@steipete
steipete marked this pull request as ready for review July 27, 2026 09:11
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. mantis: telegram-visible-proof Mantis should capture Telegram visible proof. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 auth-provider 🚨 May break OAuth, tokens, provider routing, model choice, or credentials. labels Jul 27, 2026
@clawsweeper

clawsweeper Bot commented Jul 27, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 25, 2026, 5:42 PM ET / 21:42 UTC.

ClawSweeper review

What this changes

This PR replaces oversized Telegram /model callback payloads with bounded hashes, resolves them against the current authorized catalog, and tests the active callback route.

Merge readiness

⚠️ Ready for maintainer review - 5 items remain

Keep open: current main still silently drops models whose compact callback exceeds 64 bytes, and this head now routes its opaque callbacks correctly. The remaining blocker is maintainer direction on whether to use the merged typed model-picker seam or explicitly retain a Telegram-private codec.

Priority: P2
Reviewed head: 494c5ca88301425c4413d97ee6686db77f2f0b40
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) PR readiness rating was derived from proof quality, review findings, security review, and reviewer confidence.
Proof confidence 🌊 off-meta tidepool Not applicable: Real behavior proof is not required for maintainer- or bot-authored pull requests.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: Real behavior proof is not required for maintainer- or bot-authored pull requests.
Evidence reviewed 6 items Current-main bug: The current-main builder returns null when both legacy callback encodings are too long, and the keyboard skips that model.
PR repair path: The proposed builder always emits an opaque model reference when legacy encodings do not fit, and the router resolves it only after authorization against fresh provider data.
Active-router proof: The added loopback test sends the bounded button through grammY and the callback router, then checks the persisted model selection and edited confirmation.
Findings None None.
Security None None.

Live Verification

Command: pnpm test extensions/telegram/src/model-callback.loopback.integration.test.ts

Result: FAIL (failed) — step 1 run pnpm test extensions/telegram/src/model-callback.loopback.integration.test.ts: previous terminal command was still running after 30 seconds: "pnpm test extensions/telegram/src/model-callback.loopback.integration.test.ts"

$ node --import tsx scripts/test-projects.mts extensions/telegram/src/model-callback.loopback.integration.test.ts
[test] starting test/vitest/vitest.extension-telegram.config.ts

 RUN  v4.1.10 /tmp/clawsweeper-live-proof-114472-4KS7XW/target

Assertions:

  • FAIL expect_output: sends, authorizes, resolves, persists, answers, and edits an opaque callback

How this fits together

Telegram’s /model keyboard turns the authorized provider catalog into callback buttons, then the callback router resolves a selected model and applies it to the active session. This change replaces overlong transport payloads at that keyboard/router boundary.

flowchart LR
A[Authorized provider catalog] --> B[Telegram model keyboard]
B --> C[Bounded callback payload]
C --> D[Callback router]
D --> E[Authorized catalog resolution]
E --> F[Session model apply]
F --> G[Telegram confirmation]
Loading

Decision needed

Question Recommendation
Should Telegram long-model callbacks migrate now to the merged typed model-picker action contract, or should this PR establish an explicitly temporary Telegram-private opaque codec? Complete the typed codec: Add the core producer/resolver and Telegram codec, then migrate this legacy picker path onto that canonical action contract.

Why: Both paths repair the bug, but they set different long-lived ownership boundaries between core model-picker actions and channel transport encoding.

Before merge

  • Resolve merge risk (P1) - The bug repair adds a Telegram-private callback protocol beside the merged typed model-picker contract; landing it without an explicit ownership decision risks preserving two picker transport paths.
  • Resolve merge risk (P1) - The PR has local grammY/HTTP loopback coverage but no completed after-fix Telegram proof; the pending Mantis investigation has not yet published an observed result.
  • Resolve merge risk (P1) - Production code grows by 85 net lines for a bounded bug fix; the owner-boundary alternative needs a maintainer decision before that growth is accepted.
  • Complete next step (P2) - A maintainer must choose the canonical model-picker ownership boundary before an automated repair or merge path is safe.
Agent review details

Security

None.

PR surface

Source +85, Tests +322. Total +407 across 4 files.

View PR surface stats
Area Files Added Removed Net
Source 2 109 24 +85
Tests 2 329 7 +322
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 4 438 31 +407

Review metrics

Metric Value Why it matters
Production versus test LOC production +109/-24 (net +85); tests +329/-7 (net +322) The focused test growth is substantial, while the positive production delta needs the picker-boundary decision before this bug fix lands.

Stored data model

Persistent data-model change detected: serialized state: extensions/telegram/src/model-buttons.ts, serialized state: extensions/telegram/src/model-callback.loopback.integration.test.ts. Confirm migration or upgrade compatibility proof before merge.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #98221
Summary: This PR is a candidate fix for the canonical long-callback omission report.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge-risk options

Maintainer options:

  1. Adopt the typed picker codec (recommended)
    Resolve the ownership decision by moving the Telegram encoding onto the existing typed picker action before merge.
  2. Accept the private codec explicitly
    Merge the current approach only after maintainers document that Telegram owns this temporary callback protocol and its migration path.

Technical review

Best possible solution:

Choose one canonical picker boundary: complete the typed model-picker transport codec and migrate Telegram, or explicitly authorize this bounded Telegram-private mitigation and retain its current-catalog authorization checks.

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

Yes, from source: a model whose standard and compact callback strings exceed 64 bytes makes current main return null and skip its button; the supplied long Ollama identifier is a concrete case.

Is this the best way to solve the issue?

Unclear: the current head repairs the active route, but its Telegram-private protocol is not yet established as the best long-term owner boundary over the merged typed picker contract.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🌊 off-meta tidepool and patch quality is 🦞 diamond lobster.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: Real behavior proof is not required for maintainer- or bot-authored pull requests.
  • remove rating: 🦐 gold shrimp: Current PR rating is rating: 🦞 diamond lobster, so this older rating label is no longer current.
  • remove status: ⏳ waiting on author: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P2: This repairs a real but bounded Telegram model-picker usability failure.
  • merge-risk: 🚨 compatibility: The PR adds a new callback wire format beside existing picker encodings and the typed picker contract.
  • merge-risk: 🚨 auth-provider: The new payload resolves provider/model selection against the authorized runtime catalog.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🌊 off-meta tidepool and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: Real behavior proof is not required for maintainer- or bot-authored pull requests.
  • mantis: telegram-visible-proof: Mantis should capture Telegram visible proof. The PR changes whether users can see and select long model names in a Telegram chat.

Evidence

What I checked:

Likely related people:

  • steipete: Authored prior Telegram model-picker fixes and the merged model-picker foundation that creates the present seam decision. (role: feature owner and recent area contributor; confidence: high; commits: 7ac8e2e227a3, f0e81b97e8d0; files: extensions/telegram/src/model-buttons.ts, src/plugin-sdk/interactive-runtime.ts)
  • fumin: Authored the earlier full provider/model selection correction in this same Telegram picker surface. (role: adjacent model-picker contributor; confidence: medium; commits: 43272d27f8ad; files: extensions/telegram/src/model-buttons.ts)

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 (13 earlier review cycles; latest 8 shown)
  • reviewed 2026-08-09T13:50:02.211Z sha aab7768 :: found issues before merge. :: [P1] Keep configured ~ providers selectable
  • reviewed August 9, 2026, 12:42 PM ET / 16:42 UTC sha unknown :: found issues before merge. :: [P1] Keep arbitrary provider IDs selectable
  • reviewed 2026-08-10T01:55:01.494Z sha aab7768 :: found issues before merge. :: [P1] Do not reserve a valid provider ID
  • reviewed 2026-08-11T18:55:45.350Z sha 329772a :: found issues before merge. :: [P1] Port opaque callbacks through the live callback router
  • reviewed 2026-08-14T13:10:40.329Z sha 329772a :: found issues before merge. :: [P1] Port opaque callbacks through the live callback router
  • reviewed 2026-08-15T15:50:51.818Z sha 329772a :: found issues before merge. :: [P1] Port opaque callbacks through the live callback router
  • reviewed 2026-08-18T23:37:56.222Z sha 329772a :: found issues before merge. :: [P1] Route opaque callbacks through the active router
  • reviewed 2026-08-25T00:50:46.925Z sha 329772a :: found issues before merge. :: [P1] Route opaque callbacks through the active router

@steipete

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jul 27, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Jul 27, 2026
@clawsweeper clawsweeper Bot added 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. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Aug 3, 2026
@steipete

steipete commented Aug 9, 2026

Copy link
Copy Markdown
Contributor Author

Maintainer decision required before this PR can be rewritten or landed.

The bug remains real on current main: extensions/telegram/src/model-buttons.ts:119 returns null when both name-bearing callbacks exceed Telegram's 64-byte limit, and lines 219–220 silently omit the model.

Two post-PR facts change the best-fix decision:

  1. refactor(model-picker): centralize session apply contracts #114739 added the core-owned ModelPickerAction contract with snapshot/provider/model tokens and explicitly states that channels only serialize those typed actions in transport-private envelopes. The end-to-end core producer/resolver and Telegram codec are not implemented yet. Deepening Telegram's legacy product-specific picker tree would move further from that ownership boundary.
  2. This branch's ~ provider sentinel is not collision-safe. Provider IDs are arbitrary strings in the current schema; a real ~ provider would make buildModelSelectionCallbackData return null, recreating the same silent omission.

Peter needs to choose between:

  • completing the core picker snapshot/token producer-resolver and adding a Telegram transport codec, then migrating the legacy Telegram tree; or
  • explicitly authorizing a bounded Telegram-private mitigation using a distinct callback discriminant such as mdl_ref/<provider-scoped-digest> (not a provider sentinel), resolved only against the current authorized catalog.

The first option expands a public/plugin seam and the second explicitly chooses interim product/ownership debt. Both cross this repair work order's decision gate. The existing branch remains preserved; no code was changed and no live Telegram proof was run for a candidate that should not be merged as written.

@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed 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. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Aug 9, 2026
@clawsweeper clawsweeper Bot removed the rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. label Aug 10, 2026
@vincentkoc
vincentkoc force-pushed the codex/sweep-telegram-callbacks-20260727 branch from aab7768 to 329772a Compare August 11, 2026 18:47
@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. labels Aug 11, 2026
@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. labels Aug 19, 2026
@steipete
steipete force-pushed the codex/sweep-telegram-callbacks-20260727 branch from 329772a to 494c5ca Compare August 25, 2026 21:31
@openclaw-mantis

openclaw-mantis Bot commented Aug 25, 2026 •

Copy link
Copy Markdown
Contributor

Mantis Telegram proof — PASS

Summary: With one configured OpenAI model whose standard and compact Telegram callbacks are 72 and 65 bytes, exact main reported 2 available models but rendered only the short model. The candidate rendered the long model with a 51-byte opaque callback, selected it through Telegram Desktop, confirmed and persisted the session override, retained it across Gateway restart, and rejected the same real-user callback after that user was removed from the Telegram allowlists.

  • Scenario: Start exact baseline and candidate SUTs with gpt-5.6-luna plus openai/xentriom/gemma-4-12B-agentic-fable5-composer2.5-v2:latest. As the approved Telegram Desktop user in the recorded group, run /models, open the openai provider, inspect the buttons and Bot API payload, and on the candidate press the long-model button. Verify the Telegram confirmation, /status output, and the per-agent SQLite session row. Open a second candidate picker, remove the tester from all Telegram group allowlists, restart the Gateway, and press the still-visible long-model button; compare Bot API counts, Telegram events, and the unchanged session row. Restore authorization, reset the model, and repeat the successful candidate selection for final visual proof.
  • Trigger: workflow_dispatch
  • Run: https://github.com/openclaw/openclaw/actions/runs/32901606635
  • Artifact: https://github.com/openclaw/openclaw/actions/runs/32901606635/artifacts/9583759566
  • Baseline: pass at f21c70768976f64656e78408f5293e3a42c0fcde — Exact main f21c707 rendered '2 available' for openai, but Telegram message 51287 contained only 'gpt-5.6-luna ✓' and '<< Back'. The recorded editMessageText payload likewise contained only mdl_sel_openai/gpt-5.6-luna and mdl_back; the configured long model had no button.
  • Candidate (PR merged onto main): pass at 46ba196cb90e75c17f1eb1296724a59941879571 — Exact candidate 46ba196 rendered both models. The long button used mdl1~m:d2fOIHJVdjnFJ_sejnplCT8p9F1EgLSqrmDm_5kn7sI (51 bytes), and pressing it edited the same message to 'Model changed to openai/xentriom/gemma-4-12B-agentic-fable5-composer2.5-v2:latest'. /status showed that model pinned, and session_nodes stored providerOverride=openai, the full long modelOverride, and modelOverrideSource=user. After revoking the tester's Telegram allowlists and restarting, pressing the stale long-model button increased answerCallbackQuery from 3 to 4 while editMessageText stayed at 3, emitted no Telegram event, and left the persisted override unchanged. After restoring authorization, a final recorded picker selection succeeded again.
  • Differential (trusted facts): The same catalog and real Telegram user produced the defect only on main. Main's keyboard omitted the over-limit model; the candidate replaced the unrepresentable callback with a 51-byte opaque reference, resolved it to the full catalog model, persisted the selection, and continued to enforce the existing sender authorization after restart. This directly proves the pull request fixes the reported picker omission without bypassing callback authorization.
  • Overall: pass
Before — current main After — this PR
baseline previewGifCropped candidate previewGifCropped

Motion-trimmed clips:

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

@clawsweeper clawsweeper Bot added rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Aug 25, 2026
@steipete

Copy link
Copy Markdown
Contributor Author

Land-ready verification on exact head 494c5ca: Long provider/model identifiers exceeded Telegram callback_data byte limits and made model buttons unusable. Use Telegram-owned compact callback tokens and stable picker snapshots without adding core product policy. Long models remain selectable, token scope and expiry are enforced, and normal models retain existing behavior. Authenticated Telegram Desktop exact-head baseline/candidate/security/restart workflow passed; focused owner tests, exact CI, and fresh full-branch P1 review are clean. ClawSweeper suggested a shared typed model-picker seam; current src/interactive/payload.ts only declares the schema and Telegram does not enable modelPicker, so no existing producer/snapshot seam exists. Migrating it would require a separate core product redesign and is intentionally not part of this focused transport fix.

@steipete
steipete merged commit 8954634 into main Aug 26, 2026
136 checks passed
@steipete
steipete deleted the codex/sweep-telegram-callbacks-20260727 branch August 26, 2026 03:17
@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. merge-risk: 🚨 auth-provider 🚨 May break OAuth, tokens, provider routing, model choice, or credentials. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. rating: 🦞 diamond lobster Very strong PR readiness with only minor 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