CherryHQ / CherryHQ/cherry-studio

[Bug]: Prompt polishing can spin for minutes with no timeout or cancel action

Open
#20,161 0 comments 1 reaction 0 assignees View on GitHub
bug p2 performance ui-ux
Dominant language
TypeScript
Stars
51.8k
Forks
5k
Avg merge
2d 7h
Merged PRs (30d)
600

Description

## Summary

Prompt polishing in resource editors can remain in a loading state for several minutes or appear never to finish. During that time the UI shows only a spinner: it does not identify the model being used, expose request progress, provide a timeout, or let the user cancel.

## Environment

- Cherry Studio version: To be confirmed; 2.0.12 was discussed in the surrounding community conversation, but the reporter did not explicitly confirm their own build
- OS and architecture: To be confirmed
- Provider/model: To be confirmed
- Prompt length: To be confirmed

## Reproduction steps

1. Open a Prompt, Assistant, or Agent resource editor with a non-empty prompt.
2. Click **Polish prompt**.
3. Observe the loading indicator while the generation request is pending.
4. In affected cases, wait several minutes; the action may take about five minutes or appear not to return.

## Actual result

- The polish action can remain pending for minutes or provide no result.
- The user cannot tell which model is handling the request.
- There is no visible timeout, elapsed/progress state, or cancel/retry control while the request is pending.

## Expected result

Prompt polishing should complete within a bounded period or move to a recoverable timeout/error state. The pending UI should identify the selected model and let the user cancel or retry without closing the editor.

## Evidence

- An August 15, 2026 community report observed an approximately five-minute polish operation.
- A separate September 6, 2026 report again described long spinning and, at times, no response.
- Neither report included a log or screenshot for this specific operation.

## Investigation

In the inspected main-line snapshot (`554e42c0a9a40c90f29fa204ac14dbdabfe38806`):

- [`PromptPolishActions`](https://github.com/CherryHQ/cherry-studio/blob/554e42c0a9a40c90f29fa204ac14dbdabfe38806/src/renderer/components/resourceCatalog/dialogs/components/PromptPolishActions.tsx#L81-L157) awaits `fetchGenerate` and keeps the button in a spinner state until the promise settles. It has stale-result guards, but no user cancellation or local timeout.
- [`fetchGenerate`](https://github.com/CherryHQ/cherry-studio/blob/554e42c0a9a40c90f29fa204ac14dbdabfe38806/src/renderer/utils/aiGeneration.ts#L96-L126) resolves an explicitly supplied model or falls back to `readDefaultModel()`. `PromptPolishActions` does not supply a model, so this path uses the default model in that snapshot.

This confirms the unbounded pending-state and model-selection behavior in the inspected snapshot. It does not establish whether the observed delay originates in the provider, network, IPC, or request lifecycle.

## Acceptance criteria

- The polish action has a documented request deadline and exits the loading state when it is exceeded.
- Users can cancel an in-flight polish request and retry without closing the editor.
- The UI identifies the model used for polishing and links or routes to the relevant default-model setting.
- Timeout, provider failure, missing model, and empty response are visibly distinct recoverable states.
- A late response after cancellation or timeout cannot overwrite the user's current prompt.
- Regression tests cover a never-resolving request, a delayed success, cancellation, timeout, and retry.

Contributor guide

Open the contributing guide

Research direction

Start with src/renderer/components/resourceCatalog/dialogs/components/PromptPolishActions.tsx and trace its fetchGenerate call into src/renderer/utils/aiGeneration.ts. Inspect how the pending state and default model are handled, then add regression coverage for never-resolving, delayed, cancelled, timed-out, retried, and late responses. Done means the UI exposes the model, supports recovery, and cannot apply stale results.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
ai, frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.