Sprint Chains
Execute a workflow multiple times in batch using Sprint Chains - a phased execution mechanism that tracks per-sprint PRs and supports resuming from any sprint.
Sprint Chains are a batch execution mechanism that runs the same workflow multiple times in sequence - once per sprint. Each sprint executes the full workflow pipeline against the project repository and produces its own pull request. Sprint chains are designed for phased development work: when a large task is naturally divided into sequential phases that each deserve their own implementation cycle, review, and merge.
Sprint Chains vs. Work Chains
CodeCourier provides two chain mechanisms, and the distinction matters:
- Sprint Chains - Execute the same workflow multiple times. Each execution is called a sprint. Sprint 1 runs the workflow, sprint 2 runs the same workflow again on the next task, and so on. Used when you want to push a workflow through several phases of work, each yielding a separate PR.
- Work Chains - Execute different issues through a single workflow. Each item in the work chain is a different task, all processed through the same pipeline. Used for batch-processing a backlog of issues via an automated queue.
Key Distinction
Sprint Chain Data Model
A sprint chain record captures the full configuration and runtime state of the batch execution:
{
userId: string, // Owner who created the chain
projectId: string, // Project the chain belongs to
workflowId: string, // Workflow blueprint to execute each sprint
status: "pending" // Chain lifecycle state
| "running"
| "completed"
| "failed"
| "cancelled",
sprintRange: number, // Total number of sprints (e.g., 5)
currentSprintIndex: number, // Zero-based index of the in-progress sprint
resumeFromSprint: number, // Sprint index to restart from (for recovery)
sprintPrUrls: string[], // PR URL created per sprint (index-aligned)
}The sprintPrUrls array is index-aligned to the sprint sequence. sprintPrUrls[0] holds the PR from sprint 1, sprintPrUrls[1] from sprint 2, and so on. Sprints that have not yet completed have undefined at their index.
Creating a Sprint Chain
Sprint chains are created and managed from the Runs page (/p/[id]/runs) using the sprint chain launcher.
Open the Sprint Chain Launcher
On the project’s Runs page, click "New Sprint Chain". The launcher panel appears on the right side of the screen.
Select a Workflow
Choose the workflow blueprint that will be executed for every sprint. The workflow must already exist in your project. All sprints use this same blueprint, so select the one most appropriate for the phased work you’re planning.
Configure the Sprint Range
Set the sprint range - the total number of sprints to execute. For example, a sprint range of 5 means the workflow will run 5 times in sequence. Each sprint is numbered from 1 to N(displayed as "Sprint 1 of 5", "Sprint 2 of 5", etc.).
Plan Your Sprint Count Carefully
Write Per-Sprint Prompts (Optional)
You can provide a single base prompt or configure individual prompts for each sprint. If a single prompt is provided, every sprint receives the same task description. For phased work where each sprint has a distinct objective, supply per-sprint prompts to guide each execution.
Launch the Chain
Click "Start Sprint Chain". CodeCourier creates the sprint chain record with status pending and immediately begins executing sprint 1. The chain entry appears in the Runs list with source sprint so it can be filtered separately from direct workflow runs.
Execution Lifecycle
The sprint chain orchestrator manages execution across all sprints. The lifecycle follows a strict sequential pattern:
Chain Status Transitions
pending- The chain has been created but the first sprint has not started. This is a brief transitional state.running- A sprint is actively executing. ThecurrentSprintIndexfield reflects which sprint is in progress.completed- All sprints finished successfully. Every sprint produced a run and (if code was changed) a pull request.failed- A sprint encountered an unrecoverable error that prevented the chain from continuing. The chain record captures which sprint failed.cancelled- The user manually stopped the chain before all sprints completed.
Per-Sprint Run Creation
For each sprint, the orchestrator creates a standard workflow run record with:
{
source: "sprint", // Identifies the run as sprint-originated
workflowId: chain.workflowId,
prompt: sprintPrompt, // The sprint's prompt (base or per-sprint)
// ... standard run configuration
}When the sprint’s run completes and a PR is created, the chain orchestrator captures the PR URL into sprintPrUrlsat the current sprint’s index, then advances currentSprintIndex and begins the next sprint.
Sprint Sequencing
Sprints are strictly sequential - sprint 2 does not start until sprint 1’s run has fully completed (status completedor failed). This ensures that each sprint can build on the code changes committed by the previous sprint. The branch used across sprints is typically the same feature branch, so each sprint’s commits stack on top of prior sprints’ work.
Per-Sprint PR Tracking
One of the key features of sprint chains is per-sprint pull request tracking. Each sprint that produces code changes creates its own pull request. The sprintPrUrls array records these URLs, giving you a complete audit trail of what was delivered in each sprint phase.
sprintPrUrls: [
"https://github.com/org/repo/pull/42", // Sprint 1 PR
"https://github.com/org/repo/pull/43", // Sprint 2 PR
"https://github.com/org/repo/pull/44", // Sprint 3 PR
undefined, // Sprint 4 (not yet run)
undefined, // Sprint 5 (not yet run)
]The PR URLs in sprintPrUrlsare displayed on the sprint chain detail view, giving you direct links to review each sprint’s output without navigating through the full runs list.
Resume from Sprint
Sprint chains support a resume from sprint capability. If a chain fails or is cancelled before completing, you can restart it from any specific sprint rather than rerunning the entire sequence.
The resumeFromSprint field on the sprint chain record controls which sprint index the orchestrator starts from when the chain is resumed. Setting resumeFromSprint = 2 (zero-indexed) means the chain begins at sprint 3, skipping sprints 1 and 2.
Identify the Failure Point
Check currentSprintIndexon the failed chain to see which sprint was in progress when the failure occurred. Review that sprint’s run detail page to understand the root cause.
Set the Resume Index
From the sprint chain detail view, click "Resume from Sprint" and enter the sprint number you want to restart from. CodeCourier setsresumeFromSprintaccordingly. You can resume from the failed sprint itself (to retry it) or from the next sprint (if the failed sprint’s work was committed and you want to continue forward).
Restart the Chain
Click "Resume". The orchestrator sets the chain status back to running and begins execution at the specified sprint. Previously completed sprints are not re-executed, and their PR URLs in sprintPrUrls are preserved.
Resume After Partial Progress
Cancelling a Sprint Chain
You can cancel a running sprint chain at any time from the sprint chain detail view. Cancellation:
- Sets the chain status to
cancelled. - Cancels the currently running sprint’s workflow run if it is still in progress.
- Prevents subsequent sprints from starting.
All sprint PRs created before cancellation remain open in GitHub. Work committed to the branch is preserved and can be resumed using the resume capability.
Use Cases
- Iterative feature development - Sprint 1 scaffolds the data model and API, sprint 2 builds the UI, sprint 3 adds tests, sprint 4 handles edge cases. Each sprint produces a reviewable PR.
- Phased migrations - Sprint 1 migrates component library A, sprint 2 migrates library B, sprint 3 updates all consumers. Each sprint is a safe, independent unit of change.
- Batch code quality improvements - Each sprint runs the same quality workflow against a different module of the codebase, with per-sprint prompts targeting specific directories.
- Incremental test coverage - Sprint by sprint, a workflow adds test coverage to different areas, with each sprint targeting a different package or feature domain.
- Rolling dependency updates - Sprint 1 updates one set of dependencies, sprint 2 updates the next, avoiding one massive PR with hundreds of conflicts.
Monitoring Sprint Chains
Sprint chains are visible in two places:
- Runs list - Individual sprint runs appear with source
sprint. Use the source filter to isolate them. - Sprint chain detail view- Shows the chain status, current sprint index, all sprint PR URLs, and a timeline of sprint executions. Accessible from the chain’s entry in the Runs page navigation.
Notifications are sent when the chain completes (sprint_completed) or fails (sprint_failed), so you don’t need to actively monitor execution.