-
Notifications
You must be signed in to change notification settings - Fork 24
Implement Background Task System #22
Copy link
Copy link
Open
Labels
advancedAdvanced or complex featuresAdvanced or complex featurescoreCore functionality changesCore functionality changesenhancementNew feature or requestNew feature or requestfeature-parityPorting from MobileSuit .NETPorting from MobileSuit .NET
Description
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)
- 每个任务的独立日志
- 内置命令:
tasks、join <id>、cancel <id> - 向特定任务发送命令:
@<taskId> command - 带可配置限制的并发任务执行
Tech Stack / 技术栈
- Python
asynciofor task management / 使用asyncio进行任务管理 asyncio.Queuefor task queue / 使用队列管理任务- Thread-safe operations for shared state / 共享状态的线程安全操作
- Create
ISuitTaskinterface and implementation / 创建ISuitTask接口和实现
Difficulty & Time / 难度与时间
Difficulty / 难度: 🔴 Hard / 困难
Estimated Time / 预估时间: 1-2 weeks / 1-2周
Requirements / 要求
English:
- MUST follow MobileSuit .NET API (see
.claude/MobileSuitFeatures.mdFeature 对PromptFormatter,SuitAppInfom,SuitMethodParameterInfo进行了单元测试 ,并对SuitBuildUtils测试类进行了部分修改 #14) - MUST isolate task I/O from main shell I/O
- MUST handle task cancellation gracefully
- MUST prevent task ID collisions
- MUST clean up completed tasks (configurable retention)
- PR MUST include:
- Complete ISuitTask implementation
- Unit tests for task lifecycle
- Integration tests for concurrent tasks
- Performance tests (handle 10+ concurrent tasks)
- Comprehensive documentation
- Example long-running commands
中文:
- 必须 遵循MobileSuit .NET API(参见
.claude/MobileSuitFeatures.md功能 对PromptFormatter,SuitAppInfom,SuitMethodParameterInfo进行了单元测试 ,并对SuitBuildUtils测试类进行了部分修改 #14) - 必须 隔离任务I/O与主shell I/O
- 必须 优雅地处理任务取消
- 必须 防止任务ID冲突
- 必须 清理已完成的任务(可配置保留)
- PR 必须 包含:
- 完整的ISuitTask实现
- 任务生命周期的单元测试
- 并发任务的集成测试
- 性能测试(处理10个以上并发任务)
- 全面的文档
- 示例长时间运行命令
Acceptance Criteria / 验收标准
- Parse
&prefix for background execution / 解析&前缀 - Create
ISuitTaskinterface / 创建ISuitTask接口 - Implement task queue with unique IDs / 实现带唯一ID的任务队列
- Implement
BufferedIOHubfor tasks / 为任务实现BufferedIOHub - Implement
taskscommand (list all tasks) / 实现tasks命令 - Implement
join <taskId>command / 实现join命令 - Implement
cancel <taskId>command / 实现cancel命令 - Support
@<taskId> commandrouting / 支持任务命令路由 - 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 / 开始之前
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
advancedAdvanced or complex featuresAdvanced or complex featurescoreCore functionality changesCore functionality changesenhancementNew feature or requestNew feature or requestfeature-parityPorting from MobileSuit .NETPorting from MobileSuit .NET