Repository navigation
fix(telegram): keep over-limit-name models selectable in /model picker (#98221) - #98230
luoyanglang wants to merge 3 commits into
Conversation
openclaw#98221) The /model picker silently dropped any model whose callback_data exceeded Telegram's 64-byte limit on both the standard and compact encodings — long namespaced Ollama ids in particular — while the header still counted them. Add a length-safe index fallback: when neither name-based encoding fits, buildModelSelectionCallbackData emits mdl_idx_{provider}_{index} referencing the model's position in the provider's sorted list, parseModelCallbackData decodes it, and buildModelsKeyboard stops dropping over-limit models. The callback handler resolves the index against the same [...set].toSorted(localeCompare) derivation used to build the keyboard, then reuses the existing select path; a list that changed since render prompts a refresh instead of mis-selecting. Co-Authored-By: Claude Opus 4.8 <[email protected]>
|
Codex review: needs maintainer review before merge. Reviewed July 7, 2026, 5:25 AM ET / 09:25 UTC. Summary PR surface: Source +89, Tests +99. Total +188 across 3 files. Reproducibility: yes. Current main is source-reproducible because over-limit compact callback data returns Review metrics: 1 noteworthy metric.
Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Risk before merge
Maintainer options:
Next step before merge
Maintainer decision needed
Security Review detailsBest possible solution: Land one canonical Telegram-layer index callback fix for the linked issue; this PR is a strong candidate if maintainers prefer preserving existing name-based callbacks and falling back to indexed callbacks only when Telegram's limit requires it. Do we have a high-confidence way to reproduce the issue? Yes. Current main is source-reproducible because over-limit compact callback data returns Is this the best way to solve the issue? Yes for this branch. The index-plus-identity fallback fixes the Telegram 64-byte limit only when needed, preserves existing selectable callback formats, and rejects stale in-range index drift; the remaining question is which sibling callback contract maintainers want to own. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against da1b0fa2a8f4. Label changesLabel justifications:
Evidence reviewedPR surface: Source +89, Tests +99. Total +188 across 3 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
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. How this review workflow works
|
Mantis Telegram Desktop ProofSummary: Mantis captured native Telegram Desktop before/after GIFs for the /model picker: Main shows one listed model despite 2 available; This PR shows the long model button.
Motion-trimmed clips: |
|
@clawsweeper re-review Addressed the stale-index P2 in head |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
This pull request has been automatically marked as stale due to inactivity. |
|
Closing due to inactivity. |




Fixes #98221
What Problem This Solves
The Telegram
/modelpicker silently omits any model whosecallback_dataexceeds Telegram's 64-byte limit on both the standard (mdl_sel_{provider}/{model}) and compact (mdl_sel/{model}) encodings. The header reports the correct total (for example, "7 available") but fewer buttons render, with no error, warning, or placeholder. Long namespaced Ollama ids, increasingly common with community fine-tunes, become unreachable from the picker.Why This Change Was Made
buildModelSelectionCallbackDataembeds the full model name in the callback, so an arbitrarily long name cannot fit 64 bytes andbuildModelsKeyboarddropped it (if (!callbackData) continue). The 64-byte ceiling is a hard Telegram limit, so this adds a length-safe provider/index callback resolved server-side against the same sorted list the keyboard was built from.The latest follow-up also binds index callbacks to a compact model identity token. If the provider model list changes while an old keyboard is visible and the old index now points at a different model, the handler now asks the user to rerun
/modelinstead of applying the wrong model.User Impact
mdl_idx_{provider}_{index}_{token}).Evidence
Local macOS validation against head
1f829039bc:extensions/telegram/src/model-buttons.ts: index callbacks now include a compact identity token;resolveIndexedModelSelectionrejects missing or token-mismatched indexes.extensions/telegram/src/bot-handlers.runtime.ts: the callback handler resolvesselectIndexthroughresolveIndexedModelSelection; missing or mismatched identity promptsThat model list changed. Send /model again to refresh.extensions/telegram/src/model-buttons.test.ts: added regression coverage for stale in-range index drift and token-bound over-limit callbacks.node scripts/run-vitest.mjs extensions/telegram/src/model-buttons.test.ts— 29 tests passed.node scripts/run-vitest.mjs extensions/telegram/src/model-buttons.test.ts extensions/telegram/src/bot.create-telegram-bot.test.ts extensions/telegram/src/bot.test.ts— 224 tests passed.pnpm tsgo:extensionsandpnpm tsgo:extensions:test— passed.node scripts/run-oxlint.mjs extensions/telegram/src/model-buttons.ts extensions/telegram/src/model-buttons.test.ts extensions/telegram/src/bot-handlers.runtime.ts— passed.pnpm exec oxfmt --check --threads=1 extensions/telegram/src/model-buttons.ts extensions/telegram/src/model-buttons.test.ts extensions/telegram/src/bot-handlers.runtime.ts— passed.git diff --checkandnode scripts/check-no-conflict-markers.mjs— passed.gitleaks protect --staged --redact— no leaks.Real Behavior Proof
Mantis captured native Telegram Desktop before/after proof in PR comment
openclaw-mantison 2026-06-30:Summary from the proof: current
mainreports 2 available models but shows only one listed model; this PR shows the long over-limit model button in native Telegram Desktop.