fix(spx-gui): stabilize AI asset generation ETA display#2921
Open
xgopilot[bot] wants to merge 1 commit intodevfrom
Open
fix(spx-gui): stabilize AI asset generation ETA display#2921xgopilot[bot] wants to merge 1 commit intodevfrom
xgopilot[bot] wants to merge 1 commit intodevfrom
Conversation
Fixes #2919 The previous implementation derived `timeLeft` from the estimated progress percentage using the quadratic curve: `timeLeft = timeCost * (1 - percentage)`. Because the quadratic function advances very fast in early intervals, the ETA could drop from ~3 minutes to ~1.5 minutes within just 18 seconds, making the display feel unreliable and fake. Changes: - `progress.ts`: Switch `startAutoReport` to use wall-clock elapsed time for ETA calculation (`timeLeft = max(0, timeCost - elapsed)`) instead of percentage-based estimation. The progress curve (quadratic) is kept for the visual progress bar, but ETA now decreases at a stable ~1 second per second, independent of the progress model. - `common.ts`: Update video generation default estimated duration from 150s (2.5 min) to 180s (3 min) as specified in the issue. - `progress.test.ts`: Update test expectations to reflect that timeLeft is now wall-clock based (non-increasing, clamped to [0, timeCost]). Generated with [codeagent](https://github.com/qbox/codeagent) Co-authored-by: nighca <1492263+nighca@users.noreply.github.com>
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.
Requested by @nighca
Fixes #2919
Summary
Root cause:
startAutoReportused a quadratic curve to derive ETA astimeLeft = timeCost * (1 - percentage). Since the quadratic function advances quickly in early intervals, the ETA could drop from ~3 minutes to ~1.5 minutes within ~18 seconds, making the display feel unreliable.Fix in
progress.ts: Decouple ETA from the progress curve. Use wall-clock elapsed time for ETA:timeLeft = max(0, timeCost - elapsed). The quadratic progress curve is kept for the visual progress bar animation, but ETA now decreases at a stable ~1 second per second.Fix in
common.ts: UpdateGenerateAnimationVideodefault estimated duration from 150s (2.5 min) to 180s (3 min) as specified in the issue.Update in
progress.test.ts: Adjust test expectations — ETA is now non-increasing (wall-clock based, clamped to[0, timeCost]) rather than strictly decreasing from a percentage-derived value.Result
With this fix, for a 3-minute task, the displayed ETA will now change approximately as:
Instead of the previous behavior where it could jump through all four stages in just ~15 seconds.