Merge PR #2586: fix(goals): avoid deactivating goal mode on wall-clock-only updates

Closes #2586
This commit is contained in:
can1357
2026-06-15 02:39:39 +02:00
3 changed files with 22 additions and 1 deletions
+4 -1
View File
@@ -356,7 +356,10 @@ export class GoalRuntime {
this.#wallClock.lastAccountedAt += wallSeconds * 1000;
}
await this.#commitState(state, { persist: "goal" });
// Persisting wall-clock-only accounting on every tool event bloats /goal sessions with full
// objective snapshots. Keep the in-memory/UI state fresh, but persist only token/budget changes.
const shouldPersistUsage = tokenDelta > 0 || flippedToBudgetLimited;
await this.#commitState(state, { persist: shouldPersistUsage ? "goal" : undefined });
if (state.goal.status !== "budget-limited") {
this.#budgetReportedFor = undefined;