Skip to content

fix(telegram): follow configured model runtime - #133125

Merged
obviyus merged 1 commit into
mainfrom
codex/fix-telegram-model-runtime
Aug 30, 2026
Merged

obviyus merged 1 commit into
mainfrom
codex/fix-telegram-model-runtime

Conversation

@obviyus

@obviyus obviyus commented Aug 30, 2026 •

Copy link
Copy Markdown
Collaborator

Problem

Telegram model-picker buttons preserved a compatible session runtime override. A selected model's configured runtime policy could not take effect, and the confirmation told the operator to run a second manual /model --runtime command.

Root cause

The Telegram callback sent runtime: unchanged to the shared model-selection transaction. Session runtime overrides outrank configured model policy, so a prior compatible override stayed active.

Product decision

Ayaan Zaidi approves a Telegram model-button click as the explicit operator action that adopts the selected model's configured runtime policy. The model list states this effect before the click. Explicit /model --runtime remains the override path.

Fix

  • State before the model buttons that selection also applies configured runtime.
  • Clear the session runtime override when Telegram applies the selected model.
  • Return and reuse the effective runtime from the shared transaction.
  • Name that runtime in the Telegram confirmation.
  • Keep explicit /model --runtime behavior unchanged.

Shape

  • Owner: shared model-selection transaction plus Telegram's picker policy.
  • Before: picker model + prior session runtime.
  • After: picker model + configured model/provider runtime policy.
  • Explicit runtime choices remain available through /model --runtime.

Production

  • Production delta: 20 additions, 28 deletions.
  • The shared owner now resolves the effective runtime twice instead of three times.
  • No new config, persistence, fallback, or provider-specific path was added.

Live proof

Real Telegram Test Server user and bot, same callback and isolated session state on both revisions:

  • Main 5a1e1316e0a1a56362d6bf4124c983228fbfb1a4: the callback completed, the bot said Runtime unchanged, and the session kept agentRuntimeOverride: openclaw.
  • Proven head b80fcaa17edc26af9654f6e7d6c70e34ba8fef91: the picker stated the configured-runtime effect before the click; the callback completed; the bot said Runtime set to openclaw from configured policy; and the runtime override was absent.
  • Current head 2507db42dc320fce8a6435b7de89bc0db8911be2 is a patch-identical rebase onto healed main. No owner file changed, and stable patch ID 022cbaa92e40a52c1c066fa8e76174b56042c224 matches the proven head.

The selected model was openai/gpt-5.6-luna with configured runtime openclaw. This exercises the generic picker/runtime-policy boundary without provider credentials.

Validation

  • node scripts/run-vitest.mjs src/model-picker/apply-session-model-selection.test.ts — 36 passed.
  • node scripts/run-vitest.mjs extensions/telegram/src/bot.test.ts — 143 passed.
  • Retry-path regression in extensions/telegram/src/bot.create-telegram-bot.test.ts — passed.
  • Changed-scope format, Oxlint, plugin-boundary, dependency, database-first, import-cycle, and repository ratchets passed.
  • TypeScript checks are deferred to hosted CI because this host prohibits them.

Overlap

@clawsweeper

clawsweeper Bot commented Aug 30, 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: S maintainer Maintainer-authored PR labels Aug 30, 2026
@clawsweeper clawsweeper Bot added merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. 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 Aug 30, 2026
@clawsweeper

clawsweeper Bot commented Aug 30, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 30, 2026, 3:40 AM ET / 07:40 UTC.

ClawSweeper review

What this changes

The PR makes Telegram model-picker selections adopt the selected model’s configured runtime, reports that outcome in chat, and reuses the resolved runtime in the shared selection transaction.

Regression provenance

Possible regression — suspected (reviewed change). No predecessor PR is attributed.

Merge readiness

⚠️ Ready for maintainer review - 3 items remain

Keep open for normal maintainer review: an authorized Telegram picker click now deliberately clears an existing session runtime pin, which is a compatibility-significant behavior change. The patch is focused and source-consistent, but the protected maintainer label and MEMBER authorship require human handling rather than automated closure.

Priority: P2
Reviewed head: 2507db42dc320fce8a6435b7de89bc0db8911be2
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, net-negative repair with relevant persisted-state and Telegram confirmation coverage; human confirmation of the intentional compatibility policy remains the merge gate.
Proof confidence 🌊 off-meta tidepool Not applicable: This is MEMBER-authored work, so the external-contributor proof gate does not apply; the PR nevertheless supplies a Telegram Test Server before/after account that could not be independently replayed from this sparse checkout.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This is MEMBER-authored work, so the external-contributor proof gate does not apply; the PR nevertheless supplies a Telegram Test Server before/after account that could not be independently replayed from this sparse checkout.
Evidence reviewed 6 items Introduced Telegram policy: The introduced callback text makes the effect visible before selection, passes runtime: { kind: "clear" } into the shared transaction, and confirms the returned effective runtime after success.
Shared owner preserves resolved state: The transaction resolves the runtime from the persisted post-selection entry, then uses that same value for queued-followup thinking and context-provider selection before returning it to callers.
Current-main baseline still has the reported behavior: The fetched-main version sends runtime: { kind: "unchanged" } and tells the operator that runtime is unchanged, so this PR is not redundant with current main.
Findings None None.
Security None None.

How this fits together

Telegram’s model picker sends an authorized callback to the shared session model-selection transaction, which persists model and runtime choices for the next agent turn. The Telegram plugin then presents the resolved policy outcome to the operator.

flowchart LR
  A[Telegram model picker] --> B[Authorized callback]
  B --> C[Shared model selection]
  C --> D[Clear session runtime override]
  D --> E[Resolve configured runtime]
  E --> F[Persist session for next reply]
  E --> G[Telegram confirmation]
Loading

Decision needed

Question Recommendation
Should a Telegram model-picker selection intentionally replace a prior session runtime override with the selected model’s configured runtime policy? Accept configured-runtime selection: Treat a picker click as an explicit request to adopt the selected model’s configured runtime while retaining /model --runtime for an explicit session pin.

Why: This changes an existing persisted session preference after an explicit click. The PR body records approval, but available review context does not independently confirm that decision event.

Before merge

  • Resolve merge risk (P1) - After a future Telegram picker click, an existing session runtime pin is cleared; operators who need a different runtime must make that explicit again with /model --runtime. The PR body states this is approved policy, but the supplied timeline does not independently verify that approval.
  • Complete next step (P2) - The focused code path has no mechanical repair blocker, but protected maintainer handling and the persisted-preference policy change require human confirmation.
Agent review details

Security

None.

PR surface

Source -8, Tests +45. Total +37 across 5 files.

View PR surface stats
Area Files Added Removed Net
Source 2 20 28 -8
Tests 3 66 21 +45
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 5 86 49 +37

Review metrics

Metric Value Why it matters
Production versus test delta production -8 lines; tests +45 lines The focused repair reduces repeated runtime resolution while adding coverage for persisted override clearing and operator-visible confirmation.

Merge-risk options

Maintainer options:

  1. Accept the explicit picker policy (recommended)
    Confirm that a future model-picker click may clear a prior session runtime pin because the picker states this effect before selection and /model --runtime remains available.
  2. Retain the old runtime-pin contract
    Change the callback back to preserving existing runtime overrides if picker selection must not alter that stored choice.

Technical review

Best possible solution:

Keep the picker’s pre-click notice and explicit CLI runtime override, and land only after the Telegram/model-policy owner confirms that clearing prior session pins on picker selection is the intended compatibility contract.

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

Yes—source establishes a deterministic path: start with a compatible session runtime override, select a model whose configured runtime differs, and observe current main preserve the pin while this patch clears it.

Is this the best way to solve the issue?

