Skip to content

feat: add thinking level picker - #18

Merged
benedict2310 merged 4 commits into
benedict2310:mainfrom
claaslange:feat/thinking-level-picker
Aug 14, 2026
Merged

benedict2310 merged 4 commits into
benedict2310:mainfrom
claaslange:feat/thinking-level-picker

Conversation

@claaslange

@claaslange claaslange commented Jul 11, 2026 •

Copy link
Copy Markdown
Contributor

Summary

This adds a /thinking command with a Telegram picker. The picker only shows the thinking levels supported by the current Pi model and marks the active level.

Session creation and model switch messages now show the active thinking level. This makes it clear which setting the next prompt will use.

The Pi SDK packages are updated to version 0.80.6 so TelePi uses the current thinking level support and the new GPT-5.6 models.

Screenshot

Bildschirmfoto 2026-07-11 um 06 59 55

Tests

  • npm run build
  • npm test

@claaslange
claaslange force-pushed the feat/thinking-level-picker branch 2 times, most recently from 1eaa803 to 368bdbc Compare July 12, 2026 11:00
- add a Telegram picker for model-supported thinking levels
- show the active thinking level after session and model changes
- update Pi SDK packages to 0.80.6
@claaslange
claaslange force-pushed the feat/thinking-level-picker branch from 368bdbc to 5f795dc Compare July 12, 2026 11:57
@claaslange

Copy link
Copy Markdown
Contributor Author

@benedict2310 let me know if you're interested in the thinking level picker. If you are, I would resolve the merge conflicts.

@benedict2310

Copy link
Copy Markdown
Owner

Awesome, I'd course! I'll have a look and merge tonight

@benedict2310 benedict2310 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The implementation is compatible with Pi 0.82.1 and the model-specific supported-level validation is a good foundation. CI/build pass, but two issues need addressing before merge:

  1. The new state-changing Telegram flow has no behavioral tests. Current additions only extend mocks and verify command registration. Please add tests for picker buttons/current marker, no supported levels, successful selection/edit, unsupported crafted callback, expired session, and busy/streaming rejection; also directly test PiSessionService.getThinkingLevels() and setThinkingLevel() validation.

  2. Callback data is only thinking_<level>. An old picker remains actionable after switching session/model and can mutate the newly active session when the level happens to be supported. Bind the callback to the session/model or track picker state and reject stale buttons, as the existing picker flows do.

Minor: add /thinking to the plain/HTML help output so the command list remains complete.

- align thinking callbacks with existing picker state handling
- expire thinking buttons after session or model changes
- add behavioral and service validation coverage
- include the thinking command in help output
@claaslange

Copy link
Copy Markdown
Contributor Author

@benedict2310 pushed the changes you requested. Let me know if it's good now, or if you want something done differently.

@benedict2310 benedict2310 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks — commit d3695a9 addresses the help output, service validation, model-change invalidation, and much of the requested behavioral coverage. Focused tests (192), full suite (433), coverage, build, and CI all pass. One merge blocker remains: session-change invalidation is incomplete.\n\n- In the callback session switch path, src/bot.ts calls switchSession and clears tree/prompt state, but does not clear pendingThinkingPicks.\n- The newws_ callback similarly replaces the session without invalidating an existing thinking picker.\n- Extension-driven newSession/switchSession in src/bot/prompt-handler.ts also bypass bot-owned picker invalidation.\n\nA user can therefore open /thinking, replace the active session through one of these paths, then click the old button and mutate the new session when that level is supported. Please either bind each pending thinking picker to session/model identity and validate that identity in the callback (the more robust option), or ensure every successful session replacement invalidates it. Add regression tests covering switch_, newws_, and extension-driven replacement. Once those pass, this should be ready to approve and merge.

- bind thinking picker state to the active session and model
- reject buttons after callback and extension session replacements
- add regression coverage for all session replacement paths
@claaslange

claaslange commented Aug 14, 2026 •

Copy link
Copy Markdown
Contributor Author

Adopted your requested changes.

@benedict2310 benedict2310 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-reviewed 1e32188. The remaining blocker is resolved: thinking picker state is now bound to the active session ID and model, so stale buttons expire after switch_, newws_, and extension-driven newSession/switchSession replacements. The requested regression tests are present. Local validation passed: focused tests 204/204, full suite 437/437, coverage thresholds met, TypeScript build passed, and GitHub CI is green. Approving and merging.

@benedict2310
benedict2310 merged commit d6a2f1d into benedict2310:main Aug 14, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants