Port upstream 0.60.4: keep Chrome DeepSeek balance through same-session transport failures (stacked on #646) - #709
Draft
Finesssee wants to merge 1 commit into
Conversation
…on transport failures
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: trueThanks 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 |
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
Ports the behavior of upstream CodexBar 0.60.4 "keep Chrome DeepSeek balances visible through temporary connection failures for the same browser session, preserving the original measurement time".
When no DeepSeek API key is configured, Auto mode now reads the Platform balance through a signed-in Chrome session (token read with the LevelDB reader from #646). If a later refresh fails with a transport failure (timeout or connection refused), the cached balance stays visible with its original
updated_at, but only when the failed request used the same Chrome profile and the same token that produced the cached balance. A rejected session, a different profile or token, a resolution deadline, or a balance with no session owner (for example an API-key balance) is never retained; the error is shown instead.Found by the 0.60.4-0.69.0 port gap audit.
Upstream reference
LastGoodOwner(rust/src/core/last_good_owner.rs), never serialized,Debugredacted.GET https://platform.deepseek.com/api/v0/users/get_user_summary(Bearer,x-client-platform: web), 401/403 or envelope code/biz_code 40002/40003 mean the session is rejected.Ported / Deferred
Ported:
ProviderError::OwnedTransportwraps only transport failures; the shell (commands/providers.rs) records the owner of each fresh snapshot inAppState.last_good_ownersand keeps the cached snapshot only when the failure's owner matches.chrome:<dir>ids), 30-minute validation cache holding digests only, selected-profile balance always fetched live.Deferred (not in this PR):
CODEXBAR_DEEPSEEK_PROFILE_ID(for examplechrome:Profile 1); without it the user is told to set it.DEEPSEEK_PLATFORM_TOKENand other manual-token env support.Local Stateprofile display names (labels use the directory name).Validation
All with toolchain 1.98.0, slot-3 target dir,
--test-threads=4.cargo fmt --all: clean.cargo clippy --workspace --all-targets -- -D warnings: pass.cargo test -p codexbar deepseek: 42 passed, 0 failed.cargo test -p codexbar(full): 2223 passed, 0 failed, 1 ignored.cargo test -p codexbar-desktop-tauri last_good: 9 passed.cargo test -p codexbar-desktop-tauri(full): 468 passed, 1 failed. The failure is the knownbootstrap_payload_exposes_every_provider_variant(fixed by Isolate bootstrap payload test from real settings #684), unrelated.Affected areas
rust/src/core/(owner type,ProviderErrorvariant,ProviderFetchResult.last_good_owner)rust/src/providers/deepseek/(Chrome session lane, platform balance, resolver)rust/src/cli/(exhaustiveProviderErrormatches)apps/desktop-tauri/src-tauri/src/(state.rs,commands/providers.rsretention path)No new dependencies (
sha2andfuturesalready inrust/Cargo.toml). No secrets logged; only profile ids go totracing::debug.Stacked on #646 (base
port/micro-0.66.0-browser-leveldb-reader).UI proof
Pending: coordinator will capture CUA proof on a fresh build.