mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-15 09:01:14 +00:00
fix(coding-agent): make setThinkingLevel idempotent
switchSession() was appending spurious thinking_level_change entries to session log on resume because setThinkingLevel() unconditionally persisted. Now only persists if the level actually changes. fixes #1118
This commit is contained in:
parent
c9fa28e626
commit
7eae0a7d30
2 changed files with 11 additions and 3 deletions
|
|
@ -8,6 +8,7 @@
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
|
- Fixed `switchSession()` appending spurious `thinking_level_change` entry to session log on resume. `setThinkingLevel()` is now idempotent. ([#1118](https://github.com/badlogic/pi-mono/issues/1118))
|
||||||
- Fixed clipboard image paste on WSL2/WSLg writing invalid PNG files when clipboard provides `image/bmp` format. BMP images are now converted to PNG before saving. ([#1112](https://github.com/badlogic/pi-mono/pull/1112) by [@lightningRalf](https://github.com/lightningRalf))
|
- Fixed clipboard image paste on WSL2/WSLg writing invalid PNG files when clipboard provides `image/bmp` format. BMP images are now converted to PNG before saving. ([#1112](https://github.com/badlogic/pi-mono/pull/1112) by [@lightningRalf](https://github.com/lightningRalf))
|
||||||
|
|
||||||
## [0.50.7] - 2026-01-31
|
## [0.50.7] - 2026-01-31
|
||||||
|
|
|
||||||
|
|
@ -1236,14 +1236,21 @@ export class AgentSession {
|
||||||
/**
|
/**
|
||||||
* Set thinking level.
|
* Set thinking level.
|
||||||
* Clamps to model capabilities based on available thinking levels.
|
* Clamps to model capabilities based on available thinking levels.
|
||||||
* Saves to session and settings.
|
* Saves to session and settings only if the level actually changes.
|
||||||
*/
|
*/
|
||||||
setThinkingLevel(level: ThinkingLevel): void {
|
setThinkingLevel(level: ThinkingLevel): void {
|
||||||
const availableLevels = this.getAvailableThinkingLevels();
|
const availableLevels = this.getAvailableThinkingLevels();
|
||||||
const effectiveLevel = availableLevels.includes(level) ? level : this._clampThinkingLevel(level, availableLevels);
|
const effectiveLevel = availableLevels.includes(level) ? level : this._clampThinkingLevel(level, availableLevels);
|
||||||
|
|
||||||
|
// Only persist if actually changing
|
||||||
|
const isChanging = effectiveLevel !== this.agent.state.thinkingLevel;
|
||||||
|
|
||||||
this.agent.setThinkingLevel(effectiveLevel);
|
this.agent.setThinkingLevel(effectiveLevel);
|
||||||
this.sessionManager.appendThinkingLevelChange(effectiveLevel);
|
|
||||||
this.settingsManager.setDefaultThinkingLevel(effectiveLevel);
|
if (isChanging) {
|
||||||
|
this.sessionManager.appendThinkingLevelChange(effectiveLevel);
|
||||||
|
this.settingsManager.setDefaultThinkingLevel(effectiveLevel);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue