fix: detect content rewrites in syncMessages, reset append-only cache on model switch

This commit is contained in:
Brit
2026-05-24 22:39:20 +02:00
parent 648bbdc163
commit e71d2ff49e
5 changed files with 127 additions and 12 deletions
+1
View File
@@ -5,6 +5,7 @@
### Fixed
- Fixed clipboard image paste (Ctrl+V) silently failing on WSL2 by routing image reads through a `powershell.exe` bridge when WSL interop is detected, since `arboard` returns `ContentNotAvailable` under WSLg ([#1280](https://github.com/can1357/oh-my-pi/issues/1280))
- Fixed append-only context mode not being recomputed after model switches — the mode was frozen at session construction time using the initial model's provider, so `provider.appendOnlyContext=auto` left append-only enabled after switching away from DeepSeek (or disabled after switching to DeepSeek) for the rest of the session
## [15.2.4] - 2026-05-22
### Breaking Changes
@@ -5954,6 +5954,10 @@ export class AgentSession {
const enable = appendOnlySetting === "on" || (appendOnlySetting === "auto" && model.provider === "deepseek");
if (enable && !this.agent.appendOnlyContext) {
this.agent.setAppendOnlyContext(new AppendOnlyContextManager());
} else if (enable && this.agent.appendOnlyContext) {
// Model changed but mode stays enabled — reset cached prefix + log
// so the next turn rebuilds for the new model's normalization.
this.agent.appendOnlyContext.invalidateForModelChange();
} else if (!enable && this.agent.appendOnlyContext) {
this.agent.setAppendOnlyContext(undefined);
}