Skip to content

Feat/add pending background processes#697

Merged
shehab299 merged 11 commits into
stakpak:mainfrom
shehab299:feat/add-pending-background-processes
May 18, 2026
Merged

Feat/add pending background processes#697
shehab299 merged 11 commits into
stakpak:mainfrom
shehab299:feat/add-pending-background-processes

Conversation

@shehab299
Copy link
Copy Markdown
Collaborator

No description provided.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds visibility into pending/running background tasks during quit, and plumbs a shared TaskManagerHandle so the TUI can query task status directly (instead of being blind to subagent/background activity).

Changes:

  • Thread a shared TaskManagerHandle from CLI interactive mode → MCP server + TUI, and allow MCP server to accept an externally-created handle.
  • On first Ctrl+C in the TUI, asynchronously query tasks and update the “press Ctrl+C again” hint with the number of running/pending/paused background tasks.
  • Extend TUI event types/handlers to carry and store the background-task count.

Reviewed changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
tui/src/services/hint_helper.rs Renders a quit hint that includes background task count when available.
tui/src/services/handlers/mod.rs Handles the new input event to update running_background_tasks; updates test state builder.
tui/src/services/handlers/misc.rs On first Ctrl+C, spawns an async query to count active background tasks and sends an event back to the UI loop.
tui/src/event_loop.rs Extends run_tui signature to accept a shared TaskManagerHandle and stores it in AppState.
tui/src/app/events.rs Adds RunningBackgroundTasksCount input event and marks it as a backend/non-interceptable event.
tui/src/app.rs Adds task_manager_handle and running_background_tasks to AppState and AppStateOptions.
libs/mcp/server/src/lib.rs Adds optional task_manager_handle to server config; uses provided handle or creates its own TaskManager.
cli/src/commands/mcp/server.rs Populates new MCP server config field with None for standalone server.
cli/src/commands/autopilot/mod.rs Uses struct update syntax to pick up new McpInitConfig fields.
cli/src/commands/agent/run/mode_interactive.rs Creates and runs a shared TaskManager; passes handle to both TUI and MCP server init.
cli/src/commands/agent/run/mode_async.rs Uses struct update syntax to pick up new McpInitConfig fields.
cli/src/commands/agent/run/mcp_init.rs Adds task_manager_handle to init config and forwards it into MCPServerConfig.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tui/src/app.rs
Comment thread tui/src/services/handlers/misc.rs
Comment thread libs/mcp/server/src/lib.rs Outdated
@shehab299 shehab299 requested a review from ahmedhesham6 May 4, 2026 23:38
Comment thread libs/mcp/server/src/lib.rs
Comment thread tui/src/app/types.rs Outdated
@shehab299 shehab299 requested a review from ahmedhesham6 May 8, 2026 08:43
@shehab299 shehab299 merged commit 34a517a into stakpak:main May 18, 2026
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants