Fix session context occupancy and profile account usage eligibility - #380
Merged
Merged
Conversation
Tryanks
marked this pull request as ready for review
September 8, 2026 11:51
This was referenced Sep 8, 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.
Claude's context meter previously replaced request observations with completed-turn traffic, allowing a multi-request turn to appear to exceed its context window. Request-start usage was discarded, output-only deltas erased input/cache fields, and unknown values rendered as zero. Account quota rows also treated a compatible harness as proof that a custom endpoint supported the native vendor's subscription API.
This change keeps those concerns separate:
Fixes #367. Fixes #357.
Validation and evidence:
cargo test -p agent --locked streaming_usage_keeps_request_scope_at_completionfailed because a literal message start reporting 550 input/cache tokens emitted no usage event. Green after the fix; output-only deltas retain 550 while 4,001,200 processed tokens remain separate.cargo test -p tcode-core --locked resolved_custom_endpoint_is_not_a_native_accountfailed on the original harness-only filter. Green with resolved endpoint/auth eligibility; renaming the profile does not change support.crates/agent/tests/fixtures/claude/USAGE.md.cargo-machete 0.9.2executable directly. The localcargo machetesubcommand incorrectly forwards its own name as a directory; no dependencies or installed tools were changed to bypass that invocation problem.iOS simulator, Web and Android checks also passed with
RUSTFLAGS='-D warnings'; Android used the installed CI-pinned NDK 27.1.12297006 via an explicitANDROID_NDK_HOME. The initial default Android invocation failed only because that environment path was unset.Final combined workspace formatting, Clippy, build and tests passed on
c491be947, after rebasing onto branding PR #379. Dependency hygiene, iOS, Web and Android also passed on that exact head. The final presentation correction keeps known capacity visible even when occupancy has no measured percentage; the accumulation comment now names the timeline owner.Actual GUI acceptance completed on an isolated app bundle built from
c491be947(distinct bundle ID, explicitly verifiedTCODE_DATA_DIR, copied binary protected from shared-target replacement). Normal1200px and approximately360px narrow layouts were reviewed in dark/light themes and English/Simplified Chinese. Current context500k/1m remained distinct from4m total traffic; legacy4.1m remained unmeasured Unknown/1m; last-known context showed updating; completed compaction retained known capacity with Unknown and no occupancy progress bar. Manual trigger and pre-compaction count remained readable, wrapping in narrow English. The custom endpoint kept session occupancy while omitting account quota. Settings omitted its row and retained the representative supported native-profile failure with its error message; composer retained localized Usage unavailable. Escape dismissal, focus, navigation and narrow Settings scrolling were exercised. No additional GUI defect was found.GUI screenshots and the exact-head/binary provenance manifest are retained locally in
/tmp/tcode-usage-evidence/GUI.mdand its named PNG files for lead review; they are not uploaded as repository assets. Final command logs are in/tmp/tcode-usage-evidence/final-checks/, with workspace build infinal-build.log. The isolated GUI process has been stopped and the desktop slot released.All six hosted checks passed on
c491be947e9921b1d39d186de1db9ffc9a5e7e84: scope planning, dependency hygiene, macOS, Linux, Windows, and mobile/Web. Final source, check logs, binary provenance and retained GUI screenshots were independently reviewed. CI run: https://github.com/Tryanks/tcode/actions/runs/34221832016.The exact reporter's multi-million-token run and automatic compaction were not captured; constructed edge-case fixtures are labeled separately from the live evidence. No user session/profile was opened for the provider captures.