Yes, subject to the stated policy confirmation: Telegram declares its channel-specific intent, while the shared transaction remains the canonical owner of runtime resolution, persistence, follow-up refresh, and context selection.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P2: The change repairs a bounded Telegram session-selection workflow and changes behavior only after an explicit picker action.
  • merge-risk: 🚨 compatibility: Selecting a model now clears an existing persisted runtime override, changing how existing sessions behave after that action.
  • 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 is MEMBER-authored work, so the external-contributor proof gate does not apply; the PR nevertheless supplies a Telegram Test Server before/after account that could not be independently replayed from this sparse checkout.
  • proof: telegram-e2e: This PR needs Telegram Test Server proof with the repository E2E skill. The picker’s visible pre-selection notice and confirmation change, and its persisted runtime outcome, are observable in a Telegram Test Server flow.

Evidence

What I checked:

  • Introduced Telegram policy: The introduced callback text makes the effect visible before selection, passes runtime: { kind: "clear" } into the shared transaction, and confirms the returned effective runtime after success. (extensions/telegram/src/bot-handlers.callback-router.ts:585, 2507db42dc32)
  • Shared owner preserves resolved state: The transaction resolves the runtime from the persisted post-selection entry, then uses that same value for queued-followup thinking and context-provider selection before returning it to callers. (src/model-picker/apply-session-model-selection.ts:304, 2507db42dc32)
  • Current-main baseline still has the reported behavior: The fetched-main version sends runtime: { kind: "unchanged" } and tells the operator that runtime is unchanged, so this PR is not redundant with current main. (extensions/telegram/src/bot-handlers.callback-router.ts:665, f1d2c5b91f80)
  • Regression coverage: Telegram coverage seeds a prior runtime override, selects a model with configured openclaw runtime, asserts the override is absent, and checks the operator-facing confirmation. (extensions/telegram/src/bot.test.ts:2882, 2507db42dc32)
  • Authorization remains before mutation: The callback rejects unauthorized model-picker actions before session lookup and selection processing; the patch does not alter this boundary. (extensions/telegram/src/bot-handlers.callback-router.ts:507, 2507db42dc32)
  • Real-flow evidence supplied in the PR: The PR body records a Telegram Test Server before/after scenario using a prior session override and configured model runtime. Its cited prior proven-head object was unavailable in this sparse checkout, so the rebase-equivalence assertion could not be independently checked here. (2507db42dc32)

Likely related people:

  • Ayaan Zaidi: 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.

History

Review history (3 earlier review cycles)
  • reviewed 2026-08-30T06:47:48.811Z sha a02b8ab9974d39b56c30ee232f573d5aa6ec19d2 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-30T07:09:06.273Z sha 04fc6cc :: needs maintainer review before merge. :: none
  • reviewed 2026-08-30T07:23:17.322Z sha b80fcaa17edc26af9654f6e7d6c70e34ba8fef91 :: needs maintainer review before merge. :: none

@obviyus
obviyus force-pushed the codex/fix-telegram-model-runtime branch 2 times, most recently from 04fc6cc to b80fcaa Compare August 30, 2026 07:17
@obviyus
obviyus force-pushed the codex/fix-telegram-model-runtime branch from b80fcaa to 2507db4 Compare August 30, 2026 07:34
@obviyus

obviyus commented Aug 30, 2026

Copy link
Copy Markdown
Collaborator Author

Owner decision: accept configured-runtime selection. A Telegram model-button click is an explicit request to adopt the selected model's configured runtime. The picker states this before mutation, and /model --runtime remains the explicit session override.

Proof: On Telegram Test Server, the same authorized model callback kept the stale session runtime on main. The repaired head showed the configured-runtime notice before the click, confirmed the effective runtime after the click, and removed the stale override.

  • Bug: A model-button click could leave the prior session runtime active and require a second manual command.
  • Fix: The picker now applies configured runtime policy and reports the resolved runtime.

Example

Before After
Runtime unchanged; stale runtime override remains Picker states the effect; configured runtime is applied and confirmed

@obviyus
obviyus merged commit 93468cb into main Aug 30, 2026
243 of 245 checks passed
@obviyus
obviyus deleted the codex/fix-telegram-model-runtime branch August 30, 2026 07:46
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 31, 2026
Telegram model buttons now adopt the selected model's configured runtime after stating that effect before the click.

This removes stale compatible session runtime overrides, reports the effective runtime, and reuses the shared resolved runtime for follow-up and context handling.

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 merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. 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: S 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