agent-fleet/openspec/changes/chatops-architecture-revision/specs/task-api-endpoints/spec.md
Zer4tul 1bc7580ecc refactor: remove Matrix bot, make agent-fleet platform-agnostic API service
- Remove src/integrations/matrix/ (bot connection, command parsing, notification formatting)
- Remove matrix-sdk dependency from Cargo.toml
- Remove MatrixConfig from config.rs and [matrix] from config.example.toml
- Add GET /api/v1/tasks (list with status/agent_id filter)
- Add POST /api/v1/tasks/{task_id}/retry (Failed/AgentLost → Assigned)
- Add EventStore::list_tasks() with parameterized query
- 29/29 tests pass

Platform integration (Telegram, Matrix, Feishu) is Agent-side responsibility.
agent-fleet is now a pure HTTP API orchestration engine.
2026-05-12 10:59:19 +08:00

29 lines
1.3 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

## ADDED Requirements
### Requirement: Task list API endpoint
Orchestrator SHALL 提供 `GET /api/v1/tasks` 端点,返回任务列表的结构化 JSON。
#### Scenario: List all tasks
- **WHEN** 发送 `GET /api/v1/tasks`
- **THEN** SHALL 返回 JSON 数组每项包含task_id, source, task_type, priority, status, assigned_agent_id, retry_count, max_retries, created_at, assigned_at, started_at, completed_at
#### Scenario: Filter by status
- **WHEN** 发送 `GET /api/v1/tasks?status=running`
- **THEN** SHALL 仅返回 status 为 `running` 的任务
#### Scenario: Filter by agent
- **WHEN** 发送 `GET /api/v1/tasks?agent_id=worker-03`
- **THEN** SHALL 仅返回 assigned_agent_id 为 `worker-03` 的任务
### Requirement: Task retry API endpoint
Orchestrator SHALL 提供 `POST /api/v1/tasks/{task_id}/retry` 端点。
#### Scenario: Retry a failed task
- **WHEN** 发送 `POST /api/v1/tasks/org/repo#42/retry`
- **AND** 任务当前状态为 `failed``agent_lost`
- **THEN** SHALL 将任务状态转换为 `assigned`,返回更新后的任务 JSON
#### Scenario: Retry a non-retryable task
- **WHEN** 发送 `POST /api/v1/tasks/org/repo#42/retry`
- **AND** 任务当前状态不是 `failed``agent_lost`
- **THEN** SHALL 返回 400 错误,说明任务不在可重试状态