Repository navigation
[skip-cr] fix: hold the last GPT context value during all-zero usage reports - #14
Merged
Merged
Conversation
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configuration
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
A GPT session was observed reporting a context window with every usage counter at zero (used 0%, remaining 100%) between two normal readings, so the bar flashed a false 0%. For a GPT effective model, exactly that shape now re-shows the last valid percentage in dim gray. The value is a private per-session snapshot, stored only when the transcript proves the matching assistant response after the last compact boundary, and dropped on any key change, compaction, /clear or Claude render. Also corrects the formula's dev-mode instructions to honor XDG_CONFIG_HOME.
A failed write, chmod or rename left the older snapshot in place, so a later all-zero frame could re-show a stale value after a newer reading had been displayed. Publish only when all three succeed; otherwise delete the old snapshot as well.
vtmocanu
force-pushed
the
fix/gpt-context-stale
branch
from
October 4, 2026 19:15
70322ad to
7013a53
Compare
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
GPT sessions no longer flash a false
0%context reading. A live gpt-6.1-sol session was captured sending21% -> 0% -> 21%, where the middle payload had everycurrent_usagecounter and both totals at zero (used 0%, remaining 100%) with the same model and window. For a GPT effective model, exactly that shape now re-shows the last valid percentage in dim gray (bar and number, both layouts). Every other shape, and all Claude renders, are unchanged. The upstream cause of the zero payload is not proven.How
ctx-last-<session_id>, mode 600, atomic replace) keeps the last native percentage with its keys (raw and effective model, window, transcript path, input/cache counters)./compactis never stored. One embedded Perl helper (coreJSON::PP,Digest::MD5), no new process, network or credential./clear,/compactand Claude renders drop the snapshot.Formula.rb.tmpl's dev-mode instructions to honorXDG_CONFIG_HOME.Testing
task ci: syntax, shellcheck, 281 tests in UTF-8 andLC_ALL=C, 75 fetcher tests in both locales;ruby -c Formula.rb.tmpl.🤖 Generated with Claude Code