Skip to content

feat: Phase 5 - Background Tasks Panel UI#12343

Closed
roomote-v0[bot] wants to merge 4 commits into
mainfrom
feature/phase5-background-tasks-panel
Closed

feat: Phase 5 - Background Tasks Panel UI#12343
roomote-v0[bot] wants to merge 4 commits into
mainfrom
feature/phase5-background-tasks-panel

Conversation

@roomote-v0
Copy link
Copy Markdown
Contributor

@roomote-v0 roomote-v0 Bot commented May 12, 2026

This PR attempts to address Issue #12330 (Phase 5: Background Tasks Panel UI).

Summary

Builds on top of the Phase 4 BackgroundTaskRunner (PR #12342) to add user-visible UI for background tasks. This closes the visibility gap where background tasks were previously completely webview-silent.

Phase 5 MVP Scope

Included:

  • Background Tasks Panel (collapsible section in the chat sidebar)
  • Cancel button for running background tasks
  • Badge showing count of active background tasks
  • Basic result summary when a task completes
  • State exposure via postStateToWebview

Deferred to Phase 6+:

  • Full conversation replay for background tasks
  • Real-time progress streaming of individual tool calls
  • Tab switching between foreground/background task conversations
  • Write-capable background tasks and file locking
  • Persistent background task history across sessions

Key Changes

Types (packages/types)

  • BackgroundTaskStatusInfo interface for exposing task status to webview
  • backgroundTasks field on ExtensionState
  • cancelBackgroundTask message type on WebviewMessage

BackgroundTaskRunner (src/core/task/BackgroundTaskRunner.ts)

  • Tracks completed tasks in a ring buffer (max 10 recent)
  • getTasksStatus() returns combined active + completed tasks for the UI
  • onStateChanged callback for notifying the webview when tasks change
  • Completed tasks record status (completed/cancelled/timed_out/error) with result summaries

ClineProvider (src/core/webview/ClineProvider.ts)

  • postBackgroundTasksToWebview() for lightweight status-only updates
  • backgroundTasks included in getStateToPostToWebview()
  • handleBackgroundTaskComplete() passes result summary to the runner
  • onStateChanged callback wired to refresh the webview

WebviewMessageHandler

  • cancelBackgroundTask handler delegates to backgroundTaskRunner.cancelTask()

BackgroundTasksPanel (webview-ui/src/components/chat/BackgroundTasksPanel.tsx)

  • Collapsible panel showing active and recently completed background tasks
  • Each task shows: short ID, elapsed time, status icon with color
  • Running tasks have a cancel button
  • Completed tasks have a "Result" toggle to show the final summary
  • Active count badge on the panel header
  • Auto-hides when there are no background tasks

Testing

  • 31 BackgroundTaskRunner tests (14 new covering getTasksStatus, completed buffer, onStateChanged, timeout tracking)
  • 7 BackgroundTasksPanel UI tests (rendering, cancel, result toggle, collapse)
  • All existing tests pass, all lint and type checks pass

Feedback and guidance are welcome!

Interactively review PR in Roo Code Cloud

roomote added 3 commits May 12, 2026 09:52
…ner)

Implements the MVP for Phase 4 of the parallel execution roadmap:

- Add BackgroundTaskRunner service that manages concurrent read-only
  background tasks separately from the clineStack
- Add isBackgroundTask flag to Task class that suppresses webview
  updates and auto-approves all tool uses
- Extend new_task tool with optional background parameter
- Background tasks are restricted to read-only tools only
- Results are delivered asynchronously to the parent task via
  onBackgroundComplete callback
- Configurable concurrency limit (default 3) and timeout (default 5min)
- Proper cleanup on task cancellation, parent cancellation, and
  provider disposal
- 17 new tests for BackgroundTaskRunner, all existing tests pass

Issue #12330
…nd timeouts

- Add BackgroundTaskRunnerCallbacks interface with onTaskTimeout and onTaskError
- Wire VS Code notifications in ClineProvider: info on completion, warning on timeout/error
- Document auto-approval design decision for read-only background tasks
- Add 2 new tests for callback invocation (19 total, all passing)
Adds a collapsible Background Tasks Panel to the chat sidebar that shows
active and recently completed background tasks. This builds on the Phase 4
BackgroundTaskRunner to give users visibility into background work.

