Enhance Canvas, Remote Workspace, and File Explorer Features - #113
Merged
Merged
Conversation
SWangHash
pushed a commit
that referenced
this pull request
Sep 3, 2026
fix(ai): force manual subscription token refresh Created-by: guantw Commit-by: guantw Merged-by: SWangHash Description: ## Summary Port the Codex subscription reliability fixes from `release/1.0.5` to `main`. - Keep OAuth credential chunks within HarmonyOS AssetStoreKit's 1024-byte `asset.Tag.SECRET` limit after base64 encoding. - Add GPT-5.6 to the Codex discovery fallback and retry one transient model-catalog failure with bounded per-attempt timeouts before using the local catalog. - Make explicit Codex and Antigravity refresh actions renew OAuth tokens even when the cached access token is still valid, while preserving near-expiry refresh behavior for normal runtime credential resolution. - Restrict the Windows `/STACK:8388608` linker argument to Windows MSVC targets and restore the HarmonyOS downloads API wrapper used by the Web UI. - Add regression coverage for AssetStore chunk sizing, initial model backfill, transient model-discovery retry, and forced-versus-automatic token refresh decisions. ## Type and Areas Type: Bug fix / regression fix Areas: HarmonyOS, AI adapters, subscription authentication, desktop/Tauri build, Web UI infrastructure ## Motivation / Impact HarmonyOS AssetStoreKit rejects secret values larger than 1024 bytes. The previous portable credential chunk size could exceed that limit after the OHOS bridge encoded it as base64, causing Codex OAuth persistence to fail with a secure credential store `401` error. Initial Codex model discovery could also fall back too early after a transient connection, timeout, incomplete-body, decode, or retryable HTTP failure. This could leave users with only the built-in model list until a later refresh. Discovery now makes at most two bounded attempts and still preserves the existing fallback for non-retryable or exhausted failures. Finally, an explicit user refresh previously reused an unexpired cached token and could appear to do nothing. Manual Codex and Antigravity refreshes now force OAuth renewal, while background credential resolution keeps the existing near-expiry policy. ## Verification - `rustfmt --edition 2021 --check` for the six changed Rust files — passed on the `main` port branch. - `git diff --check source/main...HEAD` — passed. - `git show --check --oneline 8447af3`, `22ab96aad`, and `d944ec2c4` — passed. - `cargo test -p bitfun-ai-adapters codex_model_discovery_retries_an_incomplete_first_response --locked` — attempted, but the current workspace lockfile requires an update before Cargo will compile; `Cargo.lock` was intentionally left unchanged. - The first two source changes were previously exercised on `release/1.0.5` in PRs #109 and #113 with the `bitfun-ai-adapters` test suite and HarmonyOS HAP/device validation. The final manual-refresh increment has formatting and static diff validation only in this port. ## Reviewer Notes - This PR ports the functional increments from #109 and #113 onto `main` as three focused commits. - New credential writes use 768-byte raw chunks, which encode to at most 1024 base64 bytes; existing chunked records remain readable through their stored part counts. - Model discovery retries only transient failures, once, with an independent 12-second timeout per attempt and a 250 ms delay. - Explicit refresh uses a force policy; runtime credential lookup continues to refresh only near expiry. - No live `main`-branch HarmonyOS package, remote-workspace, remote-control, peer-device, or detached-dispatch end-to-end run was performed. ## Checklist - [x] This PR is focused and does not include secrets, temporary prompts, generated scratch files, or unrelated artifacts. - [x] Relevant verification is recorded above, or skipped checks are explained. - [x] User-facing strings, docs, and locales are updated where applicable. See merge request: OpenHarmonyPCDeveloper/BitFun!114
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.
…ation
Summary
Fixes #
Type and Areas
Type:
Areas:
Motivation / Impact
Verification
Reviewer Notes
Checklist