diff --git a/src/gateway/server-methods/sessions.ts b/src/gateway/server-methods/sessions.ts index f31c726bb..df59a3f31 100644 --- a/src/gateway/server-methods/sessions.ts +++ b/src/gateway/server-methods/sessions.ts @@ -251,6 +251,10 @@ export const sessionsHandlers: GatewayRequestHandlers = { lastChannel: entry?.lastChannel, lastTo: entry?.lastTo, skillsSnapshot: entry?.skillsSnapshot, + // Reset token counts to 0 on session reset (#1523) + inputTokens: 0, + outputTokens: 0, + totalTokens: 0, }; store[primaryKey] = nextEntry; return nextEntry; diff --git a/src/tui/tui-command-handlers.ts b/src/tui/tui-command-handlers.ts index 7bedb4d62..a14172809 100644 --- a/src/tui/tui-command-handlers.ts +++ b/src/tui/tui-command-handlers.ts @@ -408,6 +408,12 @@ export function createCommandHandlers(context: CommandHandlerContext) { case "new": case "reset": try { + // Clear token counts immediately to avoid stale display (#1523) + state.sessionInfo.inputTokens = null; + state.sessionInfo.outputTokens = null; + state.sessionInfo.totalTokens = null; + tui.requestRender(); + await client.resetSession(state.currentSessionKey); chatLog.addSystem(`session ${state.currentSessionKey} reset`); await loadHistory();