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
@@ -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);
}