What happens at each stage, what artifacts are produced, and where the handoffs occur
This sequence diagram shows how an issue flows through the complete pipeline, including the feedback loops when problems are detected.
sequenceDiagram
participant H as Human
participant GL as GitLab
participant CI as CI/CD Pipeline
participant A as AI Agents
participant KB as Kanban Board
H->>GL: Create issue
GL->>CI: Trigger pipeline (ISSUE_IID)
CI->>A: Stage 1: Triage (PM)
A->>KB: Apply status::triage + type labels
CI->>A: Stage 2: Clarification (PM)
alt Issue is vague
A->>GL: Post clarification questions
A->>KB: Add needs-clarification label
Note over H,GL: Pipeline pauses - awaiting human
H->>GL: Answer questions in comment
GL->>CI: Re-trigger pipeline
end
A->>KB: Update status::specification
Note over H,CI: MANUAL GATE: Human triggers Stage 3
CI->>A: Stage 3: Specification (Architect)
A->>GL: Commit spec.md artifact
CI->>A: Stage 4: Spec-Checklist (QA)
alt Checklist fails
A->>GL: Post failed checks
Note over CI,A: Loop back to clarification
end
A->>KB: Add spec-approved label
CI->>A: Stage 5: Planning (Architect)
A->>GL: Commit plan.md artifact
CI->>A: Stage 6: Tasks (Developer)
A->>GL: Commit tasks.md artifact
CI->>A: Stage 7: Analysis (QA)
A->>GL: Commit analysis.md + dependency graph
A->>KB: Add ready-for-implementation label
Note over H,CI: MANUAL GATE: Human triggers Stage 8
CI->>A: Stage 8: Implementation (Developer)
A->>GL: Create branch + MR
CI->>A: Stage 9: Security (Security)
A->>GL: Post security findings
CI->>A: Stage 10: Testing (QA)
A->>GL: Post test-report.md
Note over H,CI: MANUAL GATE: Human triggers Stage 11
CI->>A: Stage 11: Deployment (Developer)
alt Deployment fails
A->>A: Auto-rollback
A->>KB: Add deployment-failed label
end
A->>KB: Update status::done
A smoke test that runs on every push or web trigger. Verifies the runner is functional before any real work begins.
git, curl, and jq are installedwhich claude succeeds, the stage fails with exit code 1ISSUE_IID - it's the only stage that runs standaloneRunners should be deterministic and predictable. Embedding AI directly in runners would make pipeline behavior non-reproducible. AI is invoked as external service calls instead.
The PM agent fetches the issue from GitLab's API and auto-classifies it based on keyword detection in the title and description.
GET /projects/{id}/issues/{iid}bug|fix|error = bug, feature|add|new = feature, enhance|improve = enhancementstatus::triage + detected type:: labelresource_group: issue-$ISSUE_IID to prevent concurrent processingstatus::triage, type::feature | type::bug | type::enhancement
The PM agent evaluates whether the issue has enough detail to write a specification. If not, it generates structured clarification questions and posts them as a comment.
WELL_SPECIFIED, pipeline continuesneeds-clarification label based on resultstatus::triage → status::clarificationWhen clarification is needed, the pipeline effectively pauses. A human must answer the questions by commenting on the issue, then re-trigger the pipeline. The clarification stage will re-evaluate and proceed if answers are sufficient.
The first manual gate. A human must click "play" on this stage in GitLab. The Architect agent then generates a formal specification document.
specs/issue-{IID}/ with checklists/ and contracts/ subdirsspec-template.md as a starting pointspec.md focusing on WHAT and WHY (not technical HOW)specs/issue-{IID}/spec.md — Formal specification (WHAT + WHY)
Quality gate: "unit tests for English." The QA agent validates the spec against a 6-point checklist before allowing planning to begin.
If all checks pass, the spec-approved label is added. If any required check fails, the pipeline loops back for revision.
specs/issue-{IID}/spec-checklist.md — Validation report with pass/fail for each check
Now the Architect transforms WHAT into HOW. Reads the approved spec.md and produces a detailed implementation plan.
spec.md from the previous stage's artifactsplan.md with 3+ implementation tasksspecs/issue-{IID}/plan.md — Implementation plan with tasks, dependencies, file changes
The Developer agent breaks the plan into 3-5 atomic, implementable tasks. Each task is small enough to complete in one session.
plan.md from previous stage[P]ready-for-implementation label when completespecs/issue-{IID}/tasks.md — Task breakdown table with dependencies and criteria
Another quality gate. The QA agent validates that the tasks are complete, properly scoped, and internally consistent.
specs/issue-{IID}/analysis.md — Task validation, dependency graph, risk assessment
The second manual gate. Human reviews the spec, plan, and tasks, then triggers implementation. The Developer agent writes the actual code.
issue-{IID}-implementationimplementation.mdstatus::implementationspecs/issue-{IID}/implementation.md + feature branch + merge request
The Security agent scans the codebase and deployment configuration for vulnerabilities. Behavior differs by group.
password|secret|token|api_key)privileged: true)$HOME/projects/secrets/)For the administrators group, security findings are blocking - the pipeline fails with exit code 1 if any critical issue is found. Infrastructure projects need higher security standards.
For the developers group, security findings are advisory - the pipeline continues with allow_failure: true. Warnings are posted but don't block deployment.
The QA agent auto-detects the project type and runs the appropriate test suite. No configuration needed - it figures out the framework.
package.json → runs npm testpytest.ini or tests/ → runs pytest tests/go.mod → runs go test ./...Cargo.toml → runs cargo testtests/*.sh → runs each test scriptGenerates test-report.md with results. Exits with code 1 if tests fail.
specs/issue-{IID}/test-report.md — Test results with pass/fail counts
The final manual gate. Human confirms deployment after reviewing security findings and test results.
rollback/ directorydeploy.sh or docker compose up -dstatus::done, removes status::deploymentdeployment-failed labelIf deployment fails, the rollback script (scripts/rollback.sh) executes automatically:
docker compose down --remove-orphansmigrations/rollback.sql if it existsdocker compose up -d/tmp/rollback_*.logThe pipeline sends color-coded notifications to #cicd-notifications:ai-servicers.com via a Matrix bot at key moments.
Pipeline Success (main branch) → GREEN notification Pipeline Failure (main branch) → RED notification Manual Gate Reached → ORANGE notification
Notifications are sent using scripts/notify-matrix.sh, which loads the bot token from $HOME/projects/secrets/matrix.env and sends an HTML-formatted m.room.message.
The pipeline has built-in resilience for transient failures.
runner_system_failure or stuck_or_timeout_failurefetch (incremental, not full clone each time)registry.gitlab.ai-servicers.com/administrators/cicd/cicd-runner:latestcicd, docker (ensures jobs go to the right runner)