This document specifies the Kanban-style ticket state machine, phase orchestration across tickets, blocking detection, and parallel processing rules.
Parent Document: Multi-Agent Orchestration Requirements
Tickets SHALL use the following states:
backlog → analyzing → building → building-done → testing → done with optional blocked overlay.
Valid transitions:
backlog → analyzing
analyzing → building | blocked
building → building-done | blocked
building-done → testing | blocked
testing → done | building (on fix needed) | blocked
blocked → analyzing | building | building-done | testing
Phase completion events SHALL advance the ticket automatically when acceptance criteria are met.
Failed validation/testing SHALL regress to the previous actionable phase with context attached.
Each phase MUST define completion criteria and artifacts:
- analyzing → requirements doc/diffs, clarified scope
- building → merged edits, CI green build
- building-done → packaging + handoff bundle
- testing → successful unit/integration/E2E evidence
At entry to a phase, the system SHALL seed initial tasks (see Task Queue Management) with correct capabilities and dependencies.
On failure, the system MUST preserve artifacts and context for deterministic re-entry to the previous phase.
If a ticket remains in the same non-terminal state longer than BLOCKING_THRESHOLD (default 30m) with no task progress, mark as blocked.
Blockers SHALL be classified: dependency, waiting_on_clarification, failing_checks, environment; classification MUST influence remediation tasks.
Emit alerts with suggested remediation and auto-create unblocking tasks where possible.
Tickets without inter-ticket dependencies MAY run in parallel up to MAX_CONCURRENT_TICKETS.
Parallelism MUST respect resource budgets; guardian MAY throttle globally.
Prefer agent affinity for continuity but apply anti-affinity to avoid hotspots when utilization > 80%.
Track ticket lead time (backlog → done) and phase cycle times; alert on outliers.
Track ratio of time blocked vs active; surface top blocker classes weekly.
Testing→building regressions per ticket; investigate if above threshold.
| Parameter | Default | Description |
|---|---|---|
| BLOCKING_THRESHOLD | 30m | Time in-state before blocked |
| MAX_CONCURRENT_TICKETS | 50 | Parallel tickets cap |
| PHASE_SEED_BATCH | 10 | Initial tasks created per phase |
from __future__ import annotations
from datetime import datetime
from enum import Enum
from typing import Dict, List, Optional
from pydantic import BaseModel, Field
class TicketStatusEnum(str, Enum):
BACKLOG = "backlog"
ANALYZING = "analyzing"
BUILDING = "building"
BUILDING_DONE = "building-done"
TESTING = "testing"
DONE = "done"
BLOCKED = "blocked" # overlay/flag, used alongside current status
class Ticket(BaseModel):
id: str
title: str
description: str
status: TicketStatusEnum
priority: str # CRITICAL | HIGH | MEDIUM | LOW (reuse PriorityEnum if imported)
created_at: datetime
updated_at: datetime
assigned_agents: List[str] = Field(default_factory=list)
tasks: List[str] = Field(default_factory=list)
current_phase: str # REQUIREMENTS | IMPLEMENTATION | VALIDATION | ANALYSIS | TESTING
metadata: Dict[str, str] = Field(default_factory=dict)
blocked_reason: Optional[str] = None
class PhaseGateArtifacts(BaseModel):
ticket_id: str
analyzing_artifacts: List[str] = Field(default_factory=list)
building_artifacts: List[str] = Field(default_factory=list)
packaging_bundle_uri: Optional[str] = None
testing_evidence: List[str] = Field(default_factory=list)
last_phase_passed_at: Optional[datetime] = None- Task Queue Management Requirements
- Monitoring & Fault Tolerance Requirements
- MCP Integration Requirements
| Version | Date | Author | Changes |
|---|---|---|---|
| 1.0 | 2025-11-16 | AI Spec Agent | Initial draft |