Skip to content

Implement Background Task System #22

@FerdinandSu

Description

@FerdinandSu

Description / 功能描述

English:
Implement the background task system from MobileSuit .NET v4.5+ to allow long-running commands to execute asynchronously without blocking the interactive shell. This is a complex feature suitable for experienced contributors.

中文:
实现 MobileSuit .NET v4.5+ 的后台任务系统,允许长时间运行的命令异步执行而不阻塞交互式shell。这是一个适合有经验贡献者的复杂功能。

Features / 功能特性

English:

  • Execute commands in background with & prefix
  • Task queue with unique IDs (UUID or incremental)
  • Task status tracking (Running, Completed, Failed, Cancelled)
  • Isolated I/O for each task (BufferedIOHub)
  • Separate logging for each task
  • Built-in commands: tasks, join <id>, cancel <id>
  • Send commands to specific tasks: @<taskId> command
  • Concurrent task execution with configurable limits

中文:

  • 使用 & 前缀在后台执行命令
  • 带唯一ID的任务队列(UUID或递增)
  • 任务状态跟踪(运行中、已完成、失败、已取消)
  • 每个任务的隔离I/O(BufferedIOHub)
  • 每个任务的独立日志
  • 内置命令:tasksjoin <id>cancel <id>
  • 向特定任务发送命令:@<taskId> command
  • 带可配置限制的并发任务执行

Tech Stack / 技术栈

  • Python asyncio for task management / 使用 asyncio 进行任务管理
  • asyncio.Queue for task queue / 使用队列管理任务
  • Thread-safe operations for shared state / 共享状态的线程安全操作
  • Create ISuitTask interface and implementation / 创建ISuitTask接口和实现

Difficulty & Time / 难度与时间

Difficulty / 难度: 🔴 Hard / 困难
Estimated Time / 预估时间: 1-2 weeks / 1-2周

Requirements / 要求

English:

中文:

Acceptance Criteria / 验收标准

  • Parse & prefix for background execution / 解析 & 前缀
  • Create ISuitTask interface / 创建ISuitTask接口
  • Implement task queue with unique IDs / 实现带唯一ID的任务队列
  • Implement BufferedIOHub for tasks / 为任务实现BufferedIOHub
  • Implement tasks command (list all tasks) / 实现tasks命令
  • Implement join <taskId> command / 实现join命令
  • Implement cancel <taskId> command / 实现cancel命令
  • Support @<taskId> command routing / 支持任务命令路由
  • Handle concurrent task execution / 处理并发任务执行
  • Implement task status tracking / 实现任务状态跟踪
  • Add task cancellation via CancellationToken / 添加任务取消
  • Clean up completed tasks / 清理已完成任务
  • Add comprehensive unit tests (80%+ coverage) / 添加全面的单元测试
  • Add integration tests / 添加集成测试
  • Add performance tests / 添加性能测试
  • Update documentation / 更新文档

Reference / 参考

See .claude/MobileSuitFeatures.md Feature #14 for detailed specification.
详细规格请参见 .claude/MobileSuitFeatures.md 功能 #14

Before Starting / 开始之前

⚠️ This is a complex feature. Please comment on this issue to discuss your implementation approach before starting.
⚠️ 这是一个复杂的功能。请在开始之前在此issue下评论讨论你的实现方法。

Metadata

Metadata

Assignees

No one assigned

    Labels

    advancedAdvanced or complex featurescoreCore functionality changesenhancementNew feature or requestfeature-parityPorting from MobileSuit .NET

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions