fix(sessions): reset token counts to 0 on /new (#1523)#1542
Merged
steipete merged 1 commit intoopenclaw:mainfrom Jan 24, 2026
Merged
fix(sessions): reset token counts to 0 on /new (#1523)#1542steipete merged 1 commit intoopenclaw:mainfrom
steipete merged 1 commit intoopenclaw:mainfrom
Conversation
- Set inputTokens, outputTokens, totalTokens to 0 in sessions.reset - Clear TUI sessionInfo tokens immediately before async reset - Prevents stale token display after session reset Fixes #1523
steipete
added a commit
that referenced
this pull request
Jan 24, 2026
Contributor
|
Landed via temp rebase onto main.\n\n- Gate: pnpm lint && pnpm build && pnpm test\n- Land commit: e2065e8\n- Merge commit: 511a0c2\n\nThanks @robbyczgw-cla! |
dustin-olenslager
pushed a commit
to dustin-olenslager/ironclaw-supreme
that referenced
this pull request
Mar 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes TUI showing stale token counts (e.g., 92k) after
/newsession reset, when the actual count should be near 0.Problem
After
/newreset:The 92k appears consistently after reset regardless of previous session size.
Root Cause
sessions.resetcreates a new entry but omitsinputTokens/outputTokens/totalTokensinstead of explicitly setting them to 0sessionInfoimmediately — shows cached values untilrefreshSessionInfo()completesChanges
1. Backend (
src/gateway/server-methods/sessions.ts)2. TUI (
src/tui/tui-command-handlers.ts)Testing
npm run lint— 0 warnings, 0 errorstsc --noEmit— passesRelated
🤖 AI-Assisted
sessions.resetwas creating new entries without token fields, causing fallback to stale cached values; TUI held onto oldsessionInfountil async refresh completedFixes #1523