Skip to content

Conversation

@daniel-lxs
Copy link
Member

@daniel-lxs daniel-lxs commented Nov 4, 2025

Fixes the jarring UI flicker that occurs when cancelling a task.

Problem

When cancelling a task, Task.dispose() caused the UI to briefly navigate to the home view before returning to the task, creating a jarring user experience.

Root Cause

The issue was in ClineProvider.createTaskWithHistoryItem() which always called removeClineFromStack() first, causing the task stack to be temporarily empty and triggering the home view.

Solution

  • Detection Logic: Added check for currentTask taskId === historyItem.id to identify task rehydration
  • In-Place Replacement: When rehydrating the current task, replace it directly in the stack instead of removing first
  • Event Cleanup: Properly clean up old event listeners and set up new ones
  • Backward Compatibility: Normal task creation flow unchanged

Changes

  • Modified ClineProvider.createTaskWithHistoryItem() to detect rehydration scenarios
  • Implemented flicker-free in-place task replacement
  • Added comprehensive unit tests in ClineProvider.flicker-free-cancel.spec.ts

Testing

  • ✅ All existing tests pass (32 passed, 4 skipped)
  • ✅ New flicker-free cancel tests pass (4/4)
  • ✅ Type checking passes
  • ✅ Linting passes

User Experience

Before: Cancel → Home flicker → Task view
After: Cancel → Seamless task rehydration

- Modify ClineProvider.createTaskWithHistoryItem() to detect when rehydrating current task
- Implement in-place task replacement to avoid empty stack state that causes UI flicker
- Add comprehensive unit tests for flicker-free cancel behavior
- Maintain backward compatibility and proper event listener cleanup

Fixes the jarring navigation to home view when cancelling tasks
@daniel-lxs daniel-lxs requested review from cte, jr and mrubens as code owners November 4, 2025 22:21
@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. UI/UX UI/UX related or focused labels Nov 4, 2025
@roomote
Copy link
Contributor

roomote bot commented Nov 4, 2025

See this task on Roo Code Cloud

Code Review Complete ✅

No issues found. The implementation correctly addresses the UI flicker during task cancellation through in-place task replacement. Event listeners are properly managed, and comprehensive tests verify all scenarios.

Previous Reviews

Mention @roomote in a comment to trigger your PR Fixer agent and make changes to this pull request.

… rehydration