Key changes:
- BackgroundTaskStatusInfo type for exposing task status to the webview
- BackgroundTaskRunner tracks completed tasks with result summaries
- BackgroundTaskRunner.getTasksStatus() returns combined active + completed
- BackgroundTaskRunner.onStateChanged callback for UI refresh
- backgroundTasks field added to ExtensionState and getStateToPostToWebview
- cancelBackgroundTask webview message handler
- postBackgroundTasksToWebview() for lightweight status-only updates
- BackgroundTasksPanel React component with collapsible panel, cancel
  buttons, active count badge, and result summaries
- 31 backend tests (BackgroundTaskRunner) + 7 UI tests (panel component)
@easonLiangWorldedtech
Copy link
Copy Markdown

@roomote Thanks for the clear PR description and the well-structured MVP scope.

I agree with keeping Phase 5 strictly within the boundaries you listed:

  • Collapsible panel in the chat sidebar
  • Cancel button + active count badge
  • Basic result summary
  • Lightweight state exposure via postBackgroundTasksToWebview

The clear separation between “Included” and “Deferred to Phase 6+” is very helpful for scope control. Let’s stick to this MVP for now.

A few points I’d like to align on before proceeding with review:

  1. Result Summary content & granularity
    What exactly will be shown in the “basic result summary”?

    • Only the final AttemptCompletion message?
    • Or will it also include key tool outputs / short summaries?
      This decision will directly affect how we design context handoff in Phase 6. I suggest we keep it minimal for Phase 5 (final output + status only) to avoid carrying unnecessary state.
  2. Panel placement & space usage
    Putting the collapsible panel in the chat sidebar with auto-hide looks reasonable. However, when 2–3 background tasks are running at the same time, could it start competing for vertical space with the main chat area? Any plans to make it more compact or allow repositioning later?

  3. Cancel behavior
    Should we add a confirmation step before cancelling a background task? Also, after cancellation, is the current VS Code notification enough, or do we want to show clearer feedback inside the panel itself?

  4. Phase 6 evolution path
    How much effort would it take to evolve this panel later into tabs or a separate Background Tasks view? Are there any extension points we should consider now to make future changes easier?

If we can first confirm the scope and content of the result summary, the rest should be straightforward. Would you be able to share a quick screenshot or example of what the result summary currently displays in the preview? That would help me understand the current implementation.

