Roo-Code/webview-ui
daniel-lxs 638ca0e09b
fix: prevent UI flicker and enable resumption after task cancellation
Problem:
- Clicking Terminate during streaming caused the entire chat view to blink
- Task would close, user pushed to home, then back into the task
- Cancel → Resume flow would grey the Resume button but not restart the loop
- Input would become disabled and messages couldn't be sent

Root causes:
1. Hard abort (abandoned=true) was disposing the task instance immediately
2. Provider was rehydrating a new task instance from disk after abort
3. Abort flags stayed set (abort=true) preventing loop resumption
4. No deterministic spinner stopping on cancellation
5. Streaming state wasn't reset on resume

Solution:
- Soft-interrupt: Cancel now uses abortTask(false) to keep instance alive
- No rehydration: Provider skips task recreation for user_cancelled aborts
- Resume pipeline: Added presentResumableAsk() for in-place resume flow
- Abort state reset: Clear abort flags and streaming state before resuming
- Spinner determinism: Inject cancelReason into last api_req_started
- Transactional UI: Pause state updates during checkpoint operations

Changes:
- Task.presentResumableAsk(): New method for soft-interrupt resume
- Task.resumeTaskFromHistory(): Reset abort/streaming state after user confirms
- Task.abortTask(): Distinguish soft (keep alive) vs hard abort (dispose)
- ClineProvider.cancelTask(): Soft abort + schedule presentResumableAsk()
- ClineProvider.onTaskAborted: Skip rehydration for user_cancelled
- ChatView: Handle cancelReason for deterministic streaming state

Tests:
- Task.presentResumableAsk.abort-reset.spec.ts: Verify abort flag reset
- ClineProvider.cancelTask.present-ask.spec.ts: Verify soft-interrupt flow
- Task.spec.ts: Updated abort semantics (soft vs hard)

Result:
- No UI flicker or navigation on Cancel
- Resume button successfully restarts the agent loop
- Input remains enabled throughout cancel/resume cycle
- Spinner stops deterministically on cancellation
- Task history stable, no duplicate entries
2025-11-02 18:56:23 -05:00
..
audio feat: move play audio to webview to ensure cross-platform (#3659) 2025-05-20 01:15:05 -04:00
public Remove CRA cruft 2025-01-30 14:38:41 -08:00
src fix: prevent UI flicker and enable resumption after task cancellation 2025-11-02 18:56:23 -05:00
.gitignore PR cleanup 2025-03-12 11:23:06 -04:00
components.json Remove lucide 2025-01-30 14:47:59 -08:00
eslint.config.mjs Preserve model settings when selecting a specific OpenRouter provider (#3915) 2025-05-23 23:22:41 -07:00
index.html Fix linter warning + run prettier on everything (#3581) 2025-05-13 15:16:24 -07:00
package.json chore(deps): update dependency vite to v6.3.6 [security] (#7838) 2025-10-03 10:00:33 -04:00
tsconfig.json Move @roo-code/cloud to the Roo-Code repo (#7503) 2025-08-28 11:18:45 -07:00
turbo.json Improve turbo task dependency declarations (#4323) 2025-06-04 09:32:27 -07:00
vite.config.ts Move @roo-code/cloud to the Roo-Code repo (#7503) 2025-08-28 11:18:45 -07:00
vitest.config.ts Show console logging in vitests when the --no-silent flag is set (#7467) 2025-08-28 12:51:21 -04:00
vitest.setup.ts Show console logging in vitests when the --no-silent flag is set (#7467) 2025-08-28 12:51:21 -04:00