- Call abortTask(true) on old task before replacement to stop processes and mark as abandoned
- This ensures proper cleanup and prevents memory leaks during task cancellation
- Add test verification for abortTask cleanup
@hannesrudolph hannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Nov 4, 2025
@daniel-lxs daniel-lxs moved this from Triage to PR [Needs Review] in Roo Code Roadmap Nov 4, 2025
@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Nov 4, 2025
@hannesrudolph hannesrudolph added PR - Needs Review and removed Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. labels Nov 4, 2025
@mrubens mrubens merged commit e25b4e6 into main Nov 5, 2025
18 checks passed
@mrubens mrubens deleted the fix/flicker-free-task-cancel branch November 5, 2025 02:40
@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Nov 5, 2025
@github-project-automation github-project-automation bot moved this from PR [Needs Review] to Done in Roo Code Roadmap Nov 5, 2025
mini2s added a commit to zgsm-ai/costrict that referenced this pull request Nov 6, 2025
* feat: add UsageStats schema and type (RooCodeInc#8441)

feat: add UsageStats schema and type to cloud.ts

Co-authored-by: Roo Code <[email protected]>

* Release: v1.80.0 (RooCodeInc#8442)

chore: bump version to v1.80.0

* feat: add new DeepSeek and GLM models with detailed descriptions to the Chutes provider (RooCodeInc#8467)

* Deprecate free grok 4 fast (RooCodeInc#8481)

Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com>

* fix: improve save button activation in prompts settings (RooCodeInc#5780) (RooCodeInc#8267)

Co-authored-by: MuriloFP <[email protected]>
Co-authored-by: Roo Code <[email protected]>
Co-authored-by: daniel-lxs <[email protected]>

* fix: properly reset cost limit tracking when user clicks "Reset and Continue" (RooCodeInc#6890)

Co-authored-by: Roo Code <[email protected]>
Co-authored-by: daniel-lxs <[email protected]>

* chore(deps): update dependency vite to v6.3.6 [security] (RooCodeInc#7838)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* chore(deps): update dependency glob to v11.0.3 (RooCodeInc#7767)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* chore: add changeset for v3.28.15 (RooCodeInc#8491)

* Changeset version bump (RooCodeInc#8492)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Matt Rubens <[email protected]>

* Clamp GPT-5 max output tokens to 20% of context window (RooCodeInc#8495)

* fix: add ollama and lmstudio to MODELS_BY_PROVIDER (RooCodeInc#8511)

Co-authored-by: Roo Code <[email protected]>

* Release: v1.81.0 (RooCodeInc#8519)

* Add the parent task ID in telemetry (RooCodeInc#8532)

* Release: v1.82.0 (RooCodeInc#8535)

* feat: Experiment: Show a bit of stats in Cloud tab to help users discover there's more in Cloud (RooCodeInc#8415)

Co-authored-by: Roo Code <[email protected]>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Matt Rubens <[email protected]>
Co-authored-by: roomote[bot] <219738659+roomote[bot]@users.noreply.github.com>
Co-authored-by: SannidhyaSah <[email protected]>
Co-authored-by: John Richmond <[email protected]>

* Revert "feat: Experiment: Show a bit of stats in Cloud tab to help users discover there's more in Cloud" (RooCodeInc#8559)

* Identify cloud tasks in the extension bridge (RooCodeInc#8539)

* Revert "Clamp GPT-5 max output tokens to 20% of context window" (RooCodeInc#8582)

* feat: Add Claude Sonnet 4.5 1M context window support for Claude Code… (RooCodeInc#8586)

feat: Add Claude Sonnet 4.5 1M context window support for Claude Code provider

* chore: add changeset for v3.28.16 (RooCodeInc#8592)

* Changeset version bump (RooCodeInc#8593)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Matt Rubens <[email protected]>

* fix(i18n): Update zh-TW run command title (RooCodeInc#8631)

* feat(commands, webview): Add TDD built-in command; Refactor welcome tips and test guide definition

* refactor(project-wiki): separate command from subtask initialization

* feat(command): update built-in commands count and names in tests

* Add Claude Haiku 4.5 (RooCodeInc#8673)

* Release v3.28.17 (RooCodeInc#8674)

* Changeset version bump (RooCodeInc#8675)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Matt Rubens <[email protected]>

* fix(editor): prevent file editing issues when git diff views are open (RooCodeInc#8676)

* fix(editor): prevent file editing issues when git diff views are open

Add scheme checks to ensure only file:// URIs are matched when finding editors,
avoiding issues with git diffs and other schemes. Includes error logging for
failed editor lookups.

* Remove the warnings

* fix(editor): enforce file:// scheme in editor lookups to prevent git diff issues

---------

Co-authored-by: daniel-lxs <[email protected]>

* web: Cloud page and updates to Pricing to explain Cloud Agent Credits (RooCodeInc#8605)

* Adds mention of Cloud agents to /pricing

* Credit pricing FAQ

* Skeleton of a /cloud page and more pricing page tweaks

* Lint

* Update apps/web-roo-code/src/app/cloud/page.tsx

Co-authored-by: roomote[bot] <219738659+roomote[bot]@users.noreply.github.com>

* Code review

* Updates copy to new credit system

* Moves Terms of Service to be backed by a markdown file, easier to read/edit/diff

* Updated ToS

* Twerm copy tweaks

* Cloud screenshot and style adjustments

* Style tweaks

* Styles

---------

Co-authored-by: roomote[bot] <219738659+roomote[bot]@users.noreply.github.com>

* feat: Add userAgent to Bedrock client for version tracking (RooCodeInc#8663)

Co-authored-by: Roo Code <[email protected]>

* feat: Cloud agents in extension (RooCodeInc#8470)

Co-authored-by: Matt Rubens <[email protected]>

* feat: Z AI: only two coding endpoints (RooCodeInc#8687) (RooCodeInc#8693)

* Remove request content from UI messages (RooCodeInc#8696)

* Left align the welcome title (RooCodeInc#8700)

* Update image generation model selection (RooCodeInc#8698)

* feat(core): enhance client ID validation and CSP configuration

* web: Mobile image in /cloud (RooCodeInc#8705)

* feat(ui): add option to hide API request details by default

* Revert cloud agents for now (RooCodeInc#8713)

* chore: add changeset for v3.28.18 (RooCodeInc#8715)

* fix(task): adjust API request handling and error message assignment

* Changeset version bump (RooCodeInc#8716)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Matt Rubens <[email protected]>

* test: update telemetry client mocks and fix test id typo

* Normalize docs-extractor audience tags; remove admin/stakeholder; strip tool invocations (RooCodeInc#8717)

docs(extractor): normalize audience to type="user"; remove admin/stakeholder; strip tool invocation examples

* Add Intercom as a subprocessor (RooCodeInc#8718)

* web: Leftover white bg (RooCodeInc#8719)

Leftover white bg

* feat(zgsm): add supportsMaxTokens flag and adjust max token handling

* docs: update Configuring Profiles video link (RooCodeInc#8189)

Co-authored-by: Roo Code <[email protected]>

* Fix link text for Roomote Control in README (RooCodeInc#8742)

* Try a 5s status mutation timeout (RooCodeInc#8734)

* web: Landing page for the reviewerFirst pass (RooCodeInc#8740)

* First pass

* SEO

* Update apps/web-roo-code/src/app/reviewer/page.tsx

Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com>

---------

Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com>

* Remove GPT‑5 instructions/reasoning_summary from UI message metadata to prevent ui_messages.json bloat (RooCodeInc#8756)

chore(gpt5): stop persisting instructions/reasoning_summary in UI message metadata

Problem: ui_messages.json was getting bloated with unused or duplicated content (system 'instructions' and 'reasoning_summary') that we do not read back. Root cause: earlier OpenAI Responses API implementation persisted these fields to per-message metadata; however, 'instructions' are already sent as top-level request instructions and 'reasoning_summary' is surfaced live via streaming events. Neither field is consumed from storage. Changes: (1) Task.persistGpt5Metadata now stores only previous_response_id; (2) removed instructions and reasoning_summary from types; (3) updated Zod schema; (4) persistence layer writes messages as-is (no sanitizer); (5) tests green. Impact: smaller ui_messages.json, no runtime behavior change for requests. Migration: old metadata fields will be ignored by schema.

* Z.ai: add GLM-4.5-X, AirX, Flash (expand model coverage) (RooCodeInc#8745)

* feat(zai): add GLM-4.5-X, AirX, Flash; sync with Z.ai docs; keep canonical api line keys

* feat(zai): add GLM-4.5V vision model (supportsImages, pricing, 16K max output); add tests

* feat(types,zai): sync Z.AI international model map and tests
- Update pricing, context window, and capabilities for:
  glm-4.5-x, glm-4.5-airx, glm-4.5-flash, glm-4.5v, glm-4.6
- Add glm-4-32b-0414-128k
- Align tests with new model specs

* fix(zai): align handler generics with expanded model ids to satisfy CI compile step

* chore(zai): remove tier pricing blocks for Z.ai models

* fix(zai): simplify names in zaiApiLineConfigs for clarity

* chore(zai): set default temperature to 0.6

---------

Co-authored-by: Roo Code <[email protected]>

* Enable browser-use tool for all image-capable models (RooCodeInc#8121)

Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com>
Co-authored-by: Hannes Rudolph <[email protected]>
Co-authored-by: Matt Rubens <[email protected]>

* Skip failing tools tests (RooCodeInc#8767)

* Update text for clarity in reviewer page (RooCodeInc#8753)

* feat: add GLM-4.6-turbo model to chutes ai provider (RooCodeInc#8502)

Co-authored-by: roomote[bot] <219738659+roomote[bot]@users.noreply.github.com>

* web: Dynamic OpenGraph images (RooCodeInc#8773)

Co-authored-by: Roo Code <[email protected]>

* web: Updates CTA link in /reviewer to send people to /cloud-agents/welcome (