I’ll also review Phase 4 (#12342) shortly. It probably makes sense to get Phase 4 merged first before we finalize Phase 5, to keep the dependency clean.

Thanks for the work on this!

@roomote-v0
Copy link
Copy Markdown
Contributor Author

roomote-v0 Bot commented May 12, 2026

Fixaroo Clock   See task

Addressed the review feedback: added two-click cancel confirmation, panel max-height scroll constraint (200px) to prevent vertical space competition, and Phase 6 extension-point comments in both BackgroundTaskRunner and BackgroundTasksPanel. All 31 backend + 7 UI tests pass, lint and type checks clean.

View commit | Revert commit

@easonLiangWorldedtech
Copy link
Copy Markdown

@roomote-v0[bot] Thanks for the quick updates.

The changes look good:

  • Two-click cancel confirmation improves safety
  • 200px max-height + scroll constraint effectively prevents UI space competition
  • Adding Phase 6 extension-point comments in both BackgroundTaskRunner and BackgroundTasksPanel is helpful for future evolution

All tests still pass and the scope remains clean.

A couple of small follow-ups:

  1. Could you share the exact comments you added for the Phase 6 extension points? I want to make sure the direction aligns with what we discussed for context handoff.
  2. With the 200px constraint, is the panel still easy to use when there are 3+ active tasks? (Just want to confirm the UX feels acceptable)

Once these are confirmed, I’m comfortable moving forward. I’ll also review Phase 4 shortly so we can keep the dependency order clean.

Thanks again!

@roomote-v0
Copy link
Copy Markdown
Contributor Author

roomote-v0 Bot commented May 12, 2026

Proofessor Clock   See task

Here are the answers to both questions:


1. Phase 6 Extension-Point Comments

Two blocks were added:

src/core/task/BackgroundTaskRunner.ts (file header, lines 12-20):

Phase 6+ extension points:
- To support write-capable background tasks, extend BACKGROUND_TASK_ALLOWED_TOOLS
  and add a file-locking mechanism to prevent conflicts with foreground edits.
- For real-time progress streaming, add an `onProgressUpdate` callback to
  BackgroundTaskInfo and emit partial tool-call summaries from Task.
- For persistent history across sessions, serialize completedTasks to global
  state via the TaskHistoryStore and restore on provider initialization.
- For tab-based switching, expose the background task's clineMessages via
  getTasksStatus() so the webview can render a full conversation view.

webview-ui/src/components/chat/BackgroundTasksPanel.tsx (component JSDoc, lines 144-152):

Phase 6+ evolution notes:
- This panel can be promoted to a tab-based view alongside the main chat
  by extracting the task list into a shared component and rendering it in
  both the sidebar panel and a dedicated "Background Tasks" tab.
- For real-time progress streaming, each BackgroundTaskItem could accept
  a `progressMessages` prop with the last N tool-call summaries.
- For conversation replay, clicking a completed task could open its full
  message history in a read-only chat view (reuse ChatView with a
  `readOnly` flag and the task's clineMessages).

The backend comments focus on the data/infrastructure side (tool allowlist, callbacks, serialization, message exposure), while the frontend comments describe how the UI would evolve to consume those capabilities. Together they sketch a clean handoff path for context: the runner exposes clineMessages via getTasksStatus(), and the panel renders them through a readOnly ChatView or progressMessages prop.


2. UX with 200px Constraint and 3+ Active Tasks

The panel is usable with 3+ tasks. Here's the breakdown:

  • Each BackgroundTaskItem uses px-2 py-1.5 padding with border and mb-1 margin, which comes to roughly 34-38px per row (depending on font size).
  • At 200px of scrollable area (max-h-[200px] overflow-y-auto), that fits 5 task rows comfortably without scrolling.
  • For 6+ tasks, the scroll kicks in smoothly -- the items are compact enough that scrolling feels natural.
  • The result summary expansion (max-h-24 = 96px) is independently scrollable inside each item, so expanding a result doesn't push all other items out of view.
  • The panel header (with badge count and total) stays fixed outside the scroll container, so context is never lost.

In short: 3 tasks display fully without scrolling, 5 tasks still fit, and beyond that the scroll behavior handles it cleanly. The UX is acceptable.

@easonLiangWorldedtech
Copy link
Copy Markdown

@roomote-v0[bot] Thanks for the detailed answers to both questions. This is helpful.

The Phase 6 extension-point comments you added are clear and well-aligned with the overall direction of parallel execution and context handoff. The backend and frontend notes together form a reasonable evolution path.

The UX explanation for the 200px max-height constraint is also acceptable — 5 tasks fitting comfortably with smooth scrolling beyond that works for the MVP.

At this point the implementation looks good and stays within the defined Phase 5 MVP scope.

Please mark this PR as ready for review and request reviews from the code owners.

Thanks for keeping the progress moving cleanly.

@roomote-v0
Copy link
Copy Markdown
Contributor Author

roomote-v0 Bot commented May 12, 2026

Fixaroo Clock   See task

Done. PR has been marked as ready for review and reviews have been requested from all code owners (@mrubens, @cte, @jr, @hannesrudolph, @daniel-lxs).

@roomote-v0 roomote-v0 Bot marked this pull request as ready for review May 12, 2026 12:35
@dosubot dosubot Bot added size:XL This PR changes 500-999 lines, ignoring generated files. Enhancement New feature or request UI/UX UI/UX related or focused labels May 12, 2026
@roomote-v0
Copy link
Copy Markdown
Contributor Author

roomote-v0 Bot commented May 12, 2026

Closing as part of PR restructuring per issue #12330. This work will be combined into the new Remaining Phases (4+5+6) PR with proper stacked branching.

@roomote-v0 roomote-v0 Bot closed this May 12, 2026
@github-project-automation github-project-automation Bot moved this from New to Done in Roo Code Roadmap May 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Enhancement New feature or request size:XL This PR changes 500-999 lines, ignoring generated files. UI/UX UI/UX related or focused